-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMenu_Biome_Details.hpp
142 lines (109 loc) · 2.93 KB
/
Menu_Biome_Details.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
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
135
136
137
138
139
140
141
142
#pragma once
#ifndef WORLDSIM_MENU_BIOME_DETAILS_HPP
#define WORLDSIM_MENU_BIOME_DETAILS_HPP
/* WorldSim: Menu_Biome_Details.hpp
#include "Menu_Biome_Details.hpp"
Menu showing details of a particular selected biome, stuff like Flora and Creatures which can be found here.
*/
#include <Graphics/GUI/GUI_Table.hpp>
#include <Container/Table/Table.hpp>
#include <Data/DataTools.hpp>
class Menu_Biome_Details: public GUI_Interface
{
public:
GUI_Manager guiManager;
/* Colours / theme. */
ColourRGB <unsigned char> cNormal;
ColourRGB <unsigned char> cSelected;
ColourRGB <unsigned char> cDropPanel;
ColourRGB <unsigned char> cHighlight;
Wildcat::Font* font;
/* Menu for investigating an individual biome */
GUI_Button buttonClose;
World_Biome * selectedBiome;
Menu_Biome_Details()
{
selectedBiome=0;
}
void setFont(Wildcat::Font* _font)
{
font = _font;
guiManager.setFont(_font);
}
void init()
{
/* Initialise theme. */
cNormal.set(220,220,220);
cSelected.set(180,180,180);
cDropPanel.set(170,170,170);
cHighlight.set(255,160,160);
buttonClose.text="X";
buttonClose.setColours(cNormal,cHighlight,0);
buttonClose.active=true;
active = false;
guiManager.clear();
guiManager.add(&buttonClose);
eventResize();
}
void render()
{
if ( active )
{
if (selectedBiome==0) { return; }
// if (selectedBiome->isGenerated == false)
// {
// std::cout<<"Not generated\n";
// selectedBiome->generate();
// }
Renderer::placeColour4a(150,150,150,200,panelX1,panelY1,panelX2,panelY2);
font8x8.drawText("Biome Details Menu",panelX1,panelY2-20,panelX2,panelY2-5, true, true);
//std::cout<<"nflora: "<<selectedBiome->vFlora.size()<<"\n";
std::string strFlora = "Flora:\n";
// for (int i=0;i<selectedBiome->vFlora.size();++i)
// {
// strFlora+=selectedBiome->vFlora(i)->name;
// }
Vector <Flora*> * vFlora2 = selectedBiome->getAllFloraTypes();
//std::cout<<"nflora2: "<<vFlora2->size()<<"\n";
for (int i=0;i<vFlora2->size();++i)
{
strFlora+=(*vFlora2)(i)->name+"\n";
}
delete vFlora2;
strFlora+="\n\nCreatures:\n";
Vector <Creature_Species*> * vCreature = selectedBiome->getAllCreatureTypes();
for (int i=0;i<vCreature->size();++i)
{
strFlora+=(*vCreature)(i)->name+"\n";
}
delete vCreature;
font8x8.drawText("Menu text.\n"+strFlora,panelX1,panelY1,panelX2,panelY2-25, false, false, false, 0, 0, 0, 255, 2);
guiManager.render();
}
}
bool keyboardEvent (Keyboard* _keyboard)
{
return false;
}
bool mouseEvent (Mouse* _mouse)
{
if ( active )
{
/* If the guiManager did something with the mouse event. */
if(guiManager.mouseEvent(_mouse)==true)
{
}
if (buttonClose.clicked==true)
{
active=false;
buttonClose.unclick();
}
}
return false;
}
void eventResize()
{
buttonClose.setPanel(panelX2-40, panelY2-40, panelX2-20, panelY2-20);
}
};
#endif