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