new buttons

This commit is contained in:
devZoGok
2024-03-23 08:36:16 +02:00
parent 3aec1aaf7e
commit 8c02e0d98c
9 changed files with 98 additions and 51 deletions
+28 -6
View File
@@ -1,13 +1,14 @@
res = graphics.resolution
Size = {x = 70, y = 70}
sz = 210
s = 90
gui = {
{
guiType = GuiType.TEXT,
name = 'refineds',
text = '',
pos = {x = 0, y = 100},
pos = {x = 100, y = 100},
zIndex = 0,
scale = 1,
font = 'batang.ttf',
@@ -19,7 +20,7 @@ gui = {
guiType = GuiType.TEXT,
name = 'wealth',
text = '',
pos = {x = 0, y = 200},
pos = {x = 100, y = 200},
zIndex = 0,
scale = 1,
font = 'batang.ttf',
@@ -31,7 +32,7 @@ gui = {
guiType = GuiType.TEXT,
name = 'research',
text = '',
pos = {x = 0, y = 300},
pos = {x = 100, y = 300},
zIndex = 0,
scale = 1,
font = 'batang.ttf',
@@ -39,6 +40,27 @@ gui = {
fontLastChar = 256,
color = {x = 1, y = 1, z = 1, w = 1}
},
{
guiType = GuiType.GUI_RECTANGLE,
pos = {x = 0, y = 0},
zIndex = .9,
size = {x = s, y = s},
imagePath = 'defaultTexture.jpg',
},
{
guiType = GuiType.GUI_RECTANGLE,
pos = {x = 0, y = 100},
zIndex = .9,
size = {x = s, y = s},
imagePath = 'defaultTexture.jpg',
},
{
guiType = GuiType.GUI_RECTANGLE,
pos = {x = 0, y = 200},
zIndex = .9,
size = {x = s, y = s},
imagePath = 'defaultTexture.jpg',
},
{
guiType = GuiType.TEXT,
name = 'depth',
@@ -63,21 +85,21 @@ gui = {
{
guiType = GuiType.GUI_RECTANGLE,
pos = {x = res.x - sz, y = res.y - sz},
zIndex = 0,
zIndex = .9,
size = {x = sz, y = sz},
color = {x = .6, y = .6, z = .6, w = .6}
},
{
guiType = GuiType.GUI_RECTANGLE,
pos = {x = 0, y = res.y - sz},
zIndex = 0,
zIndex = .9,
size = {x = sz, y = sz},
color = {x = .6, y = .6, z = .6, w = .6}
},
{
guiType = GuiType.GUI_RECTANGLE,
pos = {x = sz, y = res.y - .75 * sz},
zIndex = 0,
zIndex = .9,
size = {x = res.x - 2 * sz, y = sz * .75},
color = {x = .6, y = .6, z = .6, w = .6}
},
+15 -13
View File
@@ -1,50 +1,52 @@
res = graphics.resolution
Size = {x = 100, y = 100}
Size = {x = 70, y = 70}
margin = 10
sz = {x = Size.x - margin, y = Size.y - margin}
gui = {
{
pos = {x = res.x - 200, y = res.y - 200},
size = Size,
pos = {x = res.x - 3 * Size.x, y = res.y - 3 * Size.y},
size = sz,
imagePath = '',
guiType = GuiType.BUTTON,
buttonType = ButtonType.BUILD,
trigger = 76,
},
{
pos = {x = res.x - Size.x - 200, y = res.y - 200},
size = Size,
pos = {x = res.x - 2 * Size.x, y = res.y - 3 * Size.y},
size = sz,
imagePath = '',
guiType = GuiType.BUTTON,
buttonType = ButtonType.BUILD,
trigger = 78,
},
{
pos = {x = res.x - 2 * Size.x - 200, y = res.y - 200},
size = {x = 100, y = 100},
pos = {x = res.x - 1 * Size.x, y = res.y - 3 * Size.y},
size = sz,
imagePath = '',
guiType = GuiType.BUTTON,
buttonType = ButtonType.BUILD,
trigger = 77,
},
{
pos = {x = res.x - 3 * Size.x - 200, y = res.y - 200},
size = Size,
pos = {x = res.x - 3 * Size.x, y = res.y - 2 * Size.y},
size = sz,
imagePath = '',
guiType = GuiType.BUTTON,
buttonType = ButtonType.BUILD,
trigger = 84,
},
{
pos = {x = res.x - 4 * Size.x - 200, y = res.y - 200},
size = Size,
pos = {x = res.x - 2 * Size.x, y = res.y - 2 * Size.y},
size = sz,
imagePath = '',
guiType = GuiType.BUTTON,
buttonType = ButtonType.BUILD,
trigger = 68,
},
{
pos = {x = res.x - 5 * Size.x - 200, y = res.y - 200},
size = Size,
pos = {x = res.x - 1 * Size.x, y = res.y - 2 * Size.y},
size = sz,
imagePath = '',
guiType = GuiType.BUTTON,
buttonType = ButtonType.BUILD,
+5 -3
View File
@@ -1,10 +1,12 @@
res = graphics.resolution
Size = {x = 100, y = 100}
Size = {x = 70, y = 70}
margin = 10
sz = {x = Size.x - margin, y = Size.y - margin}
gui = {
{
pos = {x = res.x - 200, y = res.y - 200},
size = Size,
pos = {x = res.x - Size.x + .5 * margin, y = res.y - Size.y + .5 * margin},
size = sz,
imagePath = '',
guiType = GuiType.BUTTON,
buttonType = ButtonType.FORT_TRAIN,
+9 -7
View File
@@ -1,26 +1,28 @@
res = graphics.resolution
Size = {x = 100, y = 100}
Size = {x = 70, y = 70}
margin = 10
sz = {x = Size.x - margin, y = Size.y - margin}
gui = {
{
pos = {x = res.x - 200, y = res.y - 200},
size = Size,
pos = {x = res.x + .5 * margin - Size.x, y = res.y - 3 * Size.y},
size = sz,
imagePath = '',
guiType = GuiType.BUTTON,
buttonType = ButtonType.LAND_FACTORY_TRAIN,
trigger = 87
},
{
pos = {x = res.x - Size.x - 200, y = res.y - 200},
size = Size,
pos = {x = res.x + .5 * margin - 2 * Size.x, y = res.y - 3 * Size.y},
size = sz,
imagePath = '',
guiType = GuiType.BUTTON,
buttonType = ButtonType.LAND_FACTORY_TRAIN,
trigger = 84
},
{
pos = {x = res.x - 2 * Size.x - 200, y = res.y - 200},
size = Size,
pos = {x = res.x + .5 * margin - 3 * Size.x, y = res.y - 3 * Size.y},
size = sz,
imagePath = '',
guiType = GuiType.BUTTON,
buttonType = ButtonType.LAND_FACTORY_TRAIN,
+3 -2
View File
@@ -1,9 +1,10 @@
res = graphics.resolution
Size = {x = 70, y = 70}
gui = {
{
pos = {x = res.x - 200, y = res.y - 200},
size = {x = 100, y = 100},
pos = {x = res.x - Size.x, y = res.y - Size.y},
size = Size,
imagePath = '',
guiType = GuiType.BUTTON,
buttonType = ButtonType.NAVAL_FACTORY_TRAIN,
@@ -1,10 +1,12 @@
res = graphics.resolution
Size = {x = 100, y = 100}
Size = {x = 70, y = 70}
margin = 10
sz = {x = Size.x - margin, y = Size.y - margin}
gui = {
{
pos = {x = res.x - 200, y = res.y - 200},
size = Size,
pos = {x = res.x - Size.x, y = res.y - Size.y},
size = sz,
name = "Research",
imagePath = '',
guiType = GuiType.BUTTON,
@@ -17,8 +19,8 @@ gui = {
buttonType = ButtonType.ACTIVE_GAME_STATE,
name = 'Tech',
imagePath = '',
pos = {x = res.x - Size.x, y = res.y - Size.y},
size = Size,
pos = {x = res.x - 2 * Size.x, y = res.y - Size.y},
size = sz,
trigger = 85
},
}
+11 -9
View File
@@ -1,10 +1,12 @@
res = graphics.resolution
Size = {x = 100, y = 100}
Size = {x = 70, y = 70}
margin = 10
sz = {x = Size.x - margin, y = Size.y - margin}
gui = {
{
pos = {x = res.x - 200, y = res.y - 200},
size = Size,
pos = {x = res.x - Size.x, y = res.y - Size.y},
size = sz,
name = 'Buy ref',
imagePath = '',
guiType = GuiType.BUTTON,
@@ -12,8 +14,8 @@ gui = {
trigger = 73,
},
{
pos = {x = res.x - Size.x - 200, y = res.y - 200},
size = Size,
pos = {x = res.x - 2 * Size.x, y = res.y - Size.y},
size = sz,
imagePath = '',
name = 'Sell ref',
guiType = GuiType.BUTTON,
@@ -21,8 +23,8 @@ gui = {
trigger = 79,
},
{
pos = {x = res.x - 200, y = res.y - 400},
size = Size,
pos = {x = res.x - Size.x, y = res.y - 2 * Size.y},
size = sz,
imagePath = '',
name = 'Buy rsch',
guiType = GuiType.BUTTON,
@@ -30,8 +32,8 @@ gui = {
trigger = 75,
},
{
pos = {x = res.x - Size.x - 200, y = res.y - 400},
size = Size,
pos = {x = res.x - 2 * Size.x, y = res.y - 2 * Size.y},
size = sz,
imagePath = '',
name = 'Sell rsch',
guiType = GuiType.BUTTON,
+3 -3
View File
@@ -84,9 +84,9 @@ namespace battleship{
void ActiveGameState::update() {
ConcreteGuiManager *guiManager = ConcreteGuiManager::getSingleton();
guiManager->getText("depth")->setText(L"Depth: " + to_wstring(depth));
guiManager->getText("refineds")->setText(L"Refineds: " + to_wstring(mainPlayer->getResource(ResourceType::REFINEDS)));
guiManager->getText("wealth")->setText(L"Wealth: " + to_wstring(mainPlayer->getResource(ResourceType::WEALTH)));
guiManager->getText("research")->setText(L"Research: " + to_wstring(mainPlayer->getResource(ResourceType::RESEARCH)));
guiManager->getText("refineds")->setText(to_wstring(mainPlayer->getResource(ResourceType::REFINEDS)));
guiManager->getText("wealth")->setText(to_wstring(mainPlayer->getResource(ResourceType::WEALTH)));
guiManager->getText("research")->setText(to_wstring(mainPlayer->getResource(ResourceType::RESEARCH)));
if(!isSelectionBox && leftMouseClicked && getTime() - lastLeftMouseClicked > 10)
isSelectionBox = true;
+17 -3
View File
@@ -414,9 +414,23 @@ namespace battleship{
Root *root = Root::getSingleton();
Material *mat = new Material(root->getLibPath() + "gui");
mat->addBoolUniform("texturingEnabled", false);
sol::table colorTable = guiTable["color"];
mat->addVec4Uniform("diffuseColor", Vector4(colorTable["x"], colorTable["y"], colorTable["z"], colorTable["w"]));
string ipk = "imagePath";
sol::optional<string> pathOpt = guiTable[ipk];
string imagePath = (pathOpt != sol::nullopt ? (string)guiTable[ipk] : "");
bool texturingEnabled = (imagePath != "");
mat->addBoolUniform("texturingEnabled", texturingEnabled);
if(texturingEnabled){
string p[]{GameManager::getSingleton()->getPath() + "Textures/" + (string)guiTable[ipk]};
Texture *tex = new Texture(p, 1, false);
mat->addTexUniform("diffuseMap", tex, false);
}
else{
sol::table colorTable = guiTable["color"];
mat->addVec4Uniform("diffuseColor", Vector4(colorTable["x"], colorTable["y"], colorTable["z"], colorTable["w"]));
}
sol::table sizeTable = guiTable["size"];
Quad *quad = new Quad(Vector3(sizeTable["x"], sizeTable["y"], 1), false);