Crossfire Server, Trunk
AnimationWrapper.h
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 2022 the Crossfire Development Team
5  *
6  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
7  * welcome to redistribute it under certain conditions. For details, please
8  * see COPYING and LICENSE.
9  *
10  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
11  */
12 
13 #ifndef ANIMATION_WRAPPER_H
14 #define ANIMATION_WRAPPER_H
15 
16 #include <QObject>
17 
18 #include "global.h"
19 #include "../assets/AssetWrapper.h"
20 #include "../CREPixmap.h"
21 
22 class ResourcesManager;
23 
24 class AnimationWrapper : public AssetTWrapper<Animations> {
25  Q_OBJECT
26 
27  Q_PROPERTY(QString name READ name)
28 
29 public:
30  AnimationWrapper(AssetWrapper *parent, Animations* anim, ResourcesManager *resourcesManager);
31 
32  virtual QString displayName() const override { return myWrappedItem->name; }
33  virtual QIcon displayIcon() const { return CREPixmap::getIcon(myWrappedItem->faces[0]); }
34 
35  virtual PossibleUse uses(const AssetWrapper *asset, std::string &) const override;
36 
37  QString name() const { return myWrappedItem->name; }
38 
39 protected:
41 };
42 
43 #endif // ANIMATION_WRAPPER_H
AssetTWrapper< Animations >::myWrappedItem
Animations * myWrappedItem
Definition: AssetWrapper.h:103
global.h
ResourcesManager
Definition: ResourcesManager.h:80
AnimationWrapper
Definition: AnimationWrapper.h:24
AssetWrapper::PossibleUse
PossibleUse
Definition: AssetWrapper.h:31
AnimationWrapper::displayName
virtual QString displayName() const override
Definition: AnimationWrapper.h:32
CREPixmap::getIcon
static QIcon getIcon(uint16_t faceNumber)
Definition: CREPixmap.cpp:65
AnimationWrapper::AnimationWrapper
AnimationWrapper(AssetWrapper *parent, Animations *anim, ResourcesManager *resourcesManager)
Definition: AnimationWrapper.cpp:18
AnimationWrapper::name
QString name() const
Definition: AnimationWrapper.h:37
AssetWrapper
Definition: AssetWrapper.h:25
AnimationWrapper::uses
virtual PossibleUse uses(const AssetWrapper *asset, std::string &) const override
Definition: AnimationWrapper.cpp:22
AnimationWrapper::myResourcesManager
ResourcesManager * myResourcesManager
Definition: AnimationWrapper.h:40
animate.anim
string anim
Definition: animate.py:20
animations_struct::name
sstring name
Definition: face.h:26
animations_struct
Definition: face.h:25
AnimationWrapper::displayIcon
virtual QIcon displayIcon() const
Definition: AnimationWrapper.h:33
animations_struct::faces
const Face ** faces
Definition: face.h:30
AnimationWrapper::name
QString name
Definition: AnimationWrapper.h:27
AssetTWrapper
Definition: AssetWrapper.h:93