Commit c0226aa0 authored by mercury233's avatar mercury233

add resize popup menu

parent 386b0cf2
......@@ -2006,25 +2006,26 @@ void ClientField::ShowMenu(int flag, int x, int y) {
return;
}
int height = 1;
int offset = (mainGame->gameConf.resize_popup_menu && mainGame->yScale >= 0.666) ? 21 * mainGame->yScale : 14;
if(flag & COMMAND_ACTIVATE) {
mainGame->btnActivate->setVisible(true);
mainGame->btnActivate->setRelativePosition(position2di(1, height));
height += 21;
height += offset;
} else mainGame->btnActivate->setVisible(false);
if(flag & COMMAND_SUMMON) {
mainGame->btnSummon->setVisible(true);
mainGame->btnSummon->setRelativePosition(position2di(1, height));
height += 21;
height += offset;
} else mainGame->btnSummon->setVisible(false);
if(flag & COMMAND_SPSUMMON) {
mainGame->btnSPSummon->setVisible(true);
mainGame->btnSPSummon->setRelativePosition(position2di(1, height));
height += 21;
height += offset;
} else mainGame->btnSPSummon->setVisible(false);
if(flag & COMMAND_MSET) {
mainGame->btnMSet->setVisible(true);
mainGame->btnMSet->setRelativePosition(position2di(1, height));
height += 21;
height += offset;
} else mainGame->btnMSet->setVisible(false);
if(flag & COMMAND_SSET) {
if(!(clicked_card->type & TYPE_MONSTER))
......@@ -2033,7 +2034,7 @@ void ClientField::ShowMenu(int flag, int x, int y) {
mainGame->btnSSet->setText(dataManager.GetSysString(1159));
mainGame->btnSSet->setVisible(true);
mainGame->btnSSet->setRelativePosition(position2di(1, height));
height += 21;
height += offset;
} else mainGame->btnSSet->setVisible(false);
if(flag & COMMAND_REPOS) {
if(clicked_card->position & POS_FACEDOWN)
......@@ -2044,34 +2045,34 @@ void ClientField::ShowMenu(int flag, int x, int y) {
mainGame->btnRepos->setText(dataManager.GetSysString(1156));
mainGame->btnRepos->setVisible(true);
mainGame->btnRepos->setRelativePosition(position2di(1, height));
height += 21;
height += offset;
} else mainGame->btnRepos->setVisible(false);
if(flag & COMMAND_ATTACK) {
mainGame->btnAttack->setVisible(true);
mainGame->btnAttack->setRelativePosition(position2di(1, height));
height += 21;
height += offset;
} else mainGame->btnAttack->setVisible(false);
if(flag & COMMAND_LIST) {
mainGame->btnShowList->setVisible(true);
mainGame->btnShowList->setRelativePosition(position2di(1, height));
height += 21;
height += offset;
} else mainGame->btnShowList->setVisible(false);
if(flag & COMMAND_OPERATION) {
mainGame->btnOperation->setVisible(true);
mainGame->btnOperation->setRelativePosition(position2di(1, height));
height += 21;
height += offset;
} else mainGame->btnOperation->setVisible(false);
if(flag & COMMAND_RESET) {
mainGame->btnReset->setVisible(true);
mainGame->btnReset->setRelativePosition(position2di(1, height));
height += 21;
height += offset;
} else mainGame->btnReset->setVisible(false);
panel = mainGame->wCmdMenu;
mainGame->wCmdMenu->setVisible(true);
position2di mouse = mainGame->Resize(x, y);
x = mouse.X;
y = mouse.Y;
mainGame->wCmdMenu->setRelativePosition(irr::core::recti(x - 20 , y - 20 - height, x + 80, y - 20));
if(mainGame->gameConf.resize_popup_menu)
mainGame->wCmdMenu->setRelativePosition(mainGame->Resize(x - 20, y - 20, x + 80, y - 20, 0, -height, 0, 0));
else
mainGame->wCmdMenu->setRelativePosition(mainGame->Resize(x, y, x, y, -20, -(20 + height), 80, -20));
}
void ClientField::UpdateChainButtons() {
if(mainGame->btnChainAlways->isVisible()) {
......
......@@ -1014,6 +1014,7 @@ void Game::LoadConfig() {
gameConf.window_maximized = false;
gameConf.window_width = 1024;
gameConf.window_height = 640;
gameConf.resize_popup_menu = true;
while(fgets(linebuf, 256, fp)) {
sscanf(linebuf, "%s = %s", strbuf, valbuf);
if(!strcmp(strbuf, "antialias")) {
......@@ -1082,6 +1083,8 @@ void Game::LoadConfig() {
gameConf.window_width = atoi(valbuf);
} else if(!strcmp(strbuf, "window_height")) {
gameConf.window_height = atoi(valbuf);
} else if(!strcmp(strbuf, "resize_popup_menu")) {
gameConf.resize_popup_menu = atoi(valbuf) > 0;
} else {
// options allowing multiple words
sscanf(linebuf, "%s = %240[^\n]", strbuf, valbuf);
......@@ -1437,6 +1440,23 @@ void Game::OnResize() {
wReplaySave->setRelativePosition(ResizeWin(510, 200, 820, 320));
stHintMsg->setRelativePosition(ResizeWin(500, 60, 820, 90));
if(gameConf.resize_popup_menu) {
int width = 100 * mainGame->xScale;
int height = (mainGame->yScale >= 0.666) ? 21 * mainGame->yScale : 14;
wCmdMenu->setRelativePosition(recti(1, 1, width + 1, 1));
btnActivate->setRelativePosition(recti(1, 1, width, height));
btnSummon->setRelativePosition(recti(1, 1, width, height));
btnSPSummon->setRelativePosition(recti(1, 1, width, height));
btnMSet->setRelativePosition(recti(1, 1, width, height));
btnSSet->setRelativePosition(recti(1, 1, width, height));
btnRepos->setRelativePosition(recti(1, 1, width, height));
btnAttack->setRelativePosition(recti(1, 1, width, height));
btnActivate->setRelativePosition(recti(1, 1, width, height));
btnShowList->setRelativePosition(recti(1, 1, width, height));
btnOperation->setRelativePosition(recti(1, 1, width, height));
btnReset->setRelativePosition(recti(1, 1, width, height));
}
wCardImg->setRelativePosition(Resize(1, 1, 1 + CARD_IMG_WIDTH + 20, 1 + CARD_IMG_HEIGHT + 18));
imgCard->setRelativePosition(Resize(10, 9, 10 + CARD_IMG_WIDTH, 9 + CARD_IMG_HEIGHT));
wInfos->setRelativePosition(Resize(1, 275, 301, 639));
......
......@@ -45,6 +45,7 @@ struct Config {
bool window_maximized;
int window_width;
int window_height;
bool resize_popup_menu;
};
struct DuelInfo {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment