00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _SPRITEVISUAL_
00019 #define _SPRITEVISUAL_
00020
00021 #include "game/BaseVisual.h"
00022 #include "game/VisualFactory.h"
00023
00024 #include "renderer/AbstractRenderer.h"
00025 #include "renderer/Sprite.h"
00026
00027 class SpriteVisual : public BaseVisual
00028 {
00029 private:
00030 Sprite m_sprite;
00031 float m_fScaleX;
00032 float m_fScaleY;
00033 public:
00034 DEFAULT_VISUAL_CONSTRUCTOR(SpriteVisual, INIT2(m_fScaleX, 1.0f, m_fScaleY, 1.0f));
00035
00036 const Sprite & GetSprite() const { return m_sprite; }
00037 void SetSprite(const Sprite & sprite) { m_sprite = sprite; }
00038
00039 float GetScaleX() const { return m_fScaleX; }
00040 void SetScaleX(const float fScaleX) { m_fScaleX = fScaleX; }
00041
00042 float GetScaleY() const { return m_fScaleY; }
00043 void SetScaleY(const float fScaleY) { m_fScaleY = fScaleY; }
00044
00045 virtual void RenderVisual(AbstractRenderer * pRenderer, const int nDelta);
00046
00047 virtual bool FromAttribute(const Attribute * pRoot);
00048 virtual void ToStream(std::ostream& stream) const;
00049 virtual void FromStream(std::istream& stream);
00050
00051 };
00052
00053 REGISTER_VISUAL(SpriteVisual, "visual_sprite");
00054
00055 #endif