UTLauncher::UTLauncher(int& argc, char** argv) : QApplication(argc, argv), settings(QSettings::IniFormat, QSettings::UserScope, "CodeCharm", "UTLauncher"), bootstrap(settings), systemTray(QIcon(":/icon.png")) { QPixmap pixmap(":/splash.jpg"); splash = new UTSplash(pixmap); awesome = new QtAwesome(qApp); awesome->initFontAwesome(); awesome->setDefaultOption( "color" , iconColor() ); awesome->setDefaultOption( "color-active" , iconColor() ); awesome->setDefaultOption( "color-selected" , iconColor() ); splash->setGeometry( QStyle::alignedRect( Qt::LeftToRight, Qt::AlignCenter, splash->size(), qApp->desktop()->availableGeometry() )); settings.setValue("FirstRun", false); settings.sync(); bootstrap.start(); connect(&bootstrap, &Bootstrap::message, [=](QString msg) { splash->showMessage(msg); }); connect(&bootstrap, &Bootstrap::ready, this, &UTLauncher::prepareConfig); browser = new ServerBrowser(); connect(&bootstrap, &Bootstrap::serversInfo, this, &UTLauncher::gotServersInfo, Qt::QueuedConnection ); splash->showMessage("Getting version information..."); if(!settings.value("StartMinimized", false).toBool()) { splash->show(); } }
int CDODDeathStatsPanel::DrawDeathNoticeItem( int x, int y ) { // Get the team numbers for the players involved int iKillerTeam = TEAM_UNASSIGNED; int iVictimTeam = TEAM_UNASSIGNED; if( g_PR ) { iKillerTeam = g_PR->GetTeam( m_DeathRecord.Killer.iEntIndex ); iVictimTeam = g_PR->GetTeam( m_DeathRecord.Victim.iEntIndex ); } wchar_t victim[ 256 ]; wchar_t killer[ 256 ]; g_pVGuiLocalize->ConvertANSIToUnicode( m_DeathRecord.Victim.szName, victim, sizeof( victim ) ); g_pVGuiLocalize->ConvertANSIToUnicode( m_DeathRecord.Killer.szName, killer, sizeof( killer ) ); // Get the local position for this notice int len = UTIL_ComputeStringWidth( m_hTextFont, victim ); int iconWide; int iconTall; CHudTexture *icon = m_DeathRecord.iconDeath; Assert( icon ); if ( !icon ) return 0; if( icon->bRenderUsingFont ) { iconWide = surface()->GetCharacterWidth( icon->hFont, icon->cCharacterInFont ); iconTall = surface()->GetFontTall( icon->hFont ); } else { float scale = GetScale( icon->Width(), icon->Height(), XRES(cl_deathicon_width.GetInt()), YRES(cl_deathicon_height.GetInt()) ); iconWide = (int)( scale * (float)icon->Width() ); iconTall = (int)( scale * (float)icon->Height() ); } int spacerX = XRES(5); //int x = xRight - len - spacerX - iconWide - XRES(10); surface()->DrawSetTextFont( m_hTextFont ); int iFontTall = vgui::surface()->GetFontTall( m_hTextFont ); int yText = y + ( iconTall - iFontTall ) / 2; int boxWidth = len + iconWide + spacerX; int boxHeight = min( iconTall, m_flLineHeight ); int boxBorder = XRES(2); // Only draw killers name if it wasn't a suicide if ( !m_DeathRecord.bSuicide ) { int nameWidth = UTIL_ComputeStringWidth( m_hTextFont, killer ) + spacerX; // gap //x -= nameWidth; boxWidth += nameWidth; Panel::DrawBox( x-boxBorder, y-boxBorder, boxWidth+2*boxBorder, boxHeight+2*boxBorder, m_ActiveBackgroundColor, 1.0 ); Color c = g_PR->GetTeamColor( iKillerTeam ); surface()->DrawSetTextColor( c ); // Draw killer's name surface()->DrawSetTextPos( x, yText ); const wchar_t *p = killer; while ( *p ) { surface()->DrawUnicodeChar( *p++ ); } surface()->DrawGetTextPos( x, yText ); x += spacerX; } else { Panel::DrawBox( x-boxBorder, y-boxBorder, boxWidth+2*boxBorder, boxHeight+2*boxBorder, m_ActiveBackgroundColor, 1.0 ); } Color iconColor( 255, 80, 0, 255 ); // Draw death weapon //If we're using a font char, this will ignore iconTall and iconWide icon->DrawSelf( x, y, iconWide, iconTall, iconColor ); x += iconWide + spacerX; Color c = g_PR->GetTeamColor( iVictimTeam ); surface()->DrawSetTextColor( c ); // Draw victims name surface()->DrawSetTextFont( m_hTextFont ); //reset the font, draw icon can change it surface()->DrawSetTextPos( x, yText ); const wchar_t *p = victim; while ( *p ) { surface()->DrawUnicodeChar( *p++ ); } return boxWidth; }
void ButtonContact::onRender( RenderContext & context, const RectInt & window ) { WindowButton::onRender( context, window ); DisplayDevice * pDisplay = context.display(); ASSERT( pDisplay ); GameDocument * pDoc = (GameDocument *)document(); ASSERT( pDoc ); NounShip * pShip = pDoc->ship(); if (! pShip ) return; WindowStyle * pStyle = windowStyle(); ASSERT( pStyle ); Font * pFont = pStyle->font(); ASSERT( pFont ); // get a pointer to our gadget Noun * pContact = m_Noun; if (! pContact ) return; RectInt iconBox( PointInt( window.left, window.top ), SizeInt( 16, 16 ) ); Color iconColor( YELLOW ); if ( pShip->isFriend( pContact ) ) iconColor = GREEN; else if ( pShip->isEnemy( pContact ) ) iconColor = RED; // draw the gadget icon Material::push( context, m_Icon ); PrimitiveWindow::push( pDisplay, iconBox, WINDOW_UV, iconColor ); if ( WidgetCast<NounShip>( pContact ) && ((NounShip *)pContact)->canOrder( pShip ) ) { Material::push( context, WidgetCast<Material>( resource("team") ) ); iconBox += PointInt( 16, 0 ); PrimitiveWindow::push( pDisplay, iconBox, WINDOW_UV, WHITE ); } else if ( m_IsObjective ) { Material::push( context, WidgetCast<Material>( resource("objective") ) ); iconBox += PointInt( 16, 0 ); PrimitiveWindow::push( pDisplay, iconBox, WINDOW_UV, WHITE ); } // display status text CharString sStatus = pContact->displayName( false ); if ( m_HotKey != 0 ) sStatus = CharString().format("%c:%s", m_HotKey, sStatus ); if ( sStatus.length() > 0 ) { SizeInt stringSize( pFont->size( sStatus ) ); // make sure the text fits on the label while( stringSize.width > (BUTTON_WIDTH - 5 ) ) { // remove the right most character and check the width again sStatus.left( sStatus.length() - 1 ); stringSize = pFont->size( sStatus ); } PointInt stringPos( window.m_Right - stringSize.width, window.m_Bottom - stringSize.height ); Font::push( pDisplay, pFont, stringPos, sStatus, m_bGroupLeader ? YELLOW : (m_bGroupPending ? GREY : WHITE) ); } // display the damage bar if ( WidgetCast<NounShip>( pContact ) ) { if ( ((NounShip *)pContact)->damage() > 0 ) { float damage = ((NounShip *)pContact)->damageRatioInv(); RectInt bar( window.m_Left, window.m_Bottom + 1, window.m_Right - (window.width() * (1.0f - damage)), window.m_Bottom + 3 ); Color barColor( 255 * (1.0f - damage), 255 * damage,0,255 ); PrimitiveMaterial::push( pDisplay, PrimitiveMaterial::NONE ); PrimitiveWindow::push( pDisplay, bar, WINDOW_UV, barColor ); } } // render additional border if this contact is our current target if ( pDoc->rootTarget() == m_Noun && (pDoc->tick() % 10) < 6 ) renderGlow( context ); }