ManaPlus
atlasmanager.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2012-2018 The ManaPlus Developers
4  *
5  * This file is part of The ManaPlus Client.
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef RESOURCES_ATLAS_ATLASMANAGER_H
22 #define RESOURCES_ATLAS_ATLASMANAGER_H
23 
24 #ifdef USE_OPENGL
25 
26 #include "utils/stringvector.h"
27 
28 #include "localconsts.h"
29 
30 class AtlasResource;
31 class Image;
32 
33 struct TextureAtlas;
34 
36 {
37  public:
38  AtlasManager();
39 
41 
42  static AtlasResource *loadTextureAtlas(const std::string &name,
43  const StringVect &files)
45 
46  static AtlasResource *loadEmptyAtlas(const std::string &name,
47  const StringVect &files)
49 
50  static void injectToResources(const AtlasResource *const resource);
51 
52  static void moveToDeleted(AtlasResource *const resource);
53 
54  private:
55  static void loadImages(const StringVect &files,
56  STD_VECTOR<Image*> &images);
57 
58  static void loadEmptyImages(const StringVect &files,
59  STD_VECTOR<Image*> &images);
60 
61  static void emptySort(const std::string &restrict name,
62  STD_VECTOR<TextureAtlas*> &restrict atlases,
63  const STD_VECTOR<Image*> &restrict images);
64 
65  static void simpleSort(const std::string &restrict name,
66  STD_VECTOR<TextureAtlas*> &restrict atlases,
67  const STD_VECTOR<Image*> &restrict images,
68  int size);
69 
70  static void createSDLAtlas(TextureAtlas *const atlas) A_NONNULL(1);
71 
72  static void convertAtlas(TextureAtlas *const atlas) A_NONNULL(1);
73 
74  static void convertEmptyAtlas(TextureAtlas *const atlas) A_NONNULL(1);
75 };
76 
77 #endif // USE_OPENGL
78 #endif // RESOURCES_ATLAS_ATLASMANAGER_H
#define A_DELETE_COPY(func)
Definition: localconsts.h:52
static AtlasResource * loadTextureAtlas(const std::string &name, const StringVect &files)
#define A_WARN_UNUSED
Definition: localconsts.h:160
#define final
Definition: localconsts.h:45
std::vector< std::string > StringVect
Definition: stringvector.h:28
#define A_NONNULL(...)
Definition: localconsts.h:167
static void loadEmptyImages(const StringVect &files, std::vector< Image *> &images)
static void loadImages(const StringVect &files, std::vector< Image *> &images)
static void convertEmptyAtlas(TextureAtlas *const atlas)
static AtlasResource * loadEmptyAtlas(const std::string &name, const StringVect &files)
static void moveToDeleted(AtlasResource *const resource)
static void emptySort(const std::string &name, std::vector< TextureAtlas *> &atlases, const std::vector< Image *> &images)
static void simpleSort(const std::string &name, std::vector< TextureAtlas *> &atlases, const std::vector< Image *> &images, int size)
Definition: image.h:61
#define restrict
Definition: localconsts.h:164
static void injectToResources(const AtlasResource *const resource)
static void convertAtlas(TextureAtlas *const atlas)
static void createSDLAtlas(TextureAtlas *const atlas)