00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _SCREENIMAGEMGR_HPP_
00021 #define _SCREENIMAGEMGR_HPP_
00022
00023
00024 #include "StelFader.hpp"
00025 #include "StelModule.hpp"
00026 #include "StelTextureTypes.hpp"
00027 #include "VecMath.hpp"
00028
00029 #include <QMap>
00030 #include <QString>
00031 #include <QStringList>
00032
00033 class StelCore;
00034 class QGraphicsPixmapItem;
00035 class QTimeLine;
00036 class QGraphicsItemAnimation;
00037
00038
00039 class ScreenImage
00040 {
00041 public:
00049 ScreenImage(const QString& filename, float x, float y, bool show=false, float scale=1.);
00050 virtual ~ScreenImage();
00051
00054 virtual bool draw(const StelCore* core);
00056 virtual void update(double deltaTime);
00058 virtual void setFadeDuration(float duration);
00061 virtual void setFlagShow(bool b);
00063 virtual bool getFlagShow(void);
00067 virtual void setAlpha(float a, float duration=0.);
00072 virtual void setXY(float x, float y, float duration=0.);
00073
00074 protected:
00075 LinearFader imageFader;
00076 QGraphicsPixmapItem* tex;
00077 QTimeLine* moveTimer;
00078 QTimeLine* fadeTimer;
00079 QGraphicsItemAnimation* anim;
00080
00081 };
00082
00089 class ScreenImageMgr : public StelModule
00090 {
00091 Q_OBJECT
00092
00093 public:
00095 ScreenImageMgr();
00096 virtual ~ScreenImageMgr();
00097
00099
00100 virtual void init();
00101 virtual void draw(StelCore* core);
00103 virtual void update(double deltaTime);
00105 virtual double getCallOrder(StelModuleActionName actionName) const;
00106
00107 public slots:
00116 void createScreenImage(const QString& id,
00117 const QString& filename,
00118 float x,
00119 float y,
00120 float scale=1.,
00121 bool visible=true,
00122 float alpha=1.0);
00123
00126 bool getShowImage(const QString& id);
00130 void showImage(const QString& id, bool show);
00135 void setImageXY(const QString& id, float x, float y, float duration=0.);
00138 void deleteImage(const QString& id);
00140 void deleteAllImages(void);
00142 QStringList getAllImageIDs(void);
00143
00144 signals:
00145 void requestCreateScreenImage(const QString& id,
00146 const QString& filename,
00147 float x,
00148 float y,
00149 float scale,
00150 bool visible,
00151 float alpha);
00152
00153 void requestSetImageShow(const QString& id, bool b);
00154
00155 void requestSetImageXY(const QString& id, float x, float y, float duration);
00156
00157 void requestDeleteImage(const QString& id);
00158
00159 void requestDeleteAllImages(void);
00160
00161 private slots:
00162
00163 void doCreateScreenImage(const QString& id,
00164 const QString& filename,
00165 float x,
00166 float y,
00167 float scale,
00168 bool visible,
00169 float alpha);
00170
00171 void doSetImageShow(const QString& id, bool b);
00172
00173 void doSetImageXY(const QString& id, float x, float y, float duration);
00174
00175 void doDeleteImage(const QString& id);
00176
00177 void doDeleteAllImages(void);
00178
00179 private:
00180 QMap<QString, ScreenImage*> allScreenImages;
00181 };
00182
00183 #endif // _SCREENIMAGEMGR_HPP_