/* ========================================================================== * ÆÄ ÀÏ : Gauge.h * ¸ñ Àû : * ÀÛ ¼º ÀÚ : ±è°¡¶÷ * ÀÛ ¼º ÀÏ : 2006-11-07 * ÁÖÀÇ»çÇ× : *===========================================================================*/ #pragma once #include "UINode.h" #include "UINodeData.h" /// °ÔÀÌÁö¿¡ º¯È­°¡ ÀÖÀ»¶§, ÇØ´ç¼öÄ¡¸¦ ±âÁØÀ¸·Î ±×¶óµ¥ÀÌ¼Ç Ä÷¯¸¦ ³Ö´Â´Ù. const float GRADATION_VALUE = 10.0f; class cPlaneObject; /// ±âº» °ÔÀÌÁö¹Ù class cGauge : public cUINode { public: enum { eGaugeState_Start = 0, eGaugeState_Process, eGaugeState_End, eGaugeState_None, }; cGauge( eUINodeType type = eUINODE_GAUGE ); virtual ~cGauge(); /// ÃʱâÈ­ void Clear(); void ClearFront(); /// ¾Õ¿¡ °¡´Â °Í¸¸ Ŭ¸®¾î /// °ÔÀÌÁö Â÷´Â ¼Óµµ Á¶Àý void SetGaugeSpeed( float s ); /// ÃÖ´ë ¼öÄ¡ Á¶Àý virtual void SetMaxValue( double value ); /// °ÔÀÌÁö ¼¼ÆÃ ( ¾Ö´Ï¸ÞÀÌ¼Ç »ç¿ë¿©ºÎ ) void SetGaugeAni( double value ); virtual void SetGaugeNoAni( double value ); double GetMaxValue() const; /// ÃÖ´ë ¼öÄ¡°ª ¸®ÅÏ double GetValue() const; /// ÇöÀç ¼öÄ¡°ª ¸®ÅÏ float GetPercent() const; /// ÇöÀç ÆÛ¼¾Æ® ¼öÄ¡ ¾ò±â cPlaneObject* GetPlaneObject() const; inline void SetRightDecreasing( bool set ) { mRightDecrease = set; } bool IsProgress() { return mValue != mDestValue; } void ChangeTexturePos( const cUIPos& texPos ); inline void EnableRenderTarget() { mUseRenderTarget = true; } protected: virtual bool OnCreate( cUINodeProperty* pproperty ); virtual bool SetSkin( const cUINodeSkin* pskin ); virtual void OnProcess( unsigned long deltaTime, unsigned long accumTime ); virtual void OnPreRender(); virtual void OnRender( cUIFontItemKeeper* pKeeper ); virtual void UpdateRect(); virtual void UpdateSkin(); virtual bool HandleEvent( const cUIEvent& event ); virtual void UpdateGauge(); virtual void UpdateDestGauge() {}; virtual void UpdateText(); protected: /// °ÔÀÌÁö cPlaneObject* mpGaugeImage; /// °ÔÀÌÁö °ª double mValue; /// ¸ñÇ¥ °ª (¾Ö´Ï¸ÞÀ̼ǸñÇ¥) double mDestValue; /// ÃÖ´ë °ª double mMaxValue; /// °ÔÀÌÁö ÆÛ¼¾Æ® float mPercent; /// °ÔÀÌÁö »óÅ unsigned int mState; /// ½Ã°£°ª unsigned long mStartTime; /// °ÔÀÌÁö Â÷´Â ¼Óµµ float mSpeed; /// ÆÛ¼¾Æ®¿ë ¶óº§ bool mShowPercent; /// °ÔÀÌÁö °ª º¸±â ¿©ºÎ bool mShowText; int mTextX, mTextY; cStringT mText; /// °ÔÀÌÁö ÅØ½ºÃÄ NiTexture* mpImageTexture; /// °ÔÀÌÁö ÁÂÇ¥ cUIPos mImagePos; /// °ÔÀÌÁö ÅØ½ºÃÄ »çÀÌÁî cUISize mImageSize; /// °ÔÀÌÁö ÅØ½ºÃÄ ÁÂÇ¥ cUIPos mImageTexpos; /// °ÔÀÌÁö 100% ±âÁØ »çÀÌÁî cUISize mGaugeSize; /// °ÔÀÌÁö Ãâ·Â À§Áö bool mImageStart; bool mRightDecrease; /// use render target bool mUseRenderTarget; NiRenderedTexturePtr mpRenderedTexture; NiRenderTargetGroupPtr mpRenderTargetGroup; cPlaneObject* mpGaugeTarget; }; inline void cGauge::SetGaugeSpeed( float s ) { mSpeed = s; } inline double cGauge::GetValue() const { return mValue; } inline double cGauge::GetMaxValue() const { return mMaxValue; } inline float cGauge::GetPercent() const { return mPercent; } inline cPlaneObject* cGauge::GetPlaneObject() const { return mpGaugeImage; } ///////////////////////////////////////////////////////////// /// ÀÌÁß °ÔÀÌÁö ¹Ù class cDoubleGauge : public cGauge { public: cDoubleGauge( eUINodeType type = eUINODE_DOUBLEGAUGE ); virtual ~cDoubleGauge(); /// ÃʱâÈ­ void Clear(); void ClearFront(); /// ¾Õ¿¡ °¡´Â °Í¸¸ Ŭ¸®¾î /// ÃÖ´ë ¼öÄ¡ Á¶Àý void SetMaxValue( float value ); /// °ÔÀÌÁö µÎ°³ µ¿½Ã ¼¼ÆÃ virtual void SetGaugeNoAni( float value ); protected: virtual bool OnCreate( cUINodeProperty* pproperty ); virtual void OnProcess( unsigned long deltaTime, unsigned long accumTime ); virtual bool SetSkin( const cUINodeSkin* pskin ); virtual void OnRender( cUIFontItemKeeper* pKeeper ); virtual void UpdateRect(); virtual void UpdateSkin(); /// ¸ñÇ¥°ÔÀÌÁö ¼¼ÆÃ void UpdateDestGauge(); protected: /// °ÔÀÌÁö cPlaneObject* mpDestGaugeImage; /// °ÔÀÌÁö ÅØ½ºÃÄ NiTexture* mpDestImageTexture; /// °ÔÀÌÁö ÁÂÇ¥ cUIPos mDestImagePos; /// °ÔÀÌÁö ÅØ½ºÃÄ »çÀÌÁî cUISize mDestImageSize; /// °ÔÀÌÁö ÅØ½ºÃÄ ÁÂÇ¥ cUIPos mDestImageTexpos; /// °ÔÀÌÁö 100% ±âÁØ »çÀÌÁî cUISize mDestGaugeSize; /// °ÔÀÌÁö Ãâ·Â À§Áö bool mDestImageStart; }; class cGaugeTB : public cGauge { public: cGaugeTB( eUINodeType type = eUINODE_GAUGETB ); virtual ~cGaugeTB(); protected: virtual bool OnCreate( cUINodeProperty* pproperty ); virtual bool SetSkin( const cUINodeSkin* pskin ); virtual void OnProcess( unsigned long deltaTime, unsigned long accumTime ); virtual void OnRender( cUIFontItemKeeper* pKeeper ); virtual void UpdateRect(); virtual void UpdateGauge(); virtual void UpdateText() {} }; ////////////////////////////////////////////////////////////////////////////////// class cGaugeSkin : public cUINodeSkin { public: cGaugeSkin( eUINodeType type = eUINODE_GAUGE ); virtual ~cGaugeSkin(); /// ·Îµù virtual bool Load( cParser& parser ); public: /// ÆÛ¼¾Æ®¿ë ¶óº§ bool mShowPercent; bool mShowText; /// °ÔÀÌÁö Â÷´Â ¼Óµµ float mGaugeSpeed; /// °ÔÀÌÁö Á¤º¸ ¼¼ÆÃ NiTexture* mpImageTexture; cUIPos mImagePos; cUISize mImageSize; cUIPos mImageTexpos; cUISize mGaugeSize; bool mImageStart; NiTexture* mpDestImageTexture; cUIPos mDestImagePos; cUISize mDestImageSize; cUIPos mDestImageTexpos; cUISize mDestGaugeSize; bool mDestImageStart; };