Otclient  14/8/2020
spritemanager.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2020 OTClient <https://github.com/edubart/otclient>
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20  * THE SOFTWARE.
21  */
22 
23 #ifndef SPRITEMANAGER_H
24 #define SPRITEMANAGER_H
25 
28 
29 //@bindsingleton g_sprites
31 {
32  enum {
33  SPRITE_SIZE = 32,
34  SPRITE_DATA_SIZE = SPRITE_SIZE*SPRITE_SIZE * 4
35  };
36 
37 public:
38  SpriteManager();
39 
40  void terminate();
41 
42  bool loadSpr(std::string file);
43  void unload();
44 
45  void saveSpr(std::string fileName);
46 
47  uint32 getSignature() { return m_signature; }
48  int getSpritesCount() { return m_spritesCount; }
49 
50  ImagePtr getSpriteImage(int id);
51  bool isLoaded() { return m_loaded; }
52 
53 private:
54  stdext::boolean<false> m_loaded;
55  uint32 m_signature;
56  int m_spritesCount;
57  int m_spritesOffset;
58  FileStreamPtr m_spritesFile;
59 };
60 
62 
63 #endif
uint32
uint32_t uint32
Definition: types.h:35
SpriteManager::getSignature
uint32 getSignature()
Definition: spritemanager.h:47
SpriteManager::getSpriteImage
ImagePtr getSpriteImage(int id)
Definition: spritemanager.cpp:127
stdext::boolean< false >
SpriteManager::SpriteManager
SpriteManager()
Definition: spritemanager.cpp:31
declarations.h
SpriteManager::getSpritesCount
int getSpritesCount()
Definition: spritemanager.h:48
SpriteManager::saveSpr
void saveSpr(std::string fileName)
Definition: spritemanager.cpp:66
g_sprites
SpriteManager g_sprites
Definition: spritemanager.cpp:29
declarations.h
stdext::shared_object_ptr
Definition: shared_object.h:39
SpriteManager::isLoaded
bool isLoaded()
Definition: spritemanager.h:51
SpriteManager
Definition: spritemanager.h:30
SpriteManager::terminate
void terminate()
Definition: spritemanager.cpp:37
SpriteManager::loadSpr
bool loadSpr(std::string file)
Definition: spritemanager.cpp:42
SpriteManager::unload
void unload()
Definition: spritemanager.cpp:120