OROCHI
 
Loading...
Searching...
No Matches
GxDebugMenu.h
1//===========================================================================
11//===========================================================================
12#pragma once
13
14#if GX_DEVELOP
15
16GX_UTILITY_NAMESPACE_BEGIN()
17
18//===========================================================================
20//===========================================================================
21class GxDebugMenu : public GxClassBase
22{
23 //-----------------------------------------------------------
25 //-----------------------------------------------------------
27public:
28 GX_RTTI_CLASS(GxDebugMenu, GxClassBase)
29 // GxClassBase継承クラス用禁止宣言
30 GX_PROHIBIT_CLASS_BASE(GxDebugMenu)
31
32
33 enum class TYPE
34 {
35 PAGE = 0,
36 MENU
37 };
38
40 static constexpr u32 VALUE_LENGTH = GxMath::VALUE_512;
41
43 static constexpr u32 MARGIN_TOP = 4;
45 static constexpr u32 MARGIN_BOTTOM = 4;
46
48 static constexpr u32 MARGIN_LEFT = 4;
50 static constexpr u32 MARGIN_RIGHT = 4;
52 static constexpr u32 NAME_MARGIN_LEFT = 20;
54 static constexpr u32 NAME_MARGIN_RIGHT = 10;
55
57 static constexpr u32 VALUE_MARGIN_LEFT = 20;
59 static constexpr u32 VALUE_MARGIN_RIGHT = 20;
60
61 class GxUseEnumInfo;
62
64 //----------------------------------------
66 //----------------------------------------
68public:
70 GxDebugMenu(void);
71
73 ~GxDebugMenu(void);
74
76 void cleanup( void );
77
79 //----------------------------------------
81 //----------------------------------------
83public:
85 void update( void );
87 void render(void);
88
89protected:
91 void developRenderCallback(const GxPoint2* pOffset, const GxSize* pResolution);
92
94 void onSetChild(void);
96 void onDeleteChild(void);
97
99 void drawProperty(const GxPoint2& position, GxProperty& property, GxClassBaseRoot* pObject, b32 selected, const GxUseEnumInfo* pUseEnumInfo = nullptr);
100
102 void control(void);
103
105 void controlProperty(b32 isSub, b32 isAdd, GxProperty& property, GxClassBaseRoot* pObject, const GxUseEnumInfo* pUseEnumInfo = nullptr);
106
108 void goNextMenu(void);
109
111 void goPreviousMenu(void);
112
114 void execute(void);
115
117 void cancel(void);
118
120 // @param pChild [in] 子DebugMenu
121 constexpr void setChild(GxDebugMenu* pChild) { _pChild = pChild; if (_pChild)onSetChild(); }
122
124 GX_FORCE_INLINE void deleteChild(void) { if (_pChild) onDeleteChild(); GX_SAFE_DELETE(_pChild); }
125
127 static void createChildPropertyTable(GxPropertyTable& baseTable, u32 startIndex, GxPropertyTable& newTable);
128
130 GxUseEnumInfo* getUseEnumArrayFromProperty(u32 targetPropertyIndex);
131
133 //----------------------------------------
135 //----------------------------------------
137public:
140 void setMenu( const GxPropertyTable& menu );
141
144 GX_FORCE_INLINE void setPosition( const GxPoint2& position ){ _position = position; }
145
148 constexpr void setType( TYPE type ){ _type = type; }
151 constexpr TYPE getType( void ) const { return _type; }
152
155 GX_FORCE_INLINE void setMenuColor( const GxColor& color ){ _menuColor = color; }
156
159 GX_FORCE_INLINE void setMenuGreyOutColor( const GxColor& color ){ _menuGreyOutColor = color; }
160
163 GX_FORCE_INLINE void setBackColor( const GxColor& color ){ _backColor = color; }
164
167 GX_FORCE_INLINE void setBackFrameColor( const GxColor& color ){ _backFrameColor = color; }
168
170 void setControl( b32 control );
171
172 // パッド操作許可設定
173 GX_FORCE_INLINE void setUsePadControl( b32 use ){ _usePadControl = use; }
174
175 // キーボード操作許可設定
176 GX_FORCE_INLINE void setUseKeyboardControl( b32 use ){ _useKeyboardControl = use; }
177
179 // @param pParent [in] 親DebugMenu
180 GX_FORCE_INLINE virtual void setParent( GxDebugMenu* pParent ){ _pParent = pParent; }
181
183 void setEnumTableToDispProperty( u32 targetIndex, const GX_ENUM* pEnumArray, u32 enumNum );
184
185protected:
188 GX_FORCE_INLINE void setVisible( b32 visible ){ _visible = visible; }
189
191 void setActive( b32 active );
192
194 //----------------------------------------
196 //----------------------------------------
198protected:
199 TYPE _type;
200 b32 _visible;
201 b32 _active;
202 b32 _control;
203
204 b32 _usePadControl;
205 b32 _useKeyboardControl;
206
207 s64 _stepValueS64;
208 f64 _stepValueF64;
209
210 GxPropertyTable _menuTable;
211 GxPoint2 _position;
212
213 s32 _selectIndex;
214
215 u32 _nameMaxWidth;
216 u32 _valueMaxWidth;
217 u32 _maxWidth;
218 u32 _useHeight;
219
220 GxDebugMenu* _pParent;
221 GxDebugMenu* _pChild;
222
223 GxColor _menuColor;
224 GxColor _menuGreyOutColor;
225 GxColor _backColor;
226 GxColor _backFrameColor;
227
228 GxArrayClassBase _useEnumArray;
229
231};
232
233//===========================================================================
235//===========================================================================
236class GxDebugMenu::GxUseEnumInfo : public GxClassBase
237{
238 //-----------------------------------------------------------
240 //-----------------------------------------------------------
242public:
243 GX_RTTI_CLASS( GxDebugMenu::GxUseEnumInfo, GxClassBase )
244
245
246 //----------------------------------------
248 //----------------------------------------
250
252 GxUseEnumInfo( void ) : _targetPropertyIndex(0), _pUseEnumArray(nullptr), _useEnumArrayNum(0){}
253
255 GxUseEnumInfo( u32 targetPropertyIndex, const GX_ENUM* pUseEnumArray, u32 useEnumArrayNum );
256
258 ~GxUseEnumInfo( void ) override {}
259
261 //----------------------------------------
263 //----------------------------------------
265
267 constexpr u32 getTargetPropertyIndex( void ) const { return _targetPropertyIndex; }
268
270 GX_FORCE_INLINE const GX_ENUM* getUseEnumArray( void ) const { return _pUseEnumArray; }
271
273 constexpr u32 getUseEnumArrayNum( void ) const { return _useEnumArrayNum; }
274
276 GX_CSTR getDisplayString( s32 value ) const;
277
279 s32 getNextValue( s32 value,b32 isLoop,s32 addValue=1 ) const;
280
282 GX_FORCE_INLINE s32 getPreviousValue( s32 value, b32 isLoop ) const { return getNextValue(value, isLoop, -1); }
283
285 //----------------------------------------
287 //----------------------------------------
289protected:
290 u32 _targetPropertyIndex;
291 const GX_ENUM* _pUseEnumArray;
292 u32 _useEnumArrayNum;
293
295};
296
297GX_UTILITY_NAMESPACE_END()
298
299#endif // GX_DEVELOP
#define GX_PROHIBIT_CLASS_BASE(__CLASS__)
GxClassBase継承の禁止宣言
Definition GxBase.h:240
配列クラス
Definition GxArrayClassBase.h:18
オブジェクト基底クラス
Definition GxBase.h:88
基底クラス
Definition GxBase.h:51
static constexpr u32 VALUE_512
512
Definition GxMath.h:128
プロパティクラス
Definition GxProperty.h:48
プロパティテーブルクラス
Definition GxProperty.h:1641
GUI用
Definition GxDefine.h:194
Definition GxColor.h:21
座標
Definition GxStruct.h:867
サイズ
Definition GxStruct.h:730
32bitブーリアン
Definition GxDefine.h:173