Updated demos to use DALi clang-format
[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) 2020 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    * Creates an instance of GameEntity with given name
36    * @param[in] name Name of created entity
37    */
38   GameEntity(const char* name);
39
40   /**
41    * Destroys an instance of GameEntity
42    */
43   ~GameEntity();
44
45   /**
46    * Returns the GameRenderer object
47    */
48   GameRenderer& GetGameRenderer();
49
50   /**
51    * Returns associated DALi actor
52    * @return Returns actor associated with this GameEntity
53    */
54   Dali::Actor& GetActor();
55
56   /**
57    * Sets location of entity
58    * @param[in] location Local position of entity
59    */
60   void SetLocation(const Dali::Vector3& location);
61
62   /**
63    * Sets rotation of entity
64    * @param[in] rotation Local rotation of entity
65    */
66   void SetRotation(const Dali::Quaternion& rotation);
67
68   /**
69    * Sets scale of entity
70    * @param[in] scale Local scale of entity
71    */
72   void SetScale(const Dali::Vector3& scale);
73
74   /**
75    * Sets size of entity
76    * @param[in] size Bounding box of entity
77    */
78   void SetSize(const Dali::Vector3& size);
79
80   /**
81    * Updates Dali::Renderer in case if anything changed ( geometry, texture, etc. )
82    */
83   void UpdateRenderer();
84
85 private:
86   Dali::Actor  mActor;
87   GameRenderer mGameRenderer;
88 };
89
90 #endif