void BroadcastConsole::OnMsgRecv(const std::string& str) { // Discard if same as last msg if (!m_texts.empty()) { if (m_texts[0]->GetText() == str) { std::cout << "Discarding duplicate msg\n"; return; } } GuiText* text = new GuiText; text->SetIsMulti(true); text->SetTextSize(1.0f); // TODO CONFIG text->SetSize(Vec2f(2.0f, 0.1f)); // assume single line text->SetText(str); text->SizeToText(); text->SetFgCol(Colour(1, 1, 0, 1)); m_texts.push_front(text); static const unsigned int NUM_LINES = ROConfig()->GetInt("chat-max-lines", 10); if (m_texts.size() > NUM_LINES) { m_texts.pop_back(); } ReposText(); }
void GSMain::Draw2d() { AmjuGL::Viewport(0, 0, Screen::X(), Screen::Y()); TheHud::Instance()->Draw(); // Store scaled modelview matrix float mat[16]; AmjuGL::GetMatrix(AmjuGL::AMJU_MODELVIEW_MATRIX, mat); // Split screen -- draw all screens int numVps = TheViewportManager::Instance()->GetNumViewports(); for (int i = 0; i < numVps; i++) { AmjuGL::SetMatrixMode(AmjuGL::AMJU_MODELVIEW_MATRIX); AmjuGL::SetIdentity(); // Restore scaled mv matrix AmjuGL::MultMatrix(mat); TheViewportManager::Instance()->GetViewport(i)->Draw2d(); } m_gui->Draw(); // split screen line etc TheLurker::Instance()->Draw(); #ifdef GEKKO TheCursorManager::Instance()->Draw(); #endif #ifdef SHOW_INFO // TODO Switch on/off if (true) { static GuiText t; t.SetFgCol(Colour(1, 1, 1, 1)); t.SetBgCol(Colour(0, 0, 0, 1)); t.SetDrawBg(true); t.SetFontSize(0.8f); // TODO CONFIG t.SetIsMulti(true); t.SetLocalPos(Vec2f(-1.0f, -0.8f)); t.SetSize(Vec2f(1.0f, 0.2f)); t.SetJust(GuiText::AMJU_JUST_LEFT); float playerX = Player::GetPlayer(AMJU_P1)->GetPos().x; static std::string old; std::string s = "Depth: " + ToString((int)GetCurrentDepth()) + " X: " + ToString((int)playerX) + "\nNum Game Objects: " + ToString((int)TheGame::Instance()->GetGameObjects()->size()); if (old != s) { t.SetText(s); } old = s; t.Draw(); } #endif // SHOW_INFO }
void LurkMsg::Set(const std::string& str, const Colour& fgCol, const Colour& bgCol, LurkPos lp, CommandFunc onFinished) { GuiText* text = new GuiText; if (lp == AMJU_CENTRE) { text->SetIsMulti(true); } text->SetTextSize(1.5f); // TODO CONFIG text->SetSize(Vec2f(1.6f, 0.1f)); // assume single line text->SetText(str); text->SizeToText(); text->SetFgCol(fgCol); Set(text, fgCol, bgCol, lp, onFinished); }