code format

This commit is contained in:
2022-12-14 14:14:33 +03:00
parent 09e5342956
commit cdb02fc9be
278 changed files with 15371 additions and 12176 deletions

View File

@@ -20,34 +20,40 @@
#define GLTEXTUREMANAGER_H
#include "glmaterial.h"
#include <QDir>
#include <QFileInfo>
class GLTextureManager: public GLTextureManagerBase
{
class GLTextureManager: public GLTextureManagerBase {
public:
GLTextureManager() {;}
~GLTextureManager() {deleteTextures();}
GLTextureManager() { ; }
~GLTextureManager() { deleteTextures(); }
struct Animation {
QString path;
QVector<GLuint> bitmaps;
GLuint bitmapID(const int frame) {if (frame < 0 || frame >= bitmaps.size()) return 0; return bitmaps[frame];}
GLuint bitmapID(const int frame) {
if (frame < 0 || frame >= bitmaps.size()) return 0;
return bitmaps[frame];
}
};
void addTexture(const QString & path) {tex_pathes << path;}
void addAnimation(const QString & dir, const QString & name) {anim_pathes << QPair<QString, QString>(dir, name);}
void addTexture(const QString & path) { tex_pathes << path; }
void addAnimation(const QString & dir, const QString & name) { anim_pathes << QPair<QString, QString>(dir, name); }
bool loadTextures();
void deleteTextures();
void deleteTexture(const QString & name);
Animation * findAnimation(const QString & name) {for (int i = 0; i < anim_ids.size(); ++i) if (anim_ids[i].first == name) return &(anim_ids[i].second); return 0;}
Animation * findAnimation(const QString & name) {
for (int i = 0; i < anim_ids.size(); ++i)
if (anim_ids[i].first == name) return &(anim_ids[i].second);
return 0;
}
QVector<QPair<QString, Animation> > anim_ids;
QVector<QPair<QString, Animation>> anim_ids;
private:
QStringList tex_pathes;
QList<QPair<QString, QString> > anim_pathes;
QList<QPair<QString, QString>> anim_pathes;
};
#endif // GLTEXTUREMANAGER_H