Updated demos to use DALi clang-format
[platform/core/uifw/dali-demo.git] / examples / fpp-game / game-texture.h
1 #ifndef GAME_TEXTURE_H
2 #define GAME_TEXTURE_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 <dali/public-api/rendering/sampler.h>
22 #include <dali/public-api/rendering/texture-set.h>
23 #include <dali/public-api/rendering/texture.h>
24
25 #include <inttypes.h>
26
27 class GameTexture
28 {
29 public:
30   /**
31    * Creates an instance of the GameTexture
32    */
33   GameTexture();
34
35   /**
36    * Creates an instance of the GameTexture with given filename
37    */
38   GameTexture(const char* filename);
39
40   /**
41    * Destroys an instance of the GameTexture
42    */
43   ~GameTexture();
44
45   /**
46    * @brief Loads texture from file
47    * @return Returns true if success
48    */
49   bool Load(const char* filename);
50
51   /**
52    * Checks status of texture, returns false if failed to load
53    * @return true if texture has been loaded, false otherwise
54    */
55   bool IsReady();
56
57   /**
58    * @brief Returns DALi texture set associated with the GameTexture
59    * @return Initialised TextureSet
60    */
61   Dali::TextureSet& GetTextureSet();
62
63   /**
64    * Returns unique Id of the texture
65    * @return Value of unique Id
66    */
67   uint32_t GetUniqueId();
68
69 private:
70   Dali::Texture    mTexture;
71   Dali::Sampler    mSampler;
72   Dali::TextureSet mTextureSet;
73
74   uint32_t mUniqueId;
75
76   bool mIsReady;
77 };
78
79 #endif