void PostGameScene::onGoalListUpdate(IEventData::Ptr p_Data) { std::shared_ptr<FinishRaceEventData> data = std::static_pointer_cast<FinishRaceEventData>(p_Data); const auto& goalList = data->getGoalList(); std::string playerNameText; std::wstring playerTimeText; for (const auto& goalEntry : goalList) { int minutes = (int)goalEntry.second / 60; float seconds = goalEntry.second - minutes * 60; wchar_t buffer[64]; std::swprintf(buffer, L" %02.2d" L"\x2009" L":" L"\x2009" L"%06.3f\n", minutes, seconds); playerNameText += " " + goalEntry.first + '\n'; playerTimeText += buffer; } if (!playerNameText.empty()) { playerNameText = playerNameText.substr(0, playerNameText.length() - 1); } if (!playerNameText.empty()) { playerTimeText = playerTimeText.substr(0, playerTimeText.length() - 1); } std::vector<wchar_t> wText(playerNameText.length() + 1); mbstowcs(wText.data(), playerNameText.data(), playerNameText.length() + 1); m_Graphics->updateText(m_PlayerNamesText, wText.data()); m_Graphics->updateText(m_PlayerTimesText, playerTimeText.data()); }
void GuiTooltip::SetColor(GXColor c) { color = c; if(text) { wString wText(text->GetText()); SetText(wText.toUTF8().c_str()); } }
void GuiTooltip::SetFontSize(int size) { FontSize = size; if(text) { wString wText(text->GetText()); SetText(wText.toUTF8().c_str()); } }
void MapTreeView::AddItem(int id, HTREEITEM parent, const std::string& text) { TV_INSERTSTRUCT tvInsertStruct; ::ZeroMemory(&tvInsertStruct, sizeof(tvInsertStruct)); tvInsertStruct.hInsertAfter = TVI_LAST; tvInsertStruct.hParent = parent; tvInsertStruct.item.mask = TVIF_TEXT | TVIF_PARAM; Util::WideCharArray wText(text); tvInsertStruct.item.pszText = wText.GetPtr(); tvInsertStruct.item.lParam = id; HTREEITEM treeItem = TreeView_InsertItem(this->handle, &tvInsertStruct); assert(this->treeItems.find(id) == this->treeItems.end()); this->treeItems.insert(TreeItems::value_type(id, treeItem)); }
void UpgradeCheckerGUI::outputText(QString text, bool noLineFeed) { QTextBrowser* w=m_outputWidget; if (w) { QString wText(w->toPlainText()); wText.replace("\n","<br>"); wText.remove("<qt>"); wText.remove("</qt>"); if (noLineFeed) w->setHtml("<qt>"+wText+text+"</qt>"); else w->setHtml("<qt>"+wText+text+"<br>"+"</qt>"); } }