VoltAir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
TextureManager.h
1 /*
2  * Copyright (C) 2014 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef TEXTUREMANAGER_H
18 #define TEXTUREMANAGER_H
19 
20 #include <QMap>
21 #include <memory>
23 
38 public:
39  ~TextureManager();
40 
46  TexturePtr getTexture(const QString& path);
47 
53  TexturePtr getTextureAsset(const QString& assetPath);
54 
60  TexturePtr getTextureImage(const QString& imagePath);
61 
77  void processDeletion();
78 
79 private:
80  // TODO: Switch to QHash.
81  QMap<QString, TexturePtr> mTextures;
82  QMap<QString, TexturePtr> mDeleteQueue;
83 };
84 
85 #endif // TEXTUREMANAGER_H
Class which loads and caches Textures.
Definition: TextureManager.h:37
TexturePtr getTexture(const QString &path)
Returns a Texture containing the image at path relative to the standard image directory.
TexturePtr getTextureImage(const QString &imagePath)
Returns a Texture containing the image at imagePath relative to the standard image directory...
TexturePtr getTextureAsset(const QString &assetPath)
Returns a Texture containing the image at assetPath relative to the standard asset directory...
std::shared_ptr< Texture > TexturePtr
Shared pointer typedef for Texture.
Definition: PointerDeclarations.h:173
File containing forward declarations for renderer types and smart pointers.
void markAllTexturesForDeletion()
Move all Textures currently cached onto the deletion list, to be deleted on the next call to processD...
void processDeletion()
Release references to all Textures on the delete list.