Button.h
1    #pragma once
2    
3    #include "DxLib.h"
4    #include "font.h"
5    #include "../geometory.h"
6    #include "mouse.h"
7    
8    //色の構造体
9    typedef struct ST_Color
10   {
11       int r;
12       int g;
13       int b;    
14   }Color;
15   
16   //ボタンのクラス
17   class Button
18   {
19   public:
20       //コンストラクタ
21       Button(RECT rect,Color buttonColor,const TCHAR* text,Font font=fontDotSmall);
22   
23       void SetText(const TCHAR* text,Font font=fontDotSmall);    //テキストの設定
24       void SetPosition(RECT rect){button=rect;}    //ボタンの位置の設定
25       void Button_Draw();     //ボタンの描画
26       bool CollButtonToMouseClick(int Mouse_Input);    //ボタンのクリックの処理
27       bool IsOnceClick(){return isOnceClick;}  //一度クリックされたか
28       void ResetOnceClick(){isOnceClick=false;}  //一度クリックされたかのリセット
29       void SetActive(bool isActive){this->isActive=isActive;}  //ボタンのアクティブ設定
30   
31   private:
32       RECT button;        //ボタンの位置
33       Color buttonColor;  //ボタンの色
34       const TCHAR* text;  //ボタンのテキスト
35       Font font;          //フォント
36   
37       bool isActive;      //アクティブか
38       bool isOnceClick;       //一度クリックされたか
39       
40   };
41