/* ========================================================================== * ÆÄ ÀÏ : UIImageBase.h * ¸ñ Àû : ScreenTexture ¿Í ScreenElements¸¦ ±¸ºÐÇØ¼­ »ç¿ëÇϱâ À§ÇÑ ±¸Á¶¸¦ À§Çؼ­ * ÀÛ ¼º ÀÚ : À̹ý¼® * ÀÛ ¼º ÀÏ : 2007.02.26 * ÁÖÀÇ»çÇ× : *===========================================================================*/ #pragma once #include "UIRect.h" typedef tUIRect cUIRect; class cUIImageBase { public: virtual ~cUIImageBase() {} virtual void Draw() = 0; /// ÅØ½ºÃ³¸¦ ¼³Á¤ virtual void SetTexture( NiTexture* ptex ) = 0; /// À̹ÌÁö¸¸À» º¯°æÇÑ´Ù. virtual void ChangeImage( NiTexture* /*ptex*/ ) {} /// ½ºÅ©¸° »óÀÇ À§Ä¡¸¦ ¼³Á¤ [0, 1] virtual void SetPos( int x, int y ) = 0; /// ½ºÅ©¸° »óÀÇ Å©±â¸¦ ¼³Á¤ [0, 1] virtual void SetSize( float /*w*/, float /*h*/ ) {} /// ½ºÅ©¸° »óÀÇ ¿µ¿ªÀ» ¼³Á¤ [0, 1] virtual void SetScreenRect( const cUIRect& rect ) = 0; virtual void SetTextureRect( unsigned int tl, unsigned int tt, unsigned int tr, unsigned int tb ) = 0; virtual void SetTextureRect( const cUIRect& /*rect*/ ) {} /// »ö»óÀ» ¼³Á¤ virtual void SetColor( const NiColorA& color ) = 0; virtual NiColorA& GetColor() { return mColor; } /// ¾ËÆÄ ¼³Á¤ virtual void SetAlpha( float /*a*/ ) {} /// ȸÀü virtual void SetTranslate( float /*x*/, float /*y*/ ) {} virtual void SetRotate( float /*angle*/ ) {} /// ÀûÇÕ ¿©ºÎ¸¦ ¸®ÅÏ virtual bool IsValid() const; /// ÅØ½ºÃ³ ¿µ¿ªÀ» ¸®ÅÏ const cUIRect& GetTextureRect() const; /// À̹ÌÁöÀÇ ³ÐÀÌ ¸®ÅÏ unsigned int GetWidth() const; /// À̹ÌÁöÀÇ ³ôÀÌ ¸®ÅÏ unsigned int GetHeight() const; virtual void SetRenderTargetWH( unsigned int /*width*/, unsigned int /*height*/ ) {} protected: cUIImageBase() { mTextureWidth = 0; mTextureHeight = 0; mWidthOnScreen = 1; mHeightOnScreen = 1; mTexRect.Set( 0, 0, 1, 1 ); mColor = NiColorA::WHITE; } protected: /// ÅØ½ºÃ³ Å©±â unsigned int mTextureWidth; unsigned int mTextureHeight; NiColorA mColor; /// ÅØ½ºÃ³ ¿µ¿ª [0, 1] cUIRect mTexRect; unsigned int mWidthOnScreen; unsigned int mHeightOnScreen; }; inline bool cUIImageBase::IsValid() const { if( mTextureWidth == 0 || mTextureHeight == 0 ) { assert( 0 && "invalid base image size" ); return false; } return true; } inline const cUIRect& cUIImageBase::GetTextureRect() const { return mTexRect; } inline unsigned int cUIImageBase::GetWidth() const { return mWidthOnScreen; } inline unsigned int cUIImageBase::GetHeight() const { return mHeightOnScreen; }