mirror of
https://github.com/devZoGok/PlanetFleet.git
synced 2026-08-26 19:43:29 +00:00
listbox differentiation
This commit is contained in:
+29
-4
@@ -101,11 +101,36 @@ namespace battleship{
|
||||
Vector2 size = Vector2(sizeX, sizeY);
|
||||
|
||||
int numMaxDisplay = lm->getIntFromTable(guiTable, vector<Index>{Index(guiId + 1), Index("numMaxDisplay")});
|
||||
string fontFile = lm->getStringFromTable(guiTable, vector<Index>{Index(guiId + 1), Index("font")});
|
||||
bool closable = lm->getBoolFromTable(guiTable, vector<Index>{Index(guiId + 1), Index("closable")});
|
||||
ListboxType listboxType = (ListboxType)lm->getIntFromTable(guiTable, vector<Index>{Index(guiId + 1), Index("listboxType")});
|
||||
|
||||
vector<string> lines;
|
||||
int maxDisplay, numLines;
|
||||
bool closable;
|
||||
|
||||
switch(listboxType){
|
||||
case CONTROLS:{
|
||||
numLines = 6;
|
||||
closable = false;
|
||||
|
||||
for(int i = 0; i < numLines; i++)
|
||||
lines.push_back(to_string(i));
|
||||
}
|
||||
break;
|
||||
case RESOLUTION:{
|
||||
numLines = lm->getIntFromTable(guiTable, vector<Index>{Index(guiId + 1), Index("numLines")});
|
||||
|
||||
for(int i = 0; i < numLines; i++)
|
||||
lines.push_back(lm->getStringFromTable(guiTable, vector<Index>{Index(guiId + 1), Index("lines"), Index(i + 1)}));
|
||||
|
||||
closable = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
maxDisplay = (numLines > numMaxDisplay ? numMaxDisplay : numLines);
|
||||
string fontPath = GameManager::getSingleton()->getPath() + "Fonts/batang.ttf";
|
||||
Listbox *listbox = new Listbox(pos, size, lines, maxDisplay, fontPath, closable);
|
||||
|
||||
string fontPath = GameManager::getSingleton()->getPath() + "Fonts/" + fontFile;
|
||||
Listbox *listbox = new Listbox(pos, size, vector<string>{"a", "b"}, 2, fontPath, closable);
|
||||
return listbox;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,10 @@ namespace battleship{
|
||||
AUDIO_TAB,
|
||||
MULTIPLAYER_TAB
|
||||
};
|
||||
enum ListboxType {
|
||||
CONTROLS,
|
||||
RESOLUTION
|
||||
};
|
||||
|
||||
class ConcreteGuiManager : public vb01Gui::AbstractGuiManager{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user