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