-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMenu_Options.hpp
90 lines (72 loc) · 1.75 KB
/
Menu_Options.hpp
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
#pragma once
#ifndef WORLDSIM_MENU_OPTIONS_HPP
#define WORLDSIM_MENU_OPTIONS_HPP
class Menu_Options: public GUI_Interface
{
public:
//GUI_TextBox menuHeading;
Texture* backgroundTexture;
/* Colours / theme. */
ColourRGB <unsigned char> cNormal;
ColourRGB <unsigned char> cSelected;
ColourRGB <unsigned char> cDropPanel;
ColourRGB <unsigned char> cHighlight;
/* Button: Back to main menu. */
GUI_Button buttonBack;
/* GUI manager. Manages all GUI controls. */
GUI_Manager guiManager;
Menu_Options()
{
}
~Menu_Options()
{
}
void render()
{
/* Render background image. */
Renderer::placeTexture4(panelX1,panelY1,panelX2,panelY2,backgroundTexture,true);
guiManager.render();
}
void setFont(Wildcat::Font* _font)
{
font = _font;
guiManager.setFont(_font);
}
void eventResize()
{
/* Update control positions. */
buttonBack.setPanel(panelCenterX-60, panelY2-20, panelCenterX+60, panelY2-40);
}
void init()
{
backgroundTexture=&TEX_OPTIONS_BACKGROUND;
active=false;
/* Initialise theme. */
cNormal.set(220,220,220);
cSelected.set(180,180,180);
cDropPanel.set(170,170,170);
cHighlight.set(255,160,160);
/* Update control positions. */
buttonBack.setPanel(panelCenterX-60, panelY2-20, panelCenterX+60, panelY2-40);
buttonBack.text="Back";
buttonBack.setColours(cNormal,cHighlight,0);
guiManager.add(&buttonBack);
guiManager.setFont(font);
}
bool mouseEvent (Mouse* _mouse)
{
/* If the guiManager did something with the mouse event. */
if(guiManager.mouseEvent(_mouse)==true)
{
if(buttonBack.clicked==true)
{
buttonBack.unclick();
//std::cout<<"Back.\n";
//active=false;
activeMenu = MENU_TITLE;
}
}
return false;
}
};
#endif