Commit ccb0a1be authored by fallenstardust's avatar fallenstardust

放大点击菜单按钮

textfontsize允许读写设置
缩小效果文字滚动条
parent 68502bdc
......@@ -2098,7 +2098,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
break;
}
u32 pos = mainGame->scrCardText->getPos();
mainGame->SetStaticText(mainGame->stText, mainGame->stText->getRelativePosition().getWidth() - 25, mainGame->guiFont, mainGame->showingtext, pos);
mainGame->SetStaticText(mainGame->stText, mainGame->stText->getRelativePosition().getWidth() - 15, mainGame->textFont, mainGame->showingtext, pos);
return true;
break;
}
......@@ -2287,7 +2287,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
if(pos < 0) pos = 0;
if(pos > max) pos = max;
mainGame->scrCardText->setPos(pos);
mainGame->SetStaticText(mainGame->stText, mainGame->stText->getRelativePosition().getWidth() - 25, mainGame->guiFont, mainGame->showingtext, pos);
mainGame->SetStaticText(mainGame->stText, mainGame->stText->getRelativePosition().getWidth() - 15, mainGame->textFont, mainGame->showingtext, pos);
}
if(is_dragging_lstLog) {
if(!mainGame->lstLog->getVerticalScrollBar()->isVisible()) {
......@@ -2578,28 +2578,28 @@ void ClientField::ShowMenu(int flag, int x, int y) {
mainGame->btnActivate->setVisible(true);
mainGame->btnActivate->setRelativePosition(position2di(0, height));
#ifdef _IRR_ANDROID_PLATFORM_
height += 50 * mainGame->yScale;
height += 60 * mainGame->yScale;
#endif
} else mainGame->btnActivate->setVisible(false);
if(flag & COMMAND_SUMMON) {
mainGame->btnSummon->setVisible(true);
mainGame->btnSummon->setRelativePosition(position2di(0, height));
#ifdef _IRR_ANDROID_PLATFORM_
height += 50 * mainGame->yScale;
height += 60 * mainGame->yScale;
#endif
} else mainGame->btnSummon->setVisible(false);
if(flag & COMMAND_SPSUMMON) {
mainGame->btnSPSummon->setVisible(true);
mainGame->btnSPSummon->setRelativePosition(position2di(0, height));
#ifdef _IRR_ANDROID_PLATFORM_
height += 50 * mainGame->yScale;
height += 60 * mainGame->yScale;
#endif
} else mainGame->btnSPSummon->setVisible(false);
if(flag & COMMAND_MSET) {
mainGame->btnMSet->setVisible(true);
mainGame->btnMSet->setRelativePosition(position2di(0, height));
#ifdef _IRR_ANDROID_PLATFORM_
height += 50 * mainGame->yScale;
height += 60 * mainGame->yScale;
#endif
} else mainGame->btnMSet->setVisible(false);
if(flag & COMMAND_SSET) {
......@@ -2610,7 +2610,7 @@ void ClientField::ShowMenu(int flag, int x, int y) {
mainGame->btnSSet->setVisible(true);
mainGame->btnSSet->setRelativePosition(position2di(0, height));
#ifdef _IRR_ANDROID_PLATFORM_
height += 50 * mainGame->yScale;
height += 60 * mainGame->yScale;
#endif
} else mainGame->btnSSet->setVisible(false);
if(flag & COMMAND_REPOS) {
......@@ -2623,40 +2623,40 @@ void ClientField::ShowMenu(int flag, int x, int y) {
mainGame->btnRepos->setVisible(true);
mainGame->btnRepos->setRelativePosition(position2di(0, height));
#ifdef _IRR_ANDROID_PLATFORM_
height += 50 * mainGame->yScale;
height += 60 * mainGame->yScale;
#endif
} else mainGame->btnRepos->setVisible(false);
if(flag & COMMAND_ATTACK) {
mainGame->btnAttack->setVisible(true);
mainGame->btnAttack->setRelativePosition(position2di(0, height));
#ifdef _IRR_ANDROID_PLATFORM_
height += 50 * mainGame->yScale;
height += 60 * mainGame->yScale;
#endif
} else mainGame->btnAttack->setVisible(false);
if(flag & COMMAND_LIST) {
mainGame->btnShowList->setVisible(true);
mainGame->btnShowList->setRelativePosition(position2di(0, height));
#ifdef _IRR_ANDROID_PLATFORM_
height += 50 * mainGame->yScale;
height += 60 * mainGame->yScale;
#endif
} else mainGame->btnShowList->setVisible(false);
if(flag & COMMAND_OPERATION) {
mainGame->btnOperation->setVisible(true);
mainGame->btnOperation->setRelativePosition(position2di(0, height));
#ifdef _IRR_ANDROID_PLATFORM_
height += 50 * mainGame->yScale;
height += 60 * mainGame->yScale;
#endif
} else mainGame->btnOperation->setVisible(false);
if(flag & COMMAND_RESET) {
mainGame->btnReset->setVisible(true);
mainGame->btnReset->setRelativePosition(position2di(0, height));
#ifdef _IRR_ANDROID_PLATFORM_
height += 50 * mainGame->yScale;
height += 60 * mainGame->yScale;
#endif
} else mainGame->btnReset->setVisible(false);
panel = mainGame->wCmdMenu;
mainGame->wCmdMenu->setVisible(true);
mainGame->wCmdMenu->setRelativePosition(irr::core::recti(x - 10 * mainGame->xScale , y - 30 * mainGame->yScale - height, x + 100 * mainGame->xScale, y - 20 * mainGame->yScale));
mainGame->wCmdMenu->setRelativePosition(irr::core::recti(x - 20 * mainGame->xScale , y - 30 * mainGame->yScale - height, x + 130 * mainGame->xScale, y - 30 * mainGame->yScale));
}
void ClientField::HideMenu() {
mainGame->wCmdMenu->setVisible(false);
......
......@@ -236,13 +236,13 @@ bool Game::Initialize(ANDROID_APP app, android::InitOptions *options) {
LoadExpansions();
env = device->getGUIEnvironment();
bool isAntialias = options->isFontAntiAliasEnabled();
numFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 16 * yScale, isAntialias, false);
numFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 18 * yScale, isAntialias, false);
adFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 12 * yScale, isAntialias, false);
lpcFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 48 * yScale, isAntialias, true);
guiFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, 16 * yScale, isAntialias, true);
guiFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, 18 * yScale, isAntialias, true);
titleFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, 32 * yScale, isAntialias, true);
textFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, (int)gameConf.textfontsize * yScale, isAntialias, true);
if(!numFont || !textFont) {
if(!numFont || !guiFont) {
ALOGW("add font fail ");
}
smgr = device->getSceneManager();
......@@ -491,8 +491,8 @@ bool Game::Initialize(ANDROID_APP app, android::InitOptions *options) {
stSetName = env->addStaticText(L"", rect<s32>(10 * xScale, 83 * yScale, 260 * xScale, 106 * yScale), false, true, wInfos, -1, false);
stSetName->setOverrideColor(SColor(255, 255, 152, 42));//255, 0, 0, 255
stText = env->addStaticText(L"", rect<s32>(10 * xScale, 106 * yScale, 260 * xScale, 345 * yScale), false, true, wInfos, -1, false);
scrCardText = env->addScrollBar(false, rect<s32>(248 * xScale, 106 * yScale, 258 * xScale, 639 * yScale), wInfos, SCROLL_CARDTEXT);
#endif
stText->setOverrideFont(textFont);
scrCardText = env->addScrollBar(false, rect<s32>(250 * xScale, 106 * yScale, 258 * xScale, 639 * yScale), wInfos, SCROLL_CARDTEXT);
scrCardText->setLargeStep(1);
scrCardText->setSmallStep(1);
scrCardText->setVisible(false);
......@@ -626,7 +626,7 @@ bool Game::Initialize(ANDROID_APP app, android::InitOptions *options) {
btnHand[i]->setImage(imageManager.tHand[i]);
btnHand[i]->setImageScale(core::vector2df(xScale, yScale));
}
#ifdef _IRR_ANDROID_PLATFORM_
//first or second to go
wFTSelect = env->addWindow(rect<s32>(470 * xScale, 180 * yScale, 860 * xScale, 360 * yScale), false, L"");
wFTSelect->getCloseButton()->setVisible(false);
......@@ -821,30 +821,30 @@ bool Game::Initialize(ANDROID_APP app, android::InitOptions *options) {
stTip->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
stTip->setVisible(false);
//cmd menu
wCmdMenu = env->addWindow(rect<s32>(0, 0, 110 * xScale, 510 * yScale), false, L"");
wCmdMenu = env->addWindow(rect<s32>(0, 0, 150 * xScale, 600 * yScale), false, L"");
wCmdMenu->setDrawTitlebar(false);
wCmdMenu->setDrawBackground(false);
wCmdMenu->setVisible(false);
wCmdMenu->getCloseButton()->setVisible(false);
btnActivate = env->addButton(rect<s32>(0, 0, 110 * xScale, 50 * yScale), wCmdMenu, BUTTON_CMD_ACTIVATE, dataManager.GetSysString(1150));
btnActivate = env->addButton(rect<s32>(0, 0, 150 * xScale, 60 * yScale), wCmdMenu, BUTTON_CMD_ACTIVATE, dataManager.GetSysString(1150));
ChangeToIGUIImageButton(btnActivate, imageManager.tButton_S, imageManager.tButton_S_pressed);
btnSummon = env->addButton(rect<s32>(0, 50 * yScale, 110 * xScale, 100 * yScale), wCmdMenu, BUTTON_CMD_SUMMON, dataManager.GetSysString(1151));
btnSummon = env->addButton(rect<s32>(0, 60 * yScale, 150 * xScale, 120 * yScale), wCmdMenu, BUTTON_CMD_SUMMON, dataManager.GetSysString(1151));
ChangeToIGUIImageButton(btnSummon, imageManager.tButton_S, imageManager.tButton_S_pressed);
btnSPSummon = env->addButton(rect<s32>(0, 100 * yScale, 110 * xScale, 150 * yScale), wCmdMenu, BUTTON_CMD_SPSUMMON, dataManager.GetSysString(1152));
btnSPSummon = env->addButton(rect<s32>(0, 120 * yScale, 150 * xScale, 180 * yScale), wCmdMenu, BUTTON_CMD_SPSUMMON, dataManager.GetSysString(1152));
ChangeToIGUIImageButton(btnSPSummon, imageManager.tButton_S, imageManager.tButton_S_pressed);
btnMSet = env->addButton(rect<s32>(0, 150 * yScale, 110 * xScale, 200 * yScale), wCmdMenu, BUTTON_CMD_MSET, dataManager.GetSysString(1153));
btnMSet = env->addButton(rect<s32>(0, 180 * yScale, 150 * xScale, 240 * yScale), wCmdMenu, BUTTON_CMD_MSET, dataManager.GetSysString(1153));
ChangeToIGUIImageButton(btnMSet, imageManager.tButton_S, imageManager.tButton_S_pressed);
btnSSet = env->addButton(rect<s32>(0, 200 * yScale, 110 * xScale, 250 * yScale), wCmdMenu, BUTTON_CMD_SSET, dataManager.GetSysString(1153));
btnSSet = env->addButton(rect<s32>(0, 240 * yScale, 150 * xScale, 300 * yScale), wCmdMenu, BUTTON_CMD_SSET, dataManager.GetSysString(1153));
ChangeToIGUIImageButton(btnSSet, imageManager.tButton_S, imageManager.tButton_S_pressed);
btnRepos = env->addButton(rect<s32>(0, 250 * yScale, 110 * xScale, 300 * yScale), wCmdMenu, BUTTON_CMD_REPOS, dataManager.GetSysString(1154));
btnRepos = env->addButton(rect<s32>(0, 300 * yScale, 150 * xScale, 360 * yScale), wCmdMenu, BUTTON_CMD_REPOS, dataManager.GetSysString(1154));
ChangeToIGUIImageButton(btnRepos, imageManager.tButton_S, imageManager.tButton_S_pressed);
btnAttack = env->addButton(rect<s32>(0, 300 * yScale, 110 * xScale, 350 * yScale), wCmdMenu, BUTTON_CMD_ATTACK, dataManager.GetSysString(1157));
btnAttack = env->addButton(rect<s32>(0, 360 * yScale, 150 * xScale, 420 * yScale), wCmdMenu, BUTTON_CMD_ATTACK, dataManager.GetSysString(1157));
ChangeToIGUIImageButton(btnAttack, imageManager.tButton_S, imageManager.tButton_S_pressed);
btnShowList = env->addButton(rect<s32>(0, 350 * yScale, 110 * xScale, 400 * yScale), wCmdMenu, BUTTON_CMD_SHOWLIST, dataManager.GetSysString(1158));
btnShowList = env->addButton(rect<s32>(0, 420 * yScale, 150 * xScale, 480 * yScale), wCmdMenu, BUTTON_CMD_SHOWLIST, dataManager.GetSysString(1158));
ChangeToIGUIImageButton(btnShowList, imageManager.tButton_S, imageManager.tButton_S_pressed);
btnOperation = env->addButton(rect<s32>(0, 400 * yScale, 110 * xScale, 450 * yScale), wCmdMenu, BUTTON_CMD_ACTIVATE, dataManager.GetSysString(1161));
btnOperation = env->addButton(rect<s32>(0, 480 * yScale, 150 * xScale, 540 * yScale), wCmdMenu, BUTTON_CMD_ACTIVATE, dataManager.GetSysString(1161));
ChangeToIGUIImageButton(btnOperation, imageManager.tButton_S, imageManager.tButton_S_pressed);
btnReset = env->addButton(rect<s32>(0, 450 * yScale , 110 * xScale, 500 * yScale), wCmdMenu, BUTTON_CMD_RESET, dataManager.GetSysString(1162));
btnReset = env->addButton(rect<s32>(0, 540 * yScale , 150 * xScale, 600 * yScale), wCmdMenu, BUTTON_CMD_RESET, dataManager.GetSysString(1162));
ChangeToIGUIImageButton(btnReset, imageManager.tButton_S, imageManager.tButton_S_pressed);
//deck edit
wDeckEdit = env->addWindow(rect<s32>(309 * xScale, 1 * yScale, 605 * xScale, 130 * yScale), false, L"");
......@@ -994,10 +994,10 @@ bool Game::Initialize(ANDROID_APP app, android::InitOptions *options) {
env->addStaticText(dataManager.GetSysString(1324), rect<s32>(10 * xScale, 74 * yScale, 80 * xScale, 94 * yScale), false, false, wFilter);
ebStar = CAndroidGUIEditBox::addAndroidEditBox(L"", true, env, rect<s32>(60 * xScale, (60 + 100 / 6) * yScale, 100 * xScale, (80 + 100 / 6) * yScale), wFilter, EDITBOX_INPUTS);
ebStar->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
env->addStaticText(dataManager.GetSysString(1336), rect<s32>(101 * xScale, (62 + 100 / 6) * yScale, 150 * xScale, (82 + 100 / 6) * yScale), false, false, wFilter);
env->addStaticText(dataManager.GetSysString(1336), rect<s32>(101 * xScale, (60 + 100 / 6) * yScale, 150 * xScale, (82 + 100 / 6) * yScale), false, false, wFilter);
ebScale = CAndroidGUIEditBox::addAndroidEditBox(L"", true, env, rect<s32>(150 * xScale, (60 + 100 / 6) * yScale, 190 * xScale, (80 + 100 / 6) * yScale), wFilter, EDITBOX_INPUTS);
ebScale->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
env->addStaticText(dataManager.GetSysString(1325), rect<s32>(205 * xScale, (62 + 100 / 6) * yScale, 280 * xScale, (82 + 100 / 6) * yScale), false, false, wFilter);
env->addStaticText(dataManager.GetSysString(1325), rect<s32>(205 * xScale, (60 + 100 / 6) * yScale, 280 * xScale, (82 + 100 / 6) * yScale), false, false, wFilter);
ebCardName = CAndroidGUIEditBox::addAndroidEditBox(L"", true, env, rect<s32>(260 * xScale, 72 * yScale, 390 * xScale, 92 * yScale), wFilter, EDITBOX_KEYWORD);
ebCardName->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
btnEffectFilter = env->addButton(rect<s32>(345 * xScale, 28 * yScale, 390 * xScale, 69 * yScale), wFilter, BUTTON_EFFECT_FILTER, dataManager.GetSysString(1326));
......@@ -1732,7 +1732,7 @@ void Game::LoadConfig() {
gameConf._init = TRUE;
gameConf.antialias = 1;
gameConf.serverport = 7911;
gameConf.textfontsize = 25;
gameConf.textfontsize = android::getIntSetting(appMain, "textfontsize", 18);;
gameConf.nickname[0] = 0;
gameConf.gamename[0] = 0;
BufferIO::DecodeUTF8(android::getLastCategory(appMain).c_str(), wstr);;
......@@ -1785,6 +1785,7 @@ void Game::LoadConfig() {
}
void Game::SaveConfig() {
android::saveIntSetting(appMain, "textfontsize", gameConf.textfontsize);
//helper
gameConf.chkMAutoPos = chkMAutoPos->isChecked() ? 1 : 0;
android::saveIntSetting(appMain, "chkMAutoPos", gameConf.chkMAutoPos);
......@@ -1894,15 +1895,15 @@ void Game::ShowCardInfo(int code) {
}
stDataInfo->setText(formatBuffer);
stSetName->setRelativePosition(rect<s32>(10 * xScale, 83 * yScale, 250 * xScale, 106 * yScale));
stText->setRelativePosition(rect<s32>(10 * xScale, (83 + offset) * yScale, 250 * xScale, 345 * yScale));
scrCardText->setRelativePosition(rect<s32>(238 * xScale, (83 + offset) * yScale, 258 * xScale, 345 * yScale));
stText->setRelativePosition(rect<s32>(10 * xScale, (83 + offset) * yScale, 260 * xScale, 345 * yScale));
scrCardText->setRelativePosition(rect<s32>(255 * xScale, (83 + offset) * yScale, 258 * xScale, 345 * yScale));
} else {
myswprintf(formatBuffer, L"[%ls]", dataManager.FormatType(cd.type));
stInfo->setText(formatBuffer);
stDataInfo->setText(L"");
stSetName->setRelativePosition(rect<s32>(10 * xScale, 60 * yScale, 250 * xScale, 106 * yScale));
stText->setRelativePosition(rect<s32>(10 * xScale, (60 + offset) * yScale, 250 * xScale, 345 * yScale));
scrCardText->setRelativePosition(rect<s32>(238 * xScale, (60 + offset) * yScale, 258 * xScale, 345 * yScale));
stText->setRelativePosition(rect<s32>(10 * xScale, (60 + offset) * yScale, 260 * xScale, 345 * yScale));
scrCardText->setRelativePosition(rect<s32>(255 * xScale, (60 + offset) * yScale, 258 * xScale, 345 * yScale));
}
showingtext = dataManager.GetText(code);
const auto& tsize = stText->getRelativePosition();
......@@ -1999,7 +2000,7 @@ void Game::ErrorLog(const char* msg) {
fclose(fp);
}
void Game::addMessageBox(const wchar_t* caption, const wchar_t* text) {
SetStaticText(stSysMessage, 370 * xScale, textFont, text);
SetStaticText(stSysMessage, 370 * xScale, guiFont, text);
wSysMessage->setVisible(true);
wSysMessage->getParent()->bringToFront(wSysMessage);
//env->setFocus(wSysMessage);
......
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