forked from abartlett139/Omni
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUIControls.h
135 lines (127 loc) · 4.36 KB
/
UIControls.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#ifndef UICONTROLS_H
#define UICONTROLS_H
#include "UIBase.h"
#include "GameState.h"
class WindowControl: public UIBase
{
private:
bool m_IsParentWindow;
bool m_IsMouseDown;
D3DXVECTOR2 m_MouseClickPos;
public:
WindowControl( UIBase* parent, int vecPos );
~WindowControl( );
bool OnRender( );
void OnMouseDown( int Button, int x, int y );
void OnMouseMove( int x, int y );
void OnMouseUp( int Button, int x, int y );
void OnSetFocus( );
void OnLostFocus( );
void OnKeyDown( WPARAM Key, LPARAM Extended );
void OnKeyUp( WPARAM Key, LPARAM Extended );
bool LoadCanvasFromFile( char* File );
void SetRect( RECT rect ) { m_Texture->SetRect( rect ); }
};
//--------------------------------------------------------------------Labels---------------------------
class LabelControl: public UIBase
{
private:
char m_Caption[ 255 ];
LPD3DXFONT m_Font;
D3DCOLOR m_Color;
D3DCOLOR m_ColorOver;
D3DCOLOR m_ColorNULL;
DWORD m_Format;
bool m_ButtonLabel;
RECT m_Rect;
public:
LabelControl( UIBase* parent, int vecPos, LOGFONT Font, RECT Rect);
~LabelControl( );
bool OnRender( );
void OnMouseDown( int Button, int x, int y );
void OnMouseMove( int x, int y );
void OnMouseUp( int Button, int x, int y );
void OnKeyDown( WPARAM Key, LPARAM Extended ) { return; }
void OnKeyUp( WPARAM Key, LPARAM Extended ) { return; }
void SetCaption( char* Caption );
char* GetCaption( ) { return m_Caption; }
void SetColor( D3DCOLOR Color ) { m_Color = Color; }
void SetFormat( DWORD Format ) { m_Format = Format; }
void OnLostFocus( ) { return; }
};
//-----------------------------------------------------------------Buttons------------------------------------------
class ButtonControl: public UIBase
{
HFONT m_Font;
LabelControl* m_Caption;
Texture* m_DefaultTex;
Texture* m_OverTex;
bool m_Over;
RECT m_Rect;
GameState* m_ChangeState;
public:
ButtonControl( UIBase* parent, int vecPos, D3DXVECTOR2 Position);
~ButtonControl( );
bool OnRender( );
void OnMouseDown( int Button, int x, int y );
void OnMouseMove( int x, int y );
void OnMouseUp( int Button, int x, int y );
void OnKeyDown( WPARAM Key, LPARAM Extended ) { return; }
void OnKeyUp( WPARAM Key, LPARAM Extended ) { return; }
bool SetTextures( Texture* fileDefault, Texture* fileOver );
void SetCaption( char* Caption );
void OnLostFocus( );
void SetChangeState( GameState* gameState ) { m_ChangeState = gameState; }
void ChangeState( GameState* gameState ) { gameState = m_ChangeState; }
};
//----------------------------------------------------------SlideBar---------------------------------------------------
class SlideBar: public UIBase
{
private:
HFONT m_Font;
Texture* m_Bar;
Texture* m_SlideDefault;
Texture* m_SlideOver;
bool m_Over;
bool m_ButtonDown;
LabelControl* m_Caption;
DWORD m_Format;
RECT m_CapRect;
D3DXVECTOR2 m_BarPos, m_CapPos;
public:
SlideBar( UIBase* parent, int vecPos, D3DXVECTOR2 Position );
~SlideBar( );
bool OnRender( );
void OnMouseDown( int Button, int x, int y );
void OnMouseMove( int x, int y );
void OnMouseUp( int Button, int x, int y );
void OnKeyDown( WPARAM Key, LPARAM Extended ) { return; }
void OnKeyUp( WPARAM Key, LPARAM Extended ) { return; }
bool SetTextures( Texture* Bar, Texture* SlideUp, Texture* SlideDown );
void SetCaption( char* Caption );
void OnLostFocus( );
};
//--------------------------------------------------------------Health-------------------------------------------------
class HealthBar: public UIBase
{
HFONT m_Font;
LabelControl* m_Caption;
Texture* m_BackTex;
RECT m_CapRect;
float m_FillAmount;
D3DXVECTOR2 m_CapPos;
public:
HealthBar( UIBase* parent, int vecPos, D3DXVECTOR2 Position);
~HealthBar( );
bool OnRender( );
void OnMouseDown( int Button, int x, int y ) { return; }
void OnMouseMove( int x, int y ) { return; }
void OnMouseUp( int Button, int x, int y ) { return; }
void OnKeyDown( WPARAM Key, LPARAM Extended ) { return; }
void OnKeyUp( WPARAM Key, LPARAM Extended ) { return; }
bool SetTextures( Texture* Background, Texture* Fill );
void SetCaption( char* Caption );
void OnLostFocus( );
void SetFill( float Percent );
};
#endif // !UICONTROLS_H