AbyssLib 1.301
あびす謹製ノベルゲームフレームワークライブラリ
|
00001 /************************************************* 00002 ファイル名:Component.h 00003 作成者 :あびす 00004 役割 :各種コンポーネント 00005 *************************************************/ 00010 #ifndef ABYSSLIB_COMPONENT_H 00011 #define ABYSSLIB_COMPONENT_H 00012 00013 namespace nsAbyssLib{ 00014 namespace nsComponent{ 00015 00016 //各種コンポーネントの列挙型 00020 enum UICOMPONENT_TYPE{ 00024 UICOMPONENT_BAR_DRAW, //バー(描画) 00025 00029 UICOMPONENT_BUTTON_DRAW, //ボタン(描画) 00030 }; 00031 00032 //コンポーネントクラス(インターフェース) 00036 class IUIComponent{ 00037 public: 00041 virtual ~IUIComponent(){} //仮想デストラクタ 00042 00048 virtual void OnDraw() = 0; //描画 00054 virtual bool OnMove() = 0; //検知 00064 virtual int GetID() const = 0; //種類を取得 00065 }; 00066 00067 //バー(描画)クラス 00071 class UICBarDraw : public IUIComponent{ 00072 public: 00076 UICBarDraw(); //デフォルトコンストラクタ 00081 UICBarDraw(NovelPlayer* Parent); //コンストラクタ 00082 00089 void SetParent(NovelPlayer* Parent); //親エンジンを設定 00090 00096 bool GetDisable() const; //無効時かを取得 00102 void SetDisable(bool IsDisable); //無効時かを設定 00103 00109 unsigned int GetRate() const; //割合を取得(0-10000) 00115 void SetRate(unsigned int Rate); //割合を設定(0-10000) 00116 00121 void SetBorder(unsigned int Border); //枠を設定 00128 void SetPosition(RECT Rect, RECT Knob, BYTE a); //座標を設定 00134 void SetSound(const string& OnCursor, const string& OnClick); //SEを設定 00142 void SetBarColor(COLORREF Normal, COLORREF OnCursor, COLORREF OnHold, COLORREF Disable); //内部色を設定 00150 void SetBorderColor(COLORREF Normal, COLORREF OnCursor, COLORREF OnHold, COLORREF Disable); //枠の色を設定 00151 00152 void OnDraw(); //描画 00153 bool OnMove(); //検知 00154 int GetID() const; //種類を取得 00155 private: 00156 NovelPlayer* Outer; //親エンジンのアドレス 00157 bool m_IsDisable; //無効時か? 00158 unsigned int m_Rate; //割合(1-10000) 00159 unsigned int m_Border; //枠の太さ 00160 RECT m_Rect; //判定&描画矩形(バー) 00161 RECT m_Knob; //判定&描画矩形(ノブ) 00162 BYTE m_a; //透過度 00163 string m_CursorSE, m_ClickSE; //SE(カーソル時/クリック時) 00164 COLORREF m_NColor, m_CColor, m_HColor, m_DColor; //内部色 00165 COLORREF m_BorderNColor, m_BorderCColor, m_BorderHColor, m_BorderDColor; //枠の色 00166 bool m_IsCursored; //カーソル検知用 00167 bool m_IsPushed; //クリック検知用 00168 00169 UICBarDraw(const UICBarDraw&); //コピーコンストラクタ(禁止) 00170 UICBarDraw& operator =(const UICBarDraw&); //代入演算子(禁止) 00171 }; 00172 00173 //ボタン(描画)クラス 00177 class UICButtonDraw : public IUIComponent{ 00178 public: 00182 UICButtonDraw(); //デフォルトコンストラクタ 00187 UICButtonDraw(NovelPlayer* Parent); //コンストラクタ 00188 00195 void SetParent(NovelPlayer* Parent); //親エンジンを設定 00196 00202 bool GetDisable() const; //無効時かを取得 00208 void SetDisable(bool IsDisable); //無効時かを設定 00209 00214 void SetBorder(unsigned int Border); //枠を設定 00220 void SetPosition(RECT Rect, BYTE a); //座標を設定 00226 void SetSound(const string& OnCursor, const string& OnClick); //SEを設定 00233 void SetText(const string& Text, const string& Font, unsigned int Size); //テキストを設定 00241 void SetTextColor(COLORREF Normal, COLORREF OnCursor, COLORREF OnHold, COLORREF Disable); //テキストの色を設定 00249 void SetButtonColor(COLORREF Normal, COLORREF OnCursor, COLORREF OnHold, COLORREF Disable); //内部色を設定 00257 void SetBorderColor(COLORREF Normal, COLORREF OnCursor, COLORREF OnHold, COLORREF Disable); //枠の色を設定 00258 00259 void OnDraw(); //描画 00260 bool OnMove(); //検知 00261 int GetID() const; //種類を取得 00262 private: 00263 NovelPlayer* Outer; //親エンジンのアドレス 00264 bool m_IsDisable; //無効時か? 00265 unsigned int m_Border; //枠の太さ 00266 RECT m_Rect; //判定&描画矩形 00267 BYTE m_a; //透過度 00268 string m_CursorSE, m_ClickSE; //SE(カーソル時/クリック時) 00269 string m_Text; //テキスト 00270 string m_Font; //フォント 00271 unsigned int m_Size; //サイズ 00272 COLORREF m_TextNColor, m_TextCColor, m_TextHColor, m_TextDColor; //テキストの色 00273 COLORREF m_NColor, m_CColor, m_HColor, m_DColor; //内部色 00274 COLORREF m_BorderNColor, m_BorderCColor, m_BorderHColor, m_BorderDColor; //枠の色 00275 bool m_IsCursored; //カーソル検知用 00276 bool m_IsPushed; //クリック検知用 00277 00278 UICButtonDraw(const UICButtonDraw&); //コピーコンストラクタ(禁止) 00279 UICButtonDraw& operator =(const UICButtonDraw&); //代入演算子(禁止) 00280 }; 00281 00282 } 00283 } 00284 00285 #endif