[dali_1.2.16] Merge branch 'devel/master'
[platform/core/uifw/dali-demo.git] / examples / fpp-game / game-entity.h
1 #ifndef GAME_ENTITY_H
2 #define GAME_ENTITY_H
3
4 /*
5  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 #include "game-renderer.h"
22
23 #include <dali/public-api/actors/actor.h>
24
25 /**
26  * @brief The GameEntity class
27  * GameEntity wraps the Dali::Actor class and binds the GameRenderer with
28  * loaded entity. Entities are owned by the GameScene and populated when
29  * scene is being deserialized.
30  */
31 class GameEntity
32 {
33 public:
34
35   /**
36    * Creates an instance of GameEntity with given name
37    * @param[in] name Name of created entity
38    */
39   GameEntity( const char* name );
40
41   /**
42    * Destroys an instance of GameEntity
43    */
44   ~GameEntity();
45
46   /**
47    * Returns the GameRenderer object
48    */
49   GameRenderer& GetGameRenderer();
50
51   /**
52    * Returns associated DALi actor
53    * @return Returns actor associated with this GameEntity
54    */
55   Dali::Actor& GetActor();
56
57   /**
58    * Sets location of entity
59    * @param[in] location Local position of entity
60    */
61   void SetLocation( const Dali::Vector3& location );
62
63   /**
64    * Sets rotation of entity
65    * @param[in] rotation Local rotation of entity
66    */
67   void SetRotation( const Dali::Quaternion& rotation );
68
69   /**
70    * Sets scale of entity
71    * @param[in] scale Local scale of entity
72    */
73   void SetScale( const Dali::Vector3& scale );
74
75   /**
76    * Sets size of entity
77    * @param[in] size Bounding box of entity
78    */
79   void SetSize( const Dali::Vector3& size );
80
81   /**
82    * Updates Dali::Renderer in case if anything changed ( geometry, texture, etc. )
83    */
84   void UpdateRenderer();
85
86 private:
87
88   Dali::Actor   mActor;
89   GameRenderer  mGameRenderer;
90 };
91
92 #endif