WorldSim  inDev
2D tile-based sandbox RPG with procedurally generated fantasy world simulator 🌏
Menu_LoadGame.hpp
Go to the documentation of this file.
1 #pragma once
2 #ifndef WORLDSIM_MENU_LOADGAME_HPP
3 #define WORLDSIM_MENU_LOADGAME_HPP
4 
5 class Menu_LoadGame: public GUI_Interface
6 {
7  public:
8  Texture* backgroundTexture;
9  /* GUI manager. Manages all GUI controls. */
10  GUI_Manager guiManager;
11  /* Button: Back to main menu. */
12  GUI_Button buttonBack;
13  /* Colours / theme. */
14  ColourRGB <unsigned char> cNormal;
15  ColourRGB <unsigned char> cSelected;
16  ColourRGB <unsigned char> cDropPanel;
17  ColourRGB <unsigned char> cHighlight;
18 
20  {
21  }
23  {
24  }
25 
26  void render()
27  {
28  /* Render background image. */
29  Renderer::placeTexture4(panelX1,panelY1,panelX2,panelY2,backgroundTexture,true);
30  guiManager.render();
31  }
32 
33  void init()
34  {
35  backgroundTexture=&TEX_LOAD_GAME_BACKGROUND;
36  active=false;
37 
38  /* Initialise theme. */
39  cNormal.set(220,220,220);
40  cSelected.set(180,180,180);
41  cDropPanel.set(170,170,170);
42  cHighlight.set(255,160,160);
43 
44  /* Update control positions. */
45  buttonBack.setPanel(panelCenterX-60, panelY2-20, panelCenterX+60, panelY2-40);
46  buttonBack.text="Back";
47  buttonBack.setColours(cNormal,cHighlight,0);
48 
49 
50  guiManager.addControl(&buttonBack);
51 
52  guiManager.setFont(font);
53  }
54 
55  void eventResize()
56  {
57  /* Update control positions. */
58  buttonBack.setPanel(panelCenterX-60, panelY2-20, panelCenterX+60, panelY2-40);
59  }
60 
61  void setFont(Wildcat::Font* _font)
62  {
63  font = _font;
64  guiManager.setFont(_font);
65  }
66 
67  bool mouseEvent (Mouse* _mouse)
68  {
69  /* If the guiManager did something with the mouse event. */
70  if(guiManager.mouseEvent(_mouse)==true)
71  {
72 
73  if(buttonBack.clicked==true)
74  {
75  buttonBack.unclick();
77  }
78  }
79 
80  return false;
81  }
82 
83 
84 };
85 
86 #endif
bool mouseEvent(Mouse *_mouse)
Definition: Menu_LoadGame.hpp:67
ColourRGB< unsigned char > cDropPanel
Definition: Menu_LoadGame.hpp:16
Definition: Menu_LoadGame.hpp:5
ColourRGB< unsigned char > cSelected
Definition: Menu_LoadGame.hpp:15
Definition: Driver_Settings.cpp:111
void render()
Definition: Menu_LoadGame.hpp:26
void init()
Definition: Menu_LoadGame.hpp:33
ColourRGB< unsigned char > cNormal
Definition: Menu_LoadGame.hpp:14
enumMenu activeMenu
Definition: Driver_Settings.cpp:113
Texture * backgroundTexture
Definition: Menu_LoadGame.hpp:8
ColourRGB< unsigned char > cHighlight
Definition: Menu_LoadGame.hpp:17
Menu_LoadGame()
Definition: Menu_LoadGame.hpp:19
~Menu_LoadGame()
Definition: Menu_LoadGame.hpp:22
void setFont(Wildcat::Font *_font)
Definition: Menu_LoadGame.hpp:61
void eventResize()
Definition: Menu_LoadGame.hpp:55
GUI_Manager guiManager
Definition: Menu_LoadGame.hpp:10
GUI_Button buttonBack
Definition: Menu_LoadGame.hpp:12