Commit 5769b477eb86b2106485b61dd0eaeba24f30484b

Authored by Adeel Kazmi
1 parent 1c161ead

Removed redundant Logging & Mesh sorting examples as well as adding ESC handling to some demos

Change-Id: Ifefc497bb0f5e5f37670add8a2934df47619e83b
com.samsung.dali-demo.xml
... ... @@ -109,9 +109,6 @@
109 109 <ui-application appid="text-scrolling.example" exec="/usr/apps/com.samsung.dali-demo/bin/text-scrolling.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
110 110 <label>Text Scrolling</label>
111 111 </ui-application>
112   - <ui-application appid="logging.example" exec="/usr/apps/com.samsung.dali-demo/bin/logging.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
113   - <label>Logging</label>
114   - </ui-application>
115 112 <ui-application appid="animated-shapes.example" exec="/usr/apps/com.samsung.dali-demo/bin/animated-shapes.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
116 113 <label>Animated shapes</label>
117 114 </ui-application>
... ...
examples-reel/dali-examples-reel.cpp
... ... @@ -56,10 +56,8 @@ int DALI_EXPORT_API main(int argc, char **argv)
56 56 demo.AddExample(Example("image-view-svg.example", DALI_DEMO_STR_TITLE_IMAGE_VIEW_SVG));
57 57 demo.AddExample(Example("image-view-url.example", DALI_DEMO_STR_TITLE_IMAGE_VIEW_URL));
58 58 demo.AddExample(Example("line-mesh.example", DALI_DEMO_STR_TITLE_LINE_MESH));
59   - demo.AddExample(Example("logging.example", DALI_DEMO_STR_TITLE_LOGGING));
60 59 demo.AddExample(Example("magnifier.example", DALI_DEMO_STR_TITLE_MAGNIFIER));
61 60 demo.AddExample(Example("mesh-morph.example", DALI_DEMO_STR_TITLE_MESH_MORPH));
62   - demo.AddExample(Example("mesh-sorting.example", DALI_DEMO_STR_TITLE_MESH_SORTING));
63 61 demo.AddExample(Example("motion-stretch.example", DALI_DEMO_STR_TITLE_MOTION_STRETCH));
64 62 demo.AddExample(Example("native-image-source.example", DALI_DEMO_STR_TITLE_NATIVE_IMAGE_SOURCE));
65 63 demo.AddExample(Example("popup.example", DALI_DEMO_STR_TITLE_POPUP));
... ...
examples/clipping-draw-order/clipping-draw-order.cpp
... ... @@ -52,6 +52,9 @@ public:
52 52 Stage stage = Stage::GetCurrent();
53 53 stage.SetBackgroundColor( Color::WHITE );
54 54  
  55 + // Connect to the stage's key signal to allow Back and Escape to exit.
  56 + stage.KeyEventSignal().Connect( this, &ClippingDrawOrderVerification::OnKeyEvent );
  57 +
55 58 // Create the title label.
56 59 TextLabel title = TextLabel::New( "Clipping draw order verification" );
57 60 title.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
... ... @@ -204,23 +207,32 @@ public:
204 207 return true;
205 208 }
206 209  
  210 + /**
  211 + * @brief Called when any key event is received
  212 + *
  213 + * Will use this to quit the application if Back or the Escape key is received
  214 + * @param[in] event The key event information
  215 + */
  216 + void OnKeyEvent( const KeyEvent& event )
  217 + {
  218 + if( event.state == KeyEvent::Down )
  219 + {
  220 + if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) )
  221 + {
  222 + mApplication.Quit();
  223 + }
  224 + }
  225 + }
  226 +
207 227 private:
208 228 Application& mApplication;
209 229 };
210 230  
211   -void RunVerification( Application& application )
212   -{
213   - ClippingDrawOrderVerification verification( application );
214   -
215   - application.MainLoop();
216   -}
217   -
218 231 // Entry point for Linux & Tizen applications.
219 232 int DALI_EXPORT_API main( int argc, char **argv )
220 233 {
221 234 Application application = Application::New( &argc, &argv );
222   -
223   - RunVerification( application );
224   -
  235 + ClippingDrawOrderVerification verification( application );
  236 + application.MainLoop();
225 237 return 0;
226 238 }
... ...
examples/logging/logging-example.cpp deleted
1   -/*
2   - * Copyright (c) 2017 Samsung Electronics Co., Ltd.
3   - *
4   - * Licensed under the Apache License, Version 2.0 (the "License");
5   - * you may not use this file except in compliance with the License.
6   - * You may obtain a copy of the License at
7   - *
8   - * http://www.apache.org/licenses/LICENSE-2.0
9   - *
10   - * Unless required by applicable law or agreed to in writing, software
11   - * distributed under the License is distributed on an "AS IS" BASIS,
12   - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   - * See the License for the specific language governing permissions and
14   - * limitations under the License.
15   - *
16   - */
17   -
18   -#include "shared/view.h"
19   -#include <dali/dali.h>
20   -#include <dali-toolkit/dali-toolkit.h>
21   -#include <dali/devel-api/adaptor-framework/performance-logger.h>
22   -#include <sstream>
23   -
24   -using namespace Dali;
25   -
26   -// Define this so that it is interchangeable
27   -// "DP" stands for Device independent Pixels
28   -#define DP(x) x
29   -
30   -//enum ButtonType
31   -//{
32   -// PUSH_BUTTON,
33   -// TOGGLE_BUTTON
34   -//};
35   -//
36   -//struct ButtonItem
37   -//{
38   -// ButtonType type;
39   -// const char* name;
40   -// const char* text;
41   -// const char* altText;
42   -//};
43   -
44   -namespace
45   -{
46   -
47   -const char* const BACKGROUND_IMAGE = DEMO_IMAGE_DIR "background-gradient.jpg";
48   -const char* const TOOLBAR_IMAGE = DEMO_IMAGE_DIR "top-bar.png";
49   -
50   -const char* const TOOLBAR_TITLE = "Logging";
51   -//const int TOOLBAR_HEIGHT = 62;
52   -
53   -const int MARGIN_SIZE = 10;
54   -const int TOP_MARGIN = 85;
55   -
56   -const int LOGGER_GROUP_HEIGHT = 84;
57   -const int LOGGER_RADIO_GROUP_HEIGHT = 200;
58   -
59   -const int LOGGER_RADIO_SPACING = 48;
60   -
61   -const int CONSOLE_HEIGHT = 84;
62   -
63   -const int BUTTON_WIDTH = 200;
64   -const int BUTTON_HEIGHT = LOGGER_GROUP_HEIGHT - MARGIN_SIZE * 2;
65   -
66   -const Vector4 BACKGROUND_COLOUR( 1.0f, 1.0f, 1.0f, 0.15f );
67   -
68   -// Button IDs
69   -const char* const LOGGER_1_RADIO_ID = "LOGGER_1_RADIO";
70   -const char* const LOGGER_2_RADIO_ID = "LOGGER_2_RADIO";
71   -const char* const LOGGER_3_RADIO_ID = "LOGGER_3_RADIO";
72   -
73   -const char* const FREQUENCY_1_RADIO_ID = "FREQUENCY_1_RADIO";
74   -const char* const FREQUENCY_2_RADIO_ID = "FREQUENCY_2_RADIO";
75   -const char* const FREQUENCY_3_RADIO_ID = "FREQUENCY_3_RADIO";
76   -
77   -const char* const CREATE_BUTTON_ID = "CREATE_BUTTON";
78   -const char* const DELETE_BUTTON_ID = "DELETE_BUTTON";
79   -const char* const START_BUTTON_ID = "START_BUTTON";
80   -const char* const STOP_BUTTON_ID = "STOP_BUTTON";
81   -const char* const HIGH_FREQ_BUTTON_ID = "INC_FREQ_BUTTON";
82   -const char* const LOW_FREQ_BUTTON_ID = "DEC_FREQ_BUTTON";
83   -const char* const ENABLE_BUTTON_ID = "ENABLE_BUTTON";
84   -const char* const DISABLE_BUTTON_ID = "DISABLE_BUTTON";
85   -const char* const VSYNC_BUTTON_ID = "VSYNC_BUTTON";
86   -
87   -const char* const CREATE_BUTTON_TEXT = "Create";
88   -const char* const DELETE_BUTTON_TEXT = "Delete";
89   -const char* const START_BUTTON_TEXT = "Start";
90   -const char* const STOP_BUTTON_TEXT = "Stop";
91   -const char* const ENABLE_BUTTON_TEXT = "Enable";
92   -const char* const DISABLE_BUTTON_TEXT = "Disable";
93   -const char* const VSYNC_BUTTON_TEXT = "Vsync";
94   -
95   -const char* const FREQUENCY_1_RADIO_TEXT = "1";
96   -const char* const FREQUENCY_2_RADIO_TEXT = "2";
97   -const char* const FREQUENCY_3_RADIO_TEXT = "10";
98   -
99   -const char* const LOGGER_TEXT = "Logger:";
100   -const char* const FREQUENCY_TEXT = "Frequency (sec):";
101   -
102   -const unsigned int NUM_LOGGERS = 3;
103   -
104   -const unsigned int HIGH_FREQUENCY = 1; // Seconds
105   -const unsigned int MEDIUM_FREQUENCY = 2; // Seconds
106   -const unsigned int LOW_FREQUENCY = 10; // Seconds
107   -const unsigned int NUM_FREQUENCIES = 3;
108   -
109   -} // namespace
110   -
111   -/**
112   - * This example is a test harness for performance loggers.
113   - *
114   - * Press one of the create buttons to create a logger. This will output on vsync at the default frequency (2 seconds).
115   - * In case nothing appears in the log, force a vsync by touching anywhere on the screen. Loggers can be deleted
116   - * with the delete buttons. They can be enabled or disabled in which case logging will appear or disappear in the console
117   - * respectively. To record information in a logger press the start and then stop button in succession quickly in between
118   - * the time period when it would print to the console. This is necessary as the logger is cleared of information when
119   - * it prints. The output will contain the smallest and largest times between start and stop recorded (minimum and maximum),
120   - * the total time recorded by the logger as well as the average and standard deviation of all the times recorded. The
121   - * frequency of log output can be set to high frequency (every 1 second) or low frequency (every 10 seconds).
122   - */
123   -class LoggingController: public ConnectionTracker
124   -{
125   - public:
126   -
127   - LoggingController( Application& application )
128   - : mApplication( application ),
129   - mView(),
130   - mToolBar(),
131   - mContentLayer(),
132   - mAnimation(),
133   - mPerformanceLoggerNames(),
134   - mPerformanceLoggers(),
135   - mCurrentLogger( 0 ),
136   - mLoggerStates(),
137   - mLogRadioButtons(),
138   - mFrequencyRadioButtons()
139   - {
140   - // Connect to the Application's Init signal
141   - mApplication.InitSignal().Connect( this, &LoggingController::Create );
142   - }
143   -
144   - ~LoggingController()
145   - {
146   - // Nothing to do here
147   - }
148   -
149   - void Create( Application& application )
150   - {
151   - // The Init signal is received once (only) during the Application lifetime
152   -
153   - mCurrentLogger = 0;
154   - mPerformanceLoggers.reserve( NUM_LOGGERS );
155   - mPerformanceLoggers.resize( NUM_LOGGERS );
156   -
157   - mPerformanceLoggerNames.reserve( NUM_LOGGERS );
158   - mPerformanceLoggerNames.resize( NUM_LOGGERS );
159   -
160   - mLoggerStates.reserve( NUM_LOGGERS );
161   - mLoggerStates.resize( NUM_LOGGERS );
162   -
163   - mLogRadioButtons.reserve( NUM_LOGGERS );
164   - mLogRadioButtons.resize( NUM_LOGGERS );
165   -
166   - mFrequencyRadioButtons.reserve( NUM_FREQUENCIES );
167   - mFrequencyRadioButtons.resize( NUM_FREQUENCIES );
168   -
169   - // Respond to key events
170   - Stage::GetCurrent().KeyEventSignal().Connect(this, &LoggingController::OnKeyEvent);
171   -
172   - // Creates a default view with a default tool bar.
173   - // The view is added to the stage.
174   - mContentLayer = DemoHelper::CreateView( application,
175   - mView,
176   - mToolBar,
177   - BACKGROUND_IMAGE,
178   - TOOLBAR_IMAGE,
179   - TOOLBAR_TITLE );
180   -
181   - Toolkit::TableView contentTable = Toolkit::TableView::New( 6, 1 );
182   - contentTable.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
183   - contentTable.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
184   - contentTable.SetAnchorPoint( AnchorPoint::TOP_LEFT );
185   - contentTable.SetParentOrigin( ParentOrigin::TOP_LEFT );
186   - contentTable.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE * 0.5f ) );
187   -
188   - for( unsigned int i = 0; i < contentTable.GetRows(); ++i )
189   - {
190   - contentTable.SetFitHeight( i );
191   - }
192   -
193   - contentTable.SetPosition( 0.0f, TOP_MARGIN );
194   -
195   - mContentLayer.Add( contentTable );
196   -
197   -
198   - // Logger selector radio group
199   - Toolkit::TableView radioGroupBackground = Toolkit::TableView::New( 2, 1 );
200   - radioGroupBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
201   - radioGroupBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
202   - radioGroupBackground.SetBackgroundColor( BACKGROUND_COLOUR );
203   - radioGroupBackground.SetParentOrigin( ParentOrigin::TOP_LEFT );
204   - radioGroupBackground.SetAnchorPoint( AnchorPoint::TOP_LEFT );
205   - radioGroupBackground.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE * 0.5f ) );
206   -
207   - contentTable.Add( radioGroupBackground );
208   -
209   - // Label
210   - {
211   - Toolkit::TextLabel label = Toolkit::TextLabel::New( LOGGER_TEXT );
212   - label.SetParentOrigin( ParentOrigin::TOP_LEFT );
213   - label.SetAnchorPoint( AnchorPoint::TOP_LEFT );
214   - label.SetPosition( DP(MARGIN_SIZE), DP(MARGIN_SIZE) );
215   - label.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
216   -
217   - radioGroupBackground.Add( label );
218   - radioGroupBackground.SetFitHeight( 0 );
219   - }
220   -
221   - // Radio group
222   - Toolkit::TableView radioButtonsGroup = Toolkit::TableView::New( 3, 1 );
223   - radioButtonsGroup.SetCellPadding( Size( 0.0f, MARGIN_SIZE * 0.5f ) );
224   - radioButtonsGroup.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
225   - for( unsigned int i = 0; i < radioButtonsGroup.GetRows(); ++i )
226   - {
227   - radioButtonsGroup.SetFitHeight( i );
228   - }
229   - radioButtonsGroup.SetFitWidth( 0 );
230   -
231   - radioGroupBackground.Add( radioButtonsGroup );
232   - radioGroupBackground.SetFitHeight( 1 );
233   -
234   - int radioX = 0;
235   - int radioY = 0;
236   -
237   - // Radio 1
238   - {
239   - Toolkit::RadioButton radioButton = Toolkit::RadioButton::New();
240   - radioButton.SetName( LOGGER_1_RADIO_ID );
241   - radioButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
242   - radioButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
243   - radioButton.SetPosition( DP(radioX), DP(radioY) );
244   - radioButton.SetProperty( Toolkit::Button::Property::SELECTED, true );
245   -
246   - radioButton.StateChangedSignal().Connect( this, &LoggingController::LoggingRadioSelect );
247   -
248   - radioButtonsGroup.Add( radioButton );
249   - mLogRadioButtons[0] = radioButton;
250   - }
251   -
252   - // Radio 2
253   - {
254   - radioY += LOGGER_RADIO_SPACING;
255   -
256   - Toolkit::RadioButton radioButton = Toolkit::RadioButton::New();
257   - radioButton.SetName( LOGGER_2_RADIO_ID );
258   - radioButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
259   - radioButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
260   - radioButton.SetPosition( DP(radioX), DP(radioY) );
261   -
262   - radioButton.StateChangedSignal().Connect( this, &LoggingController::LoggingRadioSelect );
263   -
264   - radioButtonsGroup.Add( radioButton );
265   - mLogRadioButtons[1] = radioButton;
266   - }
267   -
268   - // Radio 3
269   - {
270   - radioY += LOGGER_RADIO_SPACING;
271   -
272   - Toolkit::RadioButton radioButton = Toolkit::RadioButton::New();
273   - radioButton.SetName( LOGGER_3_RADIO_ID );
274   - radioButton.SetParentOrigin( ParentOrigin::TOP_LEFT );
275   - radioButton.SetAnchorPoint( AnchorPoint::TOP_LEFT );
276   - radioButton.SetPosition( DP(radioX), DP(radioY) );
277   -
278   - radioButton.StateChangedSignal().Connect( this, &LoggingController::LoggingRadioSelect );
279   -
280   - radioButtonsGroup.Add( radioButton );
281   - mLogRadioButtons[2] = radioButton;
282   - }
283   -
284   - // Create/delete/disable group
285   - Toolkit::TableView createGroupBackground = Toolkit::TableView::New( 1, 2 );
286   - createGroupBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
287   - createGroupBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
288   - createGroupBackground.SetBackgroundColor( BACKGROUND_COLOUR );
289   - createGroupBackground.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) );
290   - createGroupBackground.SetFitHeight( 0 );
291   -
292   - contentTable.Add( createGroupBackground );
293   -
294   - {
295   - Toolkit::PushButton button = Toolkit::PushButton::New();
296   - button.SetName( CREATE_BUTTON_ID );
297   - button.SetProperty( Toolkit::Button::Property::LABEL, CREATE_BUTTON_TEXT);
298   - button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
299   - button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
300   - button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked );
301   -
302   - createGroupBackground.Add( button );
303   - }
304   -
305   - {
306   - Toolkit::PushButton button = Toolkit::PushButton::New();
307   - button.SetName( DELETE_BUTTON_ID );
308   - button.SetProperty( Toolkit::Button::Property::LABEL, DELETE_BUTTON_TEXT);
309   - button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
310   - button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
311   - button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked );
312   -
313   - createGroupBackground.Add( button );
314   - }
315   -
316   - // Start/stop group
317   -
318   - Toolkit::TableView timingGroupBackground = Toolkit::TableView::New( 1, 2 );
319   - timingGroupBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
320   - timingGroupBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
321   - timingGroupBackground.SetBackgroundColor( BACKGROUND_COLOUR );
322   - timingGroupBackground.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) );
323   - timingGroupBackground.SetFitHeight( 0 );
324   -
325   - contentTable.Add( timingGroupBackground );
326   -
327   - {
328   - Toolkit::PushButton button = Toolkit::PushButton::New();
329   - button.SetName( START_BUTTON_ID );
330   - button.SetProperty( Toolkit::Button::Property::LABEL, START_BUTTON_TEXT);
331   - button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
332   - button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
333   - button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked );
334   -
335   - timingGroupBackground.Add( button );
336   - }
337   -
338   - {
339   - Toolkit::PushButton button = Toolkit::PushButton::New();
340   - button.SetName( STOP_BUTTON_ID );
341   - button.SetProperty( Toolkit::Button::Property::LABEL, STOP_BUTTON_TEXT);
342   - button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
343   - button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
344   - button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked );
345   -
346   - timingGroupBackground.Add( button );
347   - }
348   -
349   - // Enable/disable group
350   - Toolkit::TableView enableGroupBackground = Toolkit::TableView::New( 1, 2 );
351   - enableGroupBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
352   - enableGroupBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
353   - enableGroupBackground.SetBackgroundColor( BACKGROUND_COLOUR );
354   - enableGroupBackground.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) );
355   - enableGroupBackground.SetFitHeight( 0 );
356   -
357   - contentTable.Add( enableGroupBackground );
358   -
359   - {
360   - Toolkit::PushButton button = Toolkit::PushButton::New();
361   - button.SetName( ENABLE_BUTTON_ID );
362   - button.SetProperty( Toolkit::Button::Property::LABEL, ENABLE_BUTTON_TEXT);
363   - button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
364   - button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
365   - button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked );
366   -
367   - enableGroupBackground.Add( button );
368   - }
369   -
370   - {
371   - Toolkit::PushButton button = Toolkit::PushButton::New();
372   - button.SetName( DISABLE_BUTTON_ID );
373   - button.SetProperty( Toolkit::Button::Property::LABEL, DISABLE_BUTTON_TEXT);
374   - button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
375   - button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
376   - button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked );
377   -
378   - enableGroupBackground.Add( button );
379   - }
380   -
381   - // Logger selector radio group
382   - Toolkit::TableView frequencyRadioGroupBackground = Toolkit::TableView::New( 2, 1 );
383   - frequencyRadioGroupBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
384   - frequencyRadioGroupBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
385   - frequencyRadioGroupBackground.SetBackgroundColor( BACKGROUND_COLOUR );
386   - frequencyRadioGroupBackground.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE * 0.5f ) );
387   - frequencyRadioGroupBackground.SetFitHeight( 0 );
388   - frequencyRadioGroupBackground.SetFitHeight( 1 );
389   -
390   - contentTable.Add( frequencyRadioGroupBackground );
391   -
392   - // Label
393   - {
394   - Toolkit::TextLabel label = Toolkit::TextLabel::New( FREQUENCY_TEXT );
395   -
396   - frequencyRadioGroupBackground.Add( label );
397   - }
398   -
399   - // Radio group
400   - Toolkit::TableView frequencyRadioButtonsGroup = Toolkit::TableView::New( 1, 3 );
401   - frequencyRadioButtonsGroup.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
402   - frequencyRadioButtonsGroup.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
403   - frequencyRadioButtonsGroup.SetFitHeight( 0 );
404   - frequencyRadioButtonsGroup.SetPadding( Padding( 0.0f, 0.0f, MARGIN_SIZE, 0.0f ) );
405   -
406   - frequencyRadioGroupBackground.Add( frequencyRadioButtonsGroup );
407   -
408   - // Radio 1
409   - {
410   - Toolkit::RadioButton radioButton = Toolkit::RadioButton::New( FREQUENCY_1_RADIO_TEXT );
411   - radioButton.SetName( FREQUENCY_1_RADIO_ID );
412   -
413   - radioButton.StateChangedSignal().Connect( this, &LoggingController::FrequencyRadioSelect );
414   -
415   - frequencyRadioButtonsGroup.Add( radioButton );
416   - mFrequencyRadioButtons[0] = radioButton;
417   - }
418   -
419   - // Radio 2
420   - {
421   - Toolkit::RadioButton radioButton = Toolkit::RadioButton::New( FREQUENCY_2_RADIO_TEXT );
422   - radioButton.SetName( FREQUENCY_2_RADIO_ID );
423   -
424   - radioButton.SetProperty( Toolkit::Button::Property::SELECTED, true );
425   -
426   - radioButton.StateChangedSignal().Connect( this, &LoggingController::FrequencyRadioSelect );
427   -
428   - frequencyRadioButtonsGroup.Add( radioButton );
429   - mFrequencyRadioButtons[1] = radioButton;
430   - }
431   -
432   - // Radio 3
433   - {
434   - Toolkit::RadioButton radioButton = Toolkit::RadioButton::New( FREQUENCY_3_RADIO_TEXT );
435   - radioButton.SetName( FREQUENCY_3_RADIO_ID );
436   -
437   - radioButton.StateChangedSignal().Connect( this, &LoggingController::FrequencyRadioSelect );
438   -
439   - frequencyRadioButtonsGroup.Add( radioButton );
440   - mFrequencyRadioButtons[2] = radioButton;
441   - }
442   -
443   - // Vsync group
444   - Toolkit::TableView vsyncGroupBackground = Toolkit::TableView::New( 1, 1 );
445   - vsyncGroupBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
446   - vsyncGroupBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
447   - vsyncGroupBackground.SetBackgroundColor( BACKGROUND_COLOUR );
448   - vsyncGroupBackground.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) );
449   - vsyncGroupBackground.SetFitHeight( 0 );
450   -
451   - contentTable.Add( vsyncGroupBackground );
452   -
453   - {
454   - Toolkit::PushButton button = Toolkit::PushButton::New();
455   - button.SetName( VSYNC_BUTTON_ID );
456   - button.SetProperty( Toolkit::Button::Property::LABEL, VSYNC_BUTTON_TEXT);
457   - button.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
458   - button.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
459   - button.ClickedSignal().Connect( this, &LoggingController::OnButtonClicked );
460   -
461   - vsyncGroupBackground.Add( button );
462   - }
463   -
464   - WriteConsole();
465   - }
466   -
467   - void WriteConsole()
468   - {
469   - for( unsigned int i = 0; i < NUM_LOGGERS; ++i)
470   - {
471   - std::stringstream ss;
472   - ss << (i + 1) << ") " << ((mPerformanceLoggers[i]) ? "Created" : "Deleted")
473   - << ", " << ((mLoggerStates[i].isTiming) ? "Started" : "Stopped")
474   - << ", " << ((mLoggerStates[i].isEnabled) ? "Enabled" : "Disabled");
475   -
476   - mLogRadioButtons[i].SetProperty( Toolkit::Button::Property::LABEL, ss.str() );
477   - }
478   - }
479   -
480   - bool LoggingRadioSelect( Toolkit::Button button )
481   - {
482   - bool isSelected = button.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>();
483   - if( !isSelected )
484   - {
485   - return true;
486   - }
487   -
488   - if( button.GetName() == LOGGER_1_RADIO_ID )
489   - {
490   - mCurrentLogger = 0;
491   - }
492   - else if( button.GetName() == LOGGER_2_RADIO_ID )
493   - {
494   - mCurrentLogger = 1;
495   - }
496   - else if( button.GetName() == LOGGER_3_RADIO_ID )
497   - {
498   - mCurrentLogger = 2;
499   - }
500   -
501   - UpdateState();
502   -
503   - return true;
504   - }
505   -
506   - void UpdateState()
507   - {
508   - DALI_ASSERT_DEBUG( mCurrentLogger < mLoggerStates.size() );
509   - const unsigned int frequency = mLoggerStates[mCurrentLogger].frequency;
510   - if( frequency == HIGH_FREQUENCY )
511   - {
512   - mFrequencyRadioButtons[0].SetProperty( Toolkit::Button::Property::SELECTED, true );
513   - }
514   - else if( frequency == MEDIUM_FREQUENCY )
515   - {
516   - mFrequencyRadioButtons[1].SetProperty( Toolkit::Button::Property::SELECTED, true );
517   - }
518   - else if( frequency == LOW_FREQUENCY )
519   - {
520   - mFrequencyRadioButtons[2].SetProperty( Toolkit::Button::Property::SELECTED, true );
521   - }
522   - }
523   -
524   - bool FrequencyRadioSelect( Toolkit::Button button )
525   - {
526   - bool isSelected = button.GetProperty( Toolkit::Button::Property::SELECTED ).Get<bool>();
527   - if( !isSelected )
528   - {
529   - return true;
530   - }
531   -
532   - if( button.GetName() == FREQUENCY_1_RADIO_ID )
533   - {
534   - if( mPerformanceLoggers[mCurrentLogger] )
535   - {
536   - DALI_ASSERT_DEBUG( mCurrentLogger < mPerformanceLoggers.size() );
537   - mPerformanceLoggers[mCurrentLogger].SetLoggingFrequency( HIGH_FREQUENCY );
538   -
539   - DALI_ASSERT_DEBUG( mCurrentLogger < mLoggerStates.size() );
540   - mLoggerStates[mCurrentLogger].frequency = HIGH_FREQUENCY;
541   - }
542   - }
543   - else if( button.GetName() == FREQUENCY_2_RADIO_ID )
544   - {
545   - if( mPerformanceLoggers[mCurrentLogger] )
546   - {
547   - DALI_ASSERT_DEBUG( mCurrentLogger < mPerformanceLoggers.size() );
548   - mPerformanceLoggers[mCurrentLogger].SetLoggingFrequency( MEDIUM_FREQUENCY );
549   -
550   - DALI_ASSERT_DEBUG( mCurrentLogger < mLoggerStates.size() );
551   - mLoggerStates[mCurrentLogger].frequency = MEDIUM_FREQUENCY;
552   - }
553   - }
554   - else if( button.GetName() == FREQUENCY_3_RADIO_ID )
555   - {
556   - if( mPerformanceLoggers[mCurrentLogger] )
557   - {
558   - DALI_ASSERT_DEBUG( mCurrentLogger < mPerformanceLoggers.size() );
559   - mPerformanceLoggers[mCurrentLogger].SetLoggingFrequency( LOW_FREQUENCY );
560   -
561   - DALI_ASSERT_DEBUG( mCurrentLogger < mLoggerStates.size() );
562   - mLoggerStates[mCurrentLogger].frequency = LOW_FREQUENCY;
563   - }
564   - }
565   -
566   - return true;
567   - }
568   -
569   - void OnKeyEvent( const KeyEvent& event )
570   - {
571   - if( event.state == KeyEvent::Down )
572   - {
573   - if( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) )
574   - {
575   - // Exit application when click back or escape.
576   - mApplication.Quit();
577   - }
578   - }
579   - }
580   -
581   - bool OnButtonClicked(Toolkit::Button button)
582   - {
583   - if( button.GetName() == CREATE_BUTTON_ID )
584   - {
585   - std::stringstream ss;
586   - ss << "Test logger " << (mCurrentLogger + 1);
587   -
588   - DALI_ASSERT_DEBUG( mCurrentLogger < mPerformanceLoggerNames.size() );
589   - mPerformanceLoggerNames[mCurrentLogger] = ss.str();
590   -
591   - DALI_ASSERT_DEBUG( mCurrentLogger < mPerformanceLoggers.size() );
592   - mPerformanceLoggers[mCurrentLogger] = Dali::PerformanceLogger::New( mPerformanceLoggerNames[mCurrentLogger].c_str() );
593   -
594   - DALI_ASSERT_DEBUG( mCurrentLogger < mLoggerStates.size() );
595   - mLoggerStates[mCurrentLogger].isTiming = false;
596   - mLoggerStates[mCurrentLogger].isEnabled = true;
597   - mLoggerStates[mCurrentLogger].frequency = MEDIUM_FREQUENCY;
598   -
599   - UpdateState();
600   - }
601   - else if ( button.GetName() == DELETE_BUTTON_ID )
602   - {
603   - DALI_ASSERT_DEBUG( mCurrentLogger < mPerformanceLoggers.size() );
604   - mPerformanceLoggers[mCurrentLogger].Reset();
605   -
606   - DALI_ASSERT_DEBUG( mCurrentLogger < mLoggerStates.size() );
607   - mLoggerStates[mCurrentLogger].isTiming = false;
608   - mLoggerStates[mCurrentLogger].isEnabled = true;
609   - mLoggerStates[mCurrentLogger].frequency = MEDIUM_FREQUENCY;
610   -
611   - UpdateState();
612   - }
613   - else if ( button.GetName() == START_BUTTON_ID )
614   - {
615   - if( mPerformanceLoggers[mCurrentLogger] )
616   - {
617   - DALI_ASSERT_DEBUG( mCurrentLogger < mPerformanceLoggers.size() );
618   - mPerformanceLoggers[mCurrentLogger].AddMarker( Dali::PerformanceLogger::START_EVENT );
619   -
620   - DALI_ASSERT_DEBUG( mCurrentLogger < mLoggerStates.size() );
621   - mLoggerStates[mCurrentLogger].isTiming = true;
622   - }
623   - }
624   - else if ( button.GetName() == STOP_BUTTON_ID )
625   - {
626   - if( mPerformanceLoggers[mCurrentLogger] )
627   - {
628   - DALI_ASSERT_DEBUG( mCurrentLogger < mPerformanceLoggers.size() );
629   - mPerformanceLoggers[mCurrentLogger].AddMarker( Dali::PerformanceLogger::END_EVENT );
630   -
631   - DALI_ASSERT_DEBUG( mCurrentLogger < mLoggerStates.size() );
632   - mLoggerStates[mCurrentLogger].isTiming = false;
633   - }
634   - }
635   - else if ( button.GetName() == ENABLE_BUTTON_ID )
636   - {
637   - if( mPerformanceLoggers[mCurrentLogger] )
638   - {
639   - DALI_ASSERT_DEBUG( mCurrentLogger < mPerformanceLoggers.size() );
640   - mPerformanceLoggers[mCurrentLogger].EnableLogging( true );
641   -
642   - DALI_ASSERT_DEBUG( mCurrentLogger < mLoggerStates.size() );
643   - mLoggerStates[mCurrentLogger].isEnabled = true;
644   - }
645   - }
646   - else if ( button.GetName() == DISABLE_BUTTON_ID )
647   - {
648   - if( mPerformanceLoggers[mCurrentLogger] )
649   - {
650   - DALI_ASSERT_DEBUG( mCurrentLogger < mPerformanceLoggers.size() );
651   - mPerformanceLoggers[mCurrentLogger].EnableLogging( false );
652   -
653   - DALI_ASSERT_DEBUG( mCurrentLogger < mLoggerStates.size() );
654   - mLoggerStates[mCurrentLogger].isEnabled = false;
655   - }
656   - }
657   -
658   - WriteConsole();
659   -
660   - return true;
661   - }
662   -
663   -private:
664   -
665   - struct LoggerState
666   - {
667   - LoggerState() : frequency( 0 ), isTiming( false ), isEnabled( true ) {}
668   -
669   - unsigned int frequency;
670   - bool isTiming;
671   - bool isEnabled;
672   - };
673   -
674   - Application& mApplication;
675   - Toolkit::Control mView; ///< The View instance.
676   - Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
677   - Layer mContentLayer; ///< Content layer
678   -
679   - Animation mAnimation;
680   -
681   - typedef std::vector< std::string > Strings;
682   - Strings mPerformanceLoggerNames;
683   -
684   - typedef std::vector< Dali::PerformanceLogger > PerformanceLoggers;
685   - PerformanceLoggers mPerformanceLoggers;
686   - unsigned int mCurrentLogger;
687   -
688   - typedef std::vector< LoggerState > LoggerStates;
689   - LoggerStates mLoggerStates;
690   -
691   - typedef std::vector< Toolkit::RadioButton > RadioButtons;
692   - RadioButtons mLogRadioButtons;
693   - RadioButtons mFrequencyRadioButtons;
694   -};
695   -
696   -void RunTest( Application& application )
697   -{
698   - LoggingController test( application );
699   -
700   - application.MainLoop();
701   -}
702   -
703   -// Entry point for Linux & Tizen applications
704   -//
705   -int DALI_EXPORT_API main( int argc, char **argv )
706   -{
707   - Application application = Application::New( &argc, &argv, DEMO_THEME_PATH );
708   -
709   - RunTest( application );
710   -
711   - return 0;
712   -}
examples/mesh-sorting/mesh-sorting-example.cpp deleted
1   -/*
2   - * Copyright (c) 2017 Samsung Electronics Co., Ltd.
3   - *
4   - * Licensed under the Apache License, Version 2.0 (the "License");
5   - * you may not use this file except in compliance with the License.
6   - * You may obtain a copy of the License at
7   - *
8   - * http://www.apache.org/licenses/LICENSE-2.0
9   - *
10   - * Unless required by applicable law or agreed to in writing, software
11   - * distributed under the License is distributed on an "AS IS" BASIS,
12   - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   - * See the License for the specific language governing permissions and
14   - * limitations under the License.
15   - *
16   - */
17   -
18   -// EXTERNAL INCLUDES
19   -#include <dali-toolkit/dali-toolkit.h>
20   -#include <stdio.h>
21   -#include <sstream>
22   -#include <cstring>
23   -
24   -// INTERNAL INCLUDES
25   -#include "shared/view.h"
26   -#include "shared/utility.h"
27   -
28   -using namespace Dali;
29   -
30   -namespace
31   -{
32   -
33   -const char* IMAGES[] =
34   -{
35   - DEMO_IMAGE_DIR "people-medium-1.jpg",
36   - DEMO_IMAGE_DIR "people-medium-4.jpg",
37   - DEMO_IMAGE_DIR "people-medium-11.jpg",
38   - DEMO_IMAGE_DIR "people-small-16.jpg",
39   - DEMO_IMAGE_DIR "people-medium-15.jpg",
40   - DEMO_IMAGE_DIR "people-medium-6.jpg",
41   -};
42   -const unsigned int NUMBER_OF_SAMPLES(sizeof(IMAGES)/sizeof(const char*));
43   -
44   -
45   -#define MAKE_SHADER(A)#A
46   -
47   -const char* VERTEX_SHADER = MAKE_SHADER(
48   -uniform highp float uHue;
49   -attribute mediump vec2 aPosition;
50   -attribute highp vec2 aTexCoord;
51   -varying mediump vec2 vTexCoord;
52   -uniform mediump mat4 uMvpMatrix;
53   -uniform mediump vec3 uSize;
54   -varying mediump vec3 vGlobColor;
55   -
56   -vec3 hsv2rgb(vec3 c)
57   -{
58   - vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
59   - vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
60   - return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
61   -}
62   -
63   -void main()
64   -{
65   - mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);
66   - vertexPosition.xyz *= uSize;
67   - vertexPosition = uMvpMatrix * vertexPosition;
68   - vGlobColor = hsv2rgb( vec3( clamp(uHue, 0.0, 1.0), 1.0, 1.0 ) );
69   -
70   - vTexCoord = aTexCoord;
71   - gl_Position = vertexPosition;
72   -}
73   -);
74   -
75   -const char* FRAGMENT_SHADER = MAKE_SHADER(
76   -varying mediump vec2 vTexCoord;
77   -varying mediump vec3 vGlobColor;
78   -uniform lowp vec4 uColor;
79   -uniform sampler2D sTexture;
80   -
81   -void main()
82   -{
83   - gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor * vec4(vGlobColor, 1.0) ;
84   -}
85   -);
86   -
87   -} // anonymous namespace
88   -
89   -// This example shows how to use a simple mesh
90   -//
91   -class ExampleController : public ConnectionTracker
92   -{
93   -public:
94   -
95   - /**
96   - * The example controller constructor.
97   - * @param[in] application The application instance
98   - */
99   - ExampleController( Application& application )
100   - : mApplication( application ),
101   - mZMode(0)
102   - {
103   - // Connect to the Application's Init signal
104   - mApplication.InitSignal().Connect( this, &ExampleController::Create );
105   - memset(mDepthIndices, 0, sizeof(mDepthIndices));
106   - }
107   -
108   - /**
109   - * The example controller destructor
110   - */
111   - ~ExampleController()
112   - {
113   - // Nothing to do here;
114   - }
115   -
116   - /**
117   - * Invoked upon creation of application
118   - * @param[in] application The application instance
119   - */
120   - void Create( Application& application )
121   - {
122   - Stage stage = Stage::GetCurrent();
123   - stage.KeyEventSignal().Connect(this, &ExampleController::OnKeyEvent);
124   -
125   - mStageSize = stage.GetSize();
126   -
127   - // The Init signal is received once (only) during the Application lifetime
128   -
129   - // Hide the indicator bar
130   - application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE );
131   -
132   - mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER );
133   - mGeometry = DemoHelper::CreateTexturedQuad();
134   -
135   - TextureSet firstTextureSet;
136   -
137   - for( unsigned i=0; i<NUMBER_OF_SAMPLES; ++i)
138   - {
139   - Texture texture = DemoHelper::LoadTexture( IMAGES[i] );
140   - TextureSet textureSet = TextureSet::New();
141   - textureSet.SetTexture( 0u, texture );
142   - if( i==0 ) { firstTextureSet = textureSet; }
143   -
144   - Renderer renderer = Renderer::New( mGeometry, mShader );
145   - renderer.SetTextures( textureSet );
146   - Actor meshActor = Actor::New();
147   - mActors[i] = meshActor;
148   - meshActor.AddRenderer( renderer );
149   - meshActor.SetSize(175, 175);
150   - meshActor.RegisterProperty("index", (int)i);
151   -
152   - renderer.SetProperty( Renderer::Property::DEPTH_INDEX, 0 );
153   - // Test with actor alpha
154   - meshActor.SetParentOrigin( ParentOrigin::CENTER );
155   - meshActor.SetAnchorPoint( AnchorPoint::CENTER );
156   - meshActor.SetPosition( 40.0f*(i-(NUMBER_OF_SAMPLES*0.5f)), 40.0f*(i-(NUMBER_OF_SAMPLES*0.5f)), i*10 );
157   -
158   - meshActor.SetOpacity( i%2?0.7f:1.0f );
159   -
160   - meshActor.RegisterProperty("uHue", i/(float)NUMBER_OF_SAMPLES);
161   -
162   - meshActor.TouchSignal().Connect(this, &ExampleController::OnTouched);
163   - std::ostringstream oss;
164   - oss << "Mesh Actor " << i;
165   - meshActor.SetName(oss.str());
166   - stage.Add( meshActor );
167   - }
168   -
169   - mActors[NUMBER_OF_SAMPLES-2].GetRendererAt(0).SetTextures( firstTextureSet );
170   -
171   - stage.GetRootLayer().TouchSignal().Connect(this, &ExampleController::OnStageTouched);
172   - }
173   -
174   - void PrintDepths()
175   - {
176   - switch( mZMode )
177   - {
178   - case 0:
179   - {
180   - printf("Children Z ordered back to front\n");
181   - break;
182   - }
183   - case 1:
184   - {
185   - printf("All children set to same Z=0\n");
186   - break;
187   - }
188   - case 2:
189   - {
190   - printf("Children Z ordered front to back\n");
191   - break;
192   - }
193   - }
194   -
195   - for( unsigned i=0; i<NUMBER_OF_SAMPLES; ++i)
196   - {
197   - printf("DepthIndex[%d]=%d\n", i, mDepthIndices[i]);
198   - }
199   - printf("\n");
200   - }
201   -
202   - bool OnTouched( Actor actor, const TouchData& event )
203   - {
204   - if( event.GetState( 0 ) == PointState::UP )
205   - {
206   - int index = actor.GetProperty<int>(actor.GetPropertyIndex("index"));
207   -
208   - int newDepthIndex = (mDepthIndices[index] + 10) % 30;
209   - mDepthIndices[index] = newDepthIndex;
210   -
211   - Renderer renderer = actor.GetRendererAt(0);
212   - renderer.SetProperty( Renderer::Property::DEPTH_INDEX, newDepthIndex);
213   -
214   - PrintDepths();
215   - }
216   - return true;
217   - }
218   -
219   - bool OnStageTouched( Actor rootLayer, const TouchData& event )
220   - {
221   - if( event.GetState( 0 ) == PointState::UP )
222   - {
223   - switch( mZMode )
224   - {
225   - case 0:
226   - {
227   - mZMode = 1;
228   - for(unsigned int i=1; i < rootLayer.GetChildCount(); ++i)
229   - {
230   - Actor child = rootLayer.GetChildAt(i);
231   - child.SetZ( 0.0f );
232   - }
233   - PrintDepths();
234   - break;
235   - }
236   - case 1:
237   - {
238   - mZMode = 2;
239   - for(unsigned int i=1; i < rootLayer.GetChildCount(); ++i)
240   - {
241   - Actor child = rootLayer.GetChildAt(i);
242   - child.SetZ( 100-i*10 );
243   - }
244   - PrintDepths();
245   - break;
246   - }
247   - case 2:
248   - {
249   - mZMode = 0;
250   - for(unsigned int i=1; i < rootLayer.GetChildCount(); ++i)
251   - {
252   - Actor child = rootLayer.GetChildAt(i);
253   - child.SetZ( i*10 );
254   - }
255   - PrintDepths();
256   - break;
257   - }
258   - }
259   - }
260   - return true;
261   - }
262   -
263   - /**
264   - * Invoked whenever the quit button is clicked
265   - * @param[in] button the quit button
266   - */
267   - bool OnQuitButtonClicked( Toolkit::Button button )
268   - {
269   - // quit the application
270   - mApplication.Quit();
271   - return true;
272   - }
273   -
274   - void OnKeyEvent(const KeyEvent& event)
275   - {
276   - if(event.state == KeyEvent::Down)
277   - {
278   - if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) )
279   - {
280   - mApplication.Quit();
281   - }
282   - }
283   - }
284   -
285   -private:
286   -
287   - Application& mApplication; ///< Application instance
288   - Vector3 mStageSize; ///< The size of the stage
289   -
290   - Shader mShader;
291   - Geometry mGeometry;
292   -
293   - int mDepthIndices[NUMBER_OF_SAMPLES];
294   - Actor mActors[NUMBER_OF_SAMPLES];
295   - int mZMode;
296   -};
297   -
298   -void RunTest( Application& application )
299   -{
300   - ExampleController test( application );
301   -
302   - application.MainLoop();
303   -}
304   -
305   -// Entry point for Linux & SLP applications
306   -//
307   -int DALI_EXPORT_API main( int argc, char **argv )
308   -{
309   - Application application = Application::New( &argc, &argv );
310   -
311   - RunTest( application );
312   -
313   - return 0;
314   -}
examples/rendering-radial-progress/radial-progress.cpp
... ... @@ -127,6 +127,9 @@ public:
127 127 Stage stage = Stage::GetCurrent();
128 128 stage.SetBackgroundColor( Color::BLACK );
129 129  
  130 + // Connect to the stage's key signal to allow Back and Escape to exit.
  131 + stage.KeyEventSignal().Connect( this, &RadialProgressController::OnKeyEvent );
  132 +
130 133 // 1. Create actor to show the effect
131 134 mActor = Actor::New();
132 135 mActor.SetAnchorPoint( AnchorPoint::CENTER );
... ... @@ -283,6 +286,23 @@ public:
283 286 return renderer;
284 287 }
285 288  
  289 + /**
  290 + * @brief Called when any key event is received
  291 + *
  292 + * Will use this to quit the application if Back or the Escape key is received
  293 + * @param[in] event The key event information
  294 + */
  295 + void OnKeyEvent( const KeyEvent& event )
  296 + {
  297 + if( event.state == KeyEvent::Down )
  298 + {
  299 + if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) )
  300 + {
  301 + mApplication.Quit();
  302 + }
  303 + }
  304 + }
  305 +
286 306 private:
287 307  
288 308 Application& mApplication;
... ... @@ -290,20 +310,11 @@ private:
290 310 Actor mActor;
291 311 };
292 312  
293   -void RunTest( Application& application )
294   -{
295   - RadialProgressController test( application );
296   -
297   - application.MainLoop();
298   -}
299   -
300 313 // Entry point for Linux & Tizen applications
301   -//
302 314 int DALI_EXPORT_API main( int argc, char **argv )
303 315 {
304 316 Application application = Application::New( &argc, &argv );
305   -
306   - RunTest( application );
307   -
  317 + RadialProgressController test( application );
  318 + application.MainLoop();
308 319 return 0;
309 320 }
... ...
resources/po/as.po
... ... @@ -67,18 +67,12 @@ msgstr &quot;ছাঁয়া&quot;
67 67 msgid "DALI_DEMO_STR_TITLE_LINE_MESH"
68 68 msgstr "অঁকোৱা-পকোৱা"
69 69  
70   -msgid "DALI_DEMO_STR_TITLE_LOGGING"
71   -msgstr "Logging"
72   -
73 70 msgid "DALI_DEMO_STR_TITLE_MAGNIFIER"
74 71 msgstr "পৰিবৰ্দ্ধক"
75 72  
76 73 msgid "DALI_DEMO_STR_TITLE_MESH_MORPH"
77 74 msgstr "মেশ অঙ্কুৰিত"
78 75  
79   -msgid "DALI_DEMO_STR_TITLE_MESH_SORTING"
80   -msgstr "মেশ অসংযোগ"
81   -
82 76 msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL"
83 77 msgstr "3D অনুগামী"
84 78  
... ...
resources/po/de.po
... ... @@ -67,18 +67,12 @@ msgstr &quot;Licht und Schatten&quot;
67 67 msgid "DALI_DEMO_STR_TITLE_LINE_MESH"
68 68 msgstr "Linien"
69 69  
70   -msgid "DALI_DEMO_STR_TITLE_LOGGING"
71   -msgstr "Logging"
72   -
73 70 msgid "DALI_DEMO_STR_TITLE_MAGNIFIER"
74 71 msgstr "Bildschirmlupe"
75 72  
76 73 msgid "DALI_DEMO_STR_TITLE_MESH_MORPH"
77 74 msgstr "Mesh Veränderung"
78 75  
79   -msgid "DALI_DEMO_STR_TITLE_MESH_SORTING"
80   -msgstr "Mesh Sortierung"
81   -
82 76 msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL"
83 77 msgstr "3D-Modelle"
84 78  
... ...
resources/po/en_GB.po
... ... @@ -73,18 +73,12 @@ msgstr &quot;Lights and Shadows&quot;
73 73 msgid "DALI_DEMO_STR_TITLE_LINE_MESH"
74 74 msgstr "Mesh Line"
75 75  
76   -msgid "DALI_DEMO_STR_TITLE_LOGGING"
77   -msgstr "Logging"
78   -
79 76 msgid "DALI_DEMO_STR_TITLE_MAGNIFIER"
80 77 msgstr "Magnifier"
81 78  
82 79 msgid "DALI_DEMO_STR_TITLE_MESH_MORPH"
83 80 msgstr "Mesh Morph"
84 81  
85   -msgid "DALI_DEMO_STR_TITLE_MESH_SORTING"
86   -msgstr "Mesh Sorting"
87   -
88 82 msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL"
89 83 msgstr "Mesh Visual"
90 84  
... ...
resources/po/en_US.po
... ... @@ -76,18 +76,12 @@ msgstr &quot;Lights and Shadows&quot;
76 76 msgid "DALI_DEMO_STR_TITLE_LINE_MESH"
77 77 msgstr "Mesh Line"
78 78  
79   -msgid "DALI_DEMO_STR_TITLE_LOGGING"
80   -msgstr "Logging"
81   -
82 79 msgid "DALI_DEMO_STR_TITLE_MAGNIFIER"
83 80 msgstr "Magnifier"
84 81  
85 82 msgid "DALI_DEMO_STR_TITLE_MESH_MORPH"
86 83 msgstr "Mesh Morph"
87 84  
88   -msgid "DALI_DEMO_STR_TITLE_MESH_SORTING"
89   -msgstr "Mesh Sorting"
90   -
91 85 msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL"
92 86 msgstr "Mesh Visual"
93 87  
... ...
resources/po/es.po
... ... @@ -67,18 +67,12 @@ msgstr &quot;Luces y sombras&quot;
67 67 msgid "DALI_DEMO_STR_TITLE_LINE_MESH"
68 68 msgstr "Lineas"
69 69  
70   -msgid "DALI_DEMO_STR_TITLE_LOGGING"
71   -msgstr "Control de entrada"
72   -
73 70 msgid "DALI_DEMO_STR_TITLE_MAGNIFIER"
74 71 msgstr "Lupa"
75 72  
76 73 msgid "DALI_DEMO_STR_TITLE_MESH_MORPH"
77 74 msgstr "Transformacion de geometrias"
78 75  
79   -msgid "DALI_DEMO_STR_TITLE_MESH_SORTING"
80   -msgstr "Ordenacion de geometrias"
81   -
82 76 msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL"
83 77 msgstr "Gemeotria 3D"
84 78  
... ...
resources/po/fi.po
... ... @@ -67,18 +67,12 @@ msgstr &quot;Valot ja Varjot&quot;
67 67 msgid "DALI_DEMO_STR_TITLE_LINE_MESH"
68 68 msgstr "Viivapolygoniverkko"
69 69  
70   -msgid "DALI_DEMO_STR_TITLE_LOGGING"
71   -msgstr "Loggaus"
72   -
73 70 msgid "DALI_DEMO_STR_TITLE_MAGNIFIER"
74 71 msgstr "Suurennuslasi"
75 72  
76 73 msgid "DALI_DEMO_STR_TITLE_MESH_MORPH"
77 74 msgstr "Polygoniverkon Muodonmuutos"
78 75  
79   -msgid "DALI_DEMO_STR_TITLE_MESH_SORTING"
80   -msgstr "Polygoniverkon Lajittelu"
81   -
82 76 msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL"
83 77 msgstr "Polygoniverkkovisuaali"
84 78  
... ...
resources/po/ko.po
... ... @@ -70,18 +70,12 @@ msgstr &quot;빛과 그림자&quot;
70 70 msgid "DALI_DEMO_STR_TITLE_LINE_MESH"
71 71 msgstr "라인 메쉬"
72 72  
73   -msgid "DALI_DEMO_STR_TITLE_LOGGING"
74   -msgstr "로깅"
75   -
76 73 msgid "DALI_DEMO_STR_TITLE_MAGNIFIER"
77 74 msgstr "돋보기"
78 75  
79 76 msgid "DALI_DEMO_STR_TITLE_MESH_MORPH"
80 77 msgstr "메쉬 형태"
81 78  
82   -msgid "DALI_DEMO_STR_TITLE_MESH_SORTING"
83   -msgstr "메쉬 분류"
84   -
85 79 msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL"
86 80 msgstr "메쉬 비주얼"
87 81  
... ...
resources/po/ml.po
... ... @@ -67,18 +67,12 @@ msgstr &quot;നിഴല്&quot;
67 67 msgid "DALI_DEMO_STR_TITLE_LINE_MESH"
68 68 msgstr "വര"
69 69  
70   -msgid "DALI_DEMO_STR_TITLE_LOGGING"
71   -msgstr "ലോഗിംഗ്"
72   -
73 70 msgid "DALI_DEMO_STR_TITLE_MAGNIFIER"
74 71 msgstr "ഭൂതക്കണ്ണാടി"
75 72  
76 73 msgid "DALI_DEMO_STR_TITLE_MESH_MORPH"
77 74 msgstr "മോർഫ് mesh"
78 75  
79   -msgid "DALI_DEMO_STR_TITLE_MESH_SORTING"
80   -msgstr "തരംതിരിക്കലിനായി mesh"
81   -
82 76 msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL"
83 77 msgstr "3D മോഡലിങ്"
84 78  
... ...
resources/po/ur.po
... ... @@ -67,18 +67,12 @@ msgstr &quot;روشنی اور سائے&quot;
67 67 msgid "DALI_DEMO_STR_TITLE_LINE_MESH"
68 68 msgstr "لکیریں"
69 69  
70   -msgid "DALI_DEMO_STR_TITLE_LOGGING"
71   -msgstr "لاگنگ"
72   -
73 70 msgid "DALI_DEMO_STR_TITLE_MAGNIFIER"
74 71 msgstr "مکبر"
75 72  
76 73 msgid "DALI_DEMO_STR_TITLE_MESH_MORPH"
77 74 msgstr "میش کی تبدیلی"
78 75  
79   -msgid "DALI_DEMO_STR_TITLE_MESH_SORTING"
80   -msgstr "میش کی چھنٹائی"
81   -
82 76 msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL"
83 77 msgstr "3D میش"
84 78  
... ...
resources/po/zn_CH.po
... ... @@ -67,18 +67,12 @@ msgstr &quot;阴影&quot;
67 67 msgid "DALI_DEMO_STR_TITLE_LINE_MESH"
68 68 msgstr "线条"
69 69  
70   -msgid "DALI_DEMO_STR_TITLE_LOGGING"
71   -msgstr "记录"
72   -
73 70 msgid "DALI_DEMO_STR_TITLE_MAGNIFIER"
74 71 msgstr "放大鏡"
75 72  
76 73 msgid "DALI_DEMO_STR_TITLE_MESH_MORPH"
77 74 msgstr "网格变形"
78 75  
79   -msgid "DALI_DEMO_STR_TITLE_MESH_SORTING"
80   -msgstr "网格排序"
81   -
82 76 msgid "DALI_DEMO_STR_TITLE_MESH_VISUAL"
83 77 msgstr "3D模型"
84 78  
... ...
shared/dali-demo-strings.h
... ... @@ -60,10 +60,8 @@ extern &quot;C&quot;
60 60 #define DALI_DEMO_STR_TITLE_ITEM_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_ITEM_VIEW")
61 61 #define DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS")
62 62 #define DALI_DEMO_STR_TITLE_LINE_MESH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_LINE_MESH")
63   -#define DALI_DEMO_STR_TITLE_LOGGING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_LOGGING")
64 63 #define DALI_DEMO_STR_TITLE_MAGNIFIER dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MAGNIFIER")
65 64 #define DALI_DEMO_STR_TITLE_MESH_MORPH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MESH_MORPH")
66   -#define DALI_DEMO_STR_TITLE_MESH_SORTING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MESH_SORTING")
67 65 #define DALI_DEMO_STR_TITLE_MESH_VISUAL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MESH_VISUAL")
68 66 #define DALI_DEMO_STR_TITLE_MOTION_BLUR dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MOTION_BLUR")
69 67 #define DALI_DEMO_STR_TITLE_MOTION_STRETCH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_MOTION_STRETCH")
... ... @@ -132,10 +130,8 @@ extern &quot;C&quot;
132 130 #define DALI_DEMO_STR_TITLE_ITEM_VIEW "Item View"
133 131 #define DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS "Lights and shadows"
134 132 #define DALI_DEMO_STR_TITLE_LINE_MESH "Mesh Line"
135   -#define DALI_DEMO_STR_TITLE_LOGGING "Logging"
136 133 #define DALI_DEMO_STR_TITLE_MAGNIFIER "Magnifier"
137 134 #define DALI_DEMO_STR_TITLE_MESH_MORPH "Mesh Morph"
138   -#define DALI_DEMO_STR_TITLE_MESH_SORTING "Mesh Sorting"
139 135 #define DALI_DEMO_STR_TITLE_MESH_VISUAL "Mesh Visual"
140 136 #define DALI_DEMO_STR_TITLE_MOTION_BLUR "Motion Blur"
141 137 #define DALI_DEMO_STR_TITLE_MOTION_STRETCH "Motion Stretch"
... ...