Commit c915371c authored by fallenstardust's avatar fallenstardust

设置字体大小

但刷新出来有延迟
parent e256e800
......@@ -218,7 +218,10 @@ public:
virtual void setMaxPageTextureSize(const core::dimension2du& texture_size) {
max_page_texture_size = texture_size;
}
//! Set the font size.
virtual void setFontSize(u32 new_size) {
size = new_size;
}
//! Get the font size.
virtual u32 getFontSize() const {
return size;
......
......@@ -1471,7 +1471,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int desc = BufferIO::ReadInt32(pbuf);
mainGame->dField.highlighting_card = 0;
mainGame->gMutex.lock();
mainGame->SetStaticText(mainGame->stQMessage, 390 * mainGame->xScale, mainGame->textFont, dataManager.GetDesc(desc));
mainGame->SetStaticText(mainGame->stQMessage, 390 * mainGame->xScale, mainGame->guiFont, dataManager.GetDesc(desc));
mainGame->PopupElement(mainGame->wQuery);
mainGame->gMutex.unlock();
return false;
......
......@@ -226,11 +226,29 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break;
}
case BUTTON_REDUCE_CARD_TEXT: {
if (mainGame->gameConf.textfontsize < 24) {
mainGame->btnEnlargeCardText->setEnabled(true);
if (mainGame->gameConf.textfontsize = 16)
mainGame->btnReduceCardText->setEnabled(false);
} else {
mainGame->gameConf.textfontsize = mainGame->gameConf.textfontsize - 2;
mainGame->textFont->setFontSize(mainGame->gameConf.textfontsize * mainGame->yScale);
const auto& tsize = mainGame->stText->getRelativePosition();
mainGame->InitStaticText(mainGame->stText, tsize.getWidth(), tsize.getHeight(), mainGame->textFont, mainGame->showingtext);
}
break;
}
case BUTTON_ENLARGE_CARD_TEXT: {
if(mainGame->gameConf.textfontsize = 24) {
mainGame->btnEnlargeCardText->setEnabled(false);
if (mainGame->gameConf.textfontsize > 16)
mainGame->btnReduceCardText->setEnabled(true);
} else {
mainGame->gameConf.textfontsize = mainGame->gameConf.textfontsize + 2;
mainGame->textFont->setFontSize(mainGame->gameConf.textfontsize * mainGame->yScale);
const auto& tsize = mainGame->stText->getRelativePosition();
mainGame->InitStaticText(mainGame->stText, tsize.getWidth(), tsize.getHeight(), mainGame->textFont, mainGame->showingtext);
}
break;
}
case BUTTON_CHAIN_IGNORE: {
......
......@@ -110,13 +110,10 @@ bool Game::Initialize(ANDROID_APP app, android::InitOptions *options) {
params.ZBufferBits = 16;
params.AntiAlias = 0;
params.WindowSize = irr::core::dimension2d<u32>(0, 0);
#endif
device = irr::createDeviceEx(params);
if(!device)
return false;
#ifdef _IRR_ANDROID_PLATFORM_
if (!android::perfromTrick(app)) {
return false;
}
......@@ -496,8 +493,8 @@ bool Game::Initialize(ANDROID_APP app, android::InitOptions *options) {
scrCardText->setLargeStep(1);
scrCardText->setSmallStep(1);
scrCardText->setVisible(false);
btnReduceCardText = env->addButton(rect<s32>(140 * yScale, 345 * yScale, 165 * yScale, 370 * yScale), wInfos, BUTTON_REDUCE_CARD_TEXT, L"A-");
btnEnlargeCardText = env->addButton(rect<s32>(175 * yScale, 345 * yScale, 200 * yScale, 370 * yScale), wInfos, BUTTON_ENLARGE_CARD_TEXT, L"A+");
btnReduceCardText = env->addButton(rect<s32>(140 * yScale, 340 * yScale, 165 * yScale, 365 * yScale), wInfos, BUTTON_REDUCE_CARD_TEXT, L"A-");
btnEnlargeCardText = env->addButton(rect<s32>(175 * yScale, 340 * yScale, 200 * yScale, 365 * yScale), wInfos, BUTTON_ENLARGE_CARD_TEXT, L"A+");
//imageButtons pallet
wPallet = env->addWindow(rect<s32>(262 * xScale, 275 * yScale, 307 * xScale, 639 * yScale), false, L"");
wPallet->getCloseButton()->setVisible(false);
......@@ -1406,12 +1403,6 @@ void Game::MainLoop() {
DrawGUI();
DrawSpec();
driver->enableMaterial2D(false);
#else
} else {
DrawBackImage(imageManager.tBackGround_menu);
}
DrawGUI();
DrawSpec();
#endif
gMutex.unlock();
#ifdef _IRR_ANDROID_PLATFORM_
......@@ -1447,15 +1438,6 @@ void Game::MainLoop() {
str += (s32)device->getVideoDriver()->getFPS();
stat->setText ( str.c_str() );
}
#else
if(cur_time < fps * 17 - 20)
#ifdef _WIN32
Sleep(20);
#else
usleep(20000);
#endif
myswprintf(cap, L"FPS: %d", fps);
device->setWindowCaption(cap);
#endif
fps = 0;
cur_time -= 1000;
......@@ -1473,11 +1455,8 @@ void Game::MainLoop() {
DuelClient::StopClient(true);
if(dInfo.isSingleMode)
SingleMode::StopPlay(true);
#ifdef _WIN32
Sleep(500);
#else
usleep(500000);
#endif
SaveConfig();
usleep(500000);
// device->drop();
......@@ -1519,7 +1498,7 @@ void Game::InitStaticText(irr::gui::IGUIStaticText* pControl, u32 cWidth, u32 cH
env->removeFocus(scrCardText);
return;
}
format_text = SetStaticText(pControl, cWidth - int(25 * xScale), font, text);
format_text = SetStaticText(pControl, cWidth - int(15 * xScale), font, text);
u32 fontheight = font->getDimension(L"A").Height + font->getKerningHeight();
u32 step = (font->getDimension(format_text.c_str()).Height - cHeight) / fontheight + 1;
scrCardText->setVisible(true);
......
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