Commit 97dd3221 authored by fallenstardust's avatar fallenstardust

添加图标活动文字用于显示点数和限制数字

parent a83f02ad
......@@ -1527,40 +1527,31 @@ void Game::DrawThumb(code_pointer cp, irr::core::vector2di pos, const LFList* lf
if (lfit != lflist->content.end()) {
switch(lfit->second) {
case 0:
driver->draw2DImage(imageManager.tLim, limitloc, irr::core::recti(0, 0, 64, 64), 0, 0, true);
driver->draw2DImage(imageManager.tLimit, limitloc, irr::core::recti(0, 0, 64, 64), 0, 0, true);
break;
case 1:
driver->draw2DImage(imageManager.tLim, limitloc, irr::core::recti(64, 0, 128, 64), 0, 0, true);
driver->draw2DImage(imageManager.tLimit, limitloc, irr::core::recti(64, 0, 128, 64), 0, 0, true);
icFont->drawUstring(L"1", limitloc, 0xffffff00, true, true);
break;
case 2:
driver->draw2DImage(imageManager.tLim, limitloc, irr::core::recti(0, 64, 64, 128), 0, 0, true);
driver->draw2DImage(imageManager.tLimit, limitloc, irr::core::recti(64, 0, 128, 64), 0, 0, true);
icFont->drawUstring(L"2", limitloc, 0xffffff00, true, true);
break;
}
}
auto current_limitloc = limitloc;
auto credit_max_display = CARD_THUMB_WIDTH / 20;
auto next_limitloc = [&]() {
auto this_limitloc = current_limitloc;
auto width = current_limitloc.getWidth();
current_limitloc.UpperLeftCorner.X += width;
current_limitloc.LowerRightCorner.X += width;
--credit_max_display;
return this_limitloc;
};
auto lfcredit = lflist->credits.find(lcode);
if(lfcredit != lflist->credits.end()) {
for(auto& credit_entry : lfcredit->second) {
if(credit_max_display <= 0)
if (credit_max_display <= 0)
break;
auto value = credit_entry.second;
if(value > 0 && value <= 100) {
auto cvalue = value - 1; // 1-100 => 0-99
// pick the first and second digit
auto digit1 = cvalue / 10;
auto digit2 = cvalue % 10;
auto credit_texture_offset_x = digit2 * 64;
auto credit_texture_offset_y = digit1 * 64;
driver->draw2DImage(imageManager.tLimCredit, next_limitloc(), irr::core::recti(credit_texture_offset_x, credit_texture_offset_y, credit_texture_offset_x + 64, credit_texture_offset_y + 64), 0, 0, true);
driver->draw2DImage(imageManager.tLimit, limitloc, irr::core::recti(0, 64, 64, 128), 0, 0, true);
if (value > -10 || value < 100) {
adFont->drawUstring(std::to_wstring(static_cast<int>(value)), limitloc, 0xff00ffff, true, true);
} else {
miniFont->drawUstring(std::to_wstring(static_cast<int>(value)), limitloc, 0xff00ffff, true, true);
}
}
}
......
......@@ -350,6 +350,8 @@ bool Game::Initialize(ANDROID_APP app, irr::android::InitOptions *options) {
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);
miniFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, 10 * yScale, isAntialias, true);
icFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, 14 * yScale, isAntialias, true);
// 检查字体创建是否成功
if(!numFont || !guiFont) {
ALOGW("cc game: add font fail ");
......
......@@ -330,6 +330,8 @@ public:
irr::gui::CGUITTFont* adFont;
irr::gui::CGUITTFont* lpcFont;
irr::gui::CGUITTFont* titleFont;
irr::gui::CGUITTFont* miniFont;
irr::gui::CGUITTFont* icFont;
std::map<irr::gui::CGUIImageButton*, int> imageLoading;
//card image
irr::gui::IGUIStaticText* wCardImg;
......
......@@ -36,6 +36,7 @@ bool ImageManager::Initial(const path dir) {
tChainTarget = driver->getTexture((dir + path("/textures/chaintarget.png")).c_str());
tLim = driver->getTexture((dir + path("/textures/lim.png")).c_str());
tLimCredit = driver->getTexture((dir + path("/textures/lim_credit.png")).c_str());
tLimit = driver->getTexture((dir + path("/textures/icon_lim.png")).c_str());
tOT = driver->getTexture((dir + path("/textures/ot.png")).c_str());
tHand[0] = driver->getTexture((dir + path("/textures/f1.jpg")).c_str());
tHand[1] = driver->getTexture((dir + path("/textures/f2.jpg")).c_str());
......
......@@ -48,6 +48,7 @@ public:
irr::video::ITexture* tChainTarget;
irr::video::ITexture* tLim;
irr::video::ITexture* tLimCredit;
irr::video::ITexture* tLimit;
irr::video::ITexture* tOT;
irr::video::ITexture* tHand[3];
irr::video::ITexture* tBackGround;
......
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