//----------------------------------------------------------------------------- // Purpose: Label paint functions - take into account current highligh status //----------------------------------------------------------------------------- void CLabelHeader::paintBackground() { Color oldBg; getBgColor(oldBg); if (gViewPort->GetScoreBoard()->m_iHighlightRow == _row) { setBgColor(134, 91, 19, 0); } Panel::paintBackground(); setBgColor(oldBg); }
SODOctopus::SODOctopus(Panel* container, GridOctopus* gridO, Spell* s, SpellTarget* target) : OctopusBaby(int(gridO->getCellDimensions().x*1.5), int(gridO->getCellDimensions().y*5)), _grid(gridO), _spell(s), _target(target) { Texture t = (*ServiceLocator::getTextureManager())["SwordDestiny"]; Point d = gridO->getCellDimensions() * 3; // compute ratio double ratiox = (double)d.x / t.getWidth(); double ratioy = (double)d.y / t.getHeight(); ratio = min(ratioy, ratiox); unsigned int n = target->getCell()->getNumber(); Point cellCenter = gridO->getCellCenter(n); width = int(t.getWidth() * ratio); height = int(t.getHeight() * ratio); container->add(this); Point pos = toContainerCoordinates(gridO->toAbsoluteCoordinates(Point(cellCenter.x - width / 2, cellCenter.y - height - d.y/3))); ori_pos = pos; dst_pos = toContainerCoordinates(gridO->toAbsoluteCoordinates(Point(cellCenter.x - width / 2, cellCenter.y - height))); setPositionX((int)pos.x); setPositionY((int)pos.y); setBgColor(Color::TRANSPARENT); setActive(true); beginTime = TIMESERVICE->time(); finishTime = beginTime + totalTime; setZIndex(gridO->getZIndexFromCell(n) + 1); }
PlayerOctopus::PlayerOctopus(Character* c, GridOctopus* grid) : OctopusBaby(PLAYER_WIDTH, PLAYER_HEIGHT), _character(c), _grid(grid), destination_cell(_character->getCell()) { if (!_basic_player.valid()) { _basic_player = (*ServiceLocator::getTextureManager())["knight"]; // compute ratio double ratiox = (double)_relative_rect.w / _basic_player.getWidth(); double ratioy = (double)_relative_rect.h / _basic_player.getHeight(); _ratio = min(ratioy, ratiox); // calculate padding int xpadding = -5; int ypadding = 7; PADDINGFaceLeft = Point(-_basic_player.getWidth() * _ratio / 2 + xpadding, -_basic_player.getHeight() * _ratio + ypadding); PADDINGFaceRight = Point(PADDINGFaceLeft.x -2*xpadding, PADDINGFaceLeft.y); } setBgColor(Color::TRANSPARENT); // event registration EventService* evs = EVENTSERVICE; evs->listen(typeid(MoveEvent), [=](Event* e) { MoveEvent* ev = dynamic_cast<MoveEvent*>(e); if (ev && ev->getCharacter() == _character) addMove(ev->destination, ev->move_wanted); } ); }
void Graph::loadData(DataFileParser *file) { // background color if(file->seekToNextBlock("graphWBgColor", BLOCK_WIDGET)) setBgColor(QColor(file->readString())); // markers if(file->seekToNextBlock("graphWMarkersX", BLOCK_WIDGET)) loadMarkers(file, QwtPlot::xBottom); if(file->seekToNextBlock("graphWMarkersY", BLOCK_WIDGET)) loadMarkers(file, QwtPlot::yLeft); if(file->seekToNextBlock("graphWMarkersYRight", BLOCK_WIDGET)) loadMarkers(file, QwtPlot::yRight); // axes if(file->seekToNextBlock("graphWAxisRangeV2", BLOCK_WIDGET)) { const quint32 cnt = file->readVal<quint32>(); for(quint32 i = 0; i < cnt; ++i) { double lower = file->readVal<double>(); double upper = file->readVal<double>(); setAxisScale(i, lower, upper); } } replot(); }
GraphDisplay::GraphDisplay() : Display(), minData(), maxData(), absoluteToGraphUnits(), graphToAbsoluteUnits(), gProps(GraphProps::NONE), fixedWidth(false), fixedHeight(false), flipX(false), flipY(false), standardUnitSize() { setBgColor(Color(0.75f, 0.75f, 0.75f, 1.0f)); }
FeTextPrimative::FeTextPrimative( ) : m_texts( 1, sf::Text() ), m_align( Centre ), m_first_line( -1 ), m_needs_pos_set( false ) { setColor( sf::Color::White ); setBgColor( sf::Color::Transparent ); }
Node::Node(QWidget * parent) : QObject(parent), QGraphicsItem() { setTextColor(Qt::darkGreen); setOutlineColor(Qt::darkBlue); setBgColor(Qt::white); setFlags(ItemIsMovable | ItemIsSelectable | ItemSendsGeometryChanges); }
TtipMelody::TtipMelody(TquestionPoint *point) : TtipChart(point) { setBgColor(point->color()); setPlainText(" "); m_w = new QWidget(); m_w->setObjectName("m_melodyView"); m_w->setStyleSheet("QWidget#m_melodyView { background: transparent }"); QString txt; if (point->nr()) txt = QString(TquestionAsWdg::questionTxt() + " <big><b>%1.</b></big>").arg(point->nr()); if (point->question()->questionAsNote() && point->question()->answerAsSound()) txt += (" <b>" + TexTrans::playMelodyTxt() + "</b>"); else if (point->question()->questionAsSound() && point->question()->answerAsNote()) txt += (" <b>" + TexTrans::writeMelodyTxt() + "</b>"); QLabel *headLab = new QLabel(txt, m_w); headLab->setAlignment(Qt::AlignCenter); m_score = new TmelodyView(qa()->question()->melody(), m_w); m_score->setFixedHeight(qApp->desktop()->availableGeometry().height() / 12); if (point->question()->exam()) { if (point->question()->exam()->level()->showStrNr) m_score->showStringNumbers(true); } QSpinBox *spinAtt = new QSpinBox(m_w); spinAtt->setRange(0, qa()->question()->attemptsCount()); spinAtt->setPrefix(TexTrans::attemptTxt() + " "); spinAtt->setSuffix(" " + tr("of", "It will give text: 'Attempt x of y'") + QString(" %1").arg(qa()->question()->attemptsCount())); m_attemptLabel = new QLabel(m_w); m_resultLabel = new QLabel(wasAnswerOKtext(point->question(), point->color()).replace("<br>", " "), m_w); m_resultLabel->setAlignment(Qt::AlignCenter); // txt = wasAnswerOKtext(point->question(), point->color()).replace("<br>", " ") + "<br>"; txt = tr("Melody was played <b>%n</b> times", "", qa()->question()->totalPlayBacks()) + "<br>"; txt += TexTrans::effectTxt() + QString(": <big><b>%1%</b></big>, ").arg(point->question()->effectiveness(), 0, 'f', 1, '0'); txt += TexTrans::reactTimeTxt() + QString("<big><b> %1</b></big>").arg(Texam::formatReactTime(point->question()->time, true)); QLabel *sumLab = new QLabel(txt, m_w); sumLab->setAlignment(Qt::AlignCenter); QVBoxLayout *lay = new QVBoxLayout; lay->addWidget(headLab); lay->addWidget(m_score, 0, Qt::AlignCenter); QHBoxLayout *attLay = new QHBoxLayout; attLay->addStretch(); attLay->addWidget(spinAtt); attLay->addStretch(); lay->addLayout(attLay); lay->addWidget(m_attemptLabel); lay->addWidget(m_resultLabel); lay->addWidget(sumLab); m_w->setLayout(lay); m_widget = point->scene()->addWidget(m_w); m_widget->setParentItem(this); connect(spinAtt, SIGNAL(valueChanged(int)), this, SLOT(attemptChanged(int))); }
PlaneViewer::PlaneViewer(QWidget *parent) : QOpenGLWidget(parent) , m_firstResize(true) , m_xpos(0) , m_ypos(0) , m_aff() // initialized at the first resize , m_chessSize(40.0) { m_zoomRange[0] = 1e-3, m_zoomRange[1] = 1024.0; setBgColor(TPixel32(235, 235, 235), TPixel32(235, 235, 235)); }
//----------------------------------------------------------------------------- // Purpose: Create the ScoreBoard panel //----------------------------------------------------------------------------- ScorePanel::ScorePanel(int x,int y,int wide,int tall) : Panel(x,y,wide,tall) { setBorder( new LineBorder( Color(255 * 0.7,170 * 0.7,0,0) ) ); setBgColor( 0,0,0, 100 ); m_pTitleLabel = new Label( " SCORES", 0,0, wide, SBOARD_TITLE_SIZE_Y ); m_pTitleLabel->setBgColor( Scheme::sc_primary2 ); m_pTitleLabel->setFgColor( Scheme::sc_primary1 ); m_pTitleLabel->setContentAlignment( vgui::Label::a_west ); m_pTitleLabel->setParent(this); _headerPanel = new HeaderPanel( SBOARD_TABLE_X, SBOARD_TITLE_SIZE_Y, wide - (SBOARD_TABLE_X * 2), SBOARD_HEADER_SIZE_Y); _headerPanel->setParent(this); // BUGBUG: This isn't working. gHUD.m_Teamplay hasn't been initialized yet. if ( gHUD.m_Teamplay ) _headerPanel->addSectionPanel( new CLabelHeader( CHudTextMessage::BufferedLocaliseTextString( "#TEAMS" ), true) ); else _headerPanel->addSectionPanel( new CLabelHeader( CHudTextMessage::BufferedLocaliseTextString( "#PLAYERS" ), true) ); if ( HUD_IsGame( "tfc" ) ) _headerPanel->addSectionPanel( new CLabelHeader( CHudTextMessage::BufferedLocaliseTextString( "#CLASS" ), true) ); else _headerPanel->addSectionPanel( new CLabelHeader("", true) ); _headerPanel->addSectionPanel( new CLabelHeader( CHudTextMessage::BufferedLocaliseTextString( "#SCORE" )) ); _headerPanel->addSectionPanel( new CLabelHeader( CHudTextMessage::BufferedLocaliseTextString( "#DEATHS")) ); _headerPanel->addSectionPanel( new CLabelHeader( CHudTextMessage::BufferedLocaliseTextString( "#LATENCY")) ); _headerPanel->setBgColor( 0,0,0, 255 ); // Need to special case 400x300, because the titles just wont fit otherwise if ( ScreenWidth == 400 ) { _headerPanel->setSliderPos( 0, SMALL_CSIZE_NAME ); _headerPanel->setSliderPos( 1, SMALL_CSIZE_CLASS ); _headerPanel->setSliderPos( 2, SMALL_CSIZE_KILLS ); _headerPanel->setSliderPos( 3, SMALL_CSIZE_DEATHS ); _headerPanel->setSliderPos( 4, wide - (SBOARD_TABLE_X * 2) - 1 ); } else { _headerPanel->setSliderPos( 0, CSIZE_NAME ); _headerPanel->setSliderPos( 1, CSIZE_CLASS ); _headerPanel->setSliderPos( 2, CSIZE_KILLS ); _headerPanel->setSliderPos( 3, CSIZE_DEATHS ); _headerPanel->setSliderPos( 4, wide - (SBOARD_TABLE_X * 2) - 1 ); } _tablePanel = new ScoreTablePanel(SBOARD_TABLE_X, SBOARD_TABLE_Y, wide - (SBOARD_TABLE_X * 2), tall - SBOARD_TABLE_Y, NUM_COLUMNS); _tablePanel->setParent(this); _tablePanel->setHeaderPanel(_headerPanel); _tablePanel->setBgColor( 0,0,0, 255 ); Initialize(); }
void fillBg(FILE *f, int width, int height) { setBgColor(f); fprintf(f, "newpath\n"); fprintf(f, "%d %d moveto\n", 0, 0); fprintf(f, "%d %d lineto\n", width, 0); fprintf(f, "%d %d lineto\n", width, height); fprintf(f, "%d %d lineto\n", 0, height); fprintf(f, "%d %d lineto\n", 0, 0); fprintf(f, "closepath\n"); fprintf(f, "fill\n"); }
GraphDisplay::GraphDisplay(GPoint data_min, GPoint data_max, RVec absolute_to_graph, GVec standard_unit_size, GraphProps g_props) : Display(), minData(data_min), maxData(data_max), absoluteToGraphUnits(absolute_to_graph), graphToAbsoluteUnits(1.0f/absolute_to_graph.x, 1.0f/absolute_to_graph.y), gProps(g_props), fixedWidth(g_props & GraphProps::FIXED_WIDTH), fixedHeight(g_props & GraphProps::FIXED_HEIGHT), flipX(g_props & GraphProps::FLIP_X), flipY(g_props & GraphProps::FLIP_Y), standardUnitSize(standard_unit_size) { setBgColor(Color(0.75f, 0.75f, 0.75f, 1.0f)); onSizeChanged(AVec()); }
void MainWindow::handle(bool isBG) { if(isBG){ if(ui->isPencilCheckBox->isChecked()){ ui->pencilColorPushButton->setEnabled(true); ui->bgColorPushButton->setEnabled(false); }else{ ui->pencilColorPushButton->setEnabled(false); ui->bgColorPushButton->setEnabled(true); } } setPencilColor(); setBgColor(); }
void ColorBar::onPaletteIndexChange(int index) { m_lock = true; Color color = Color::fromIndex(index); if (jmouse_b(0) & 2) // TODO create a PaletteChangeEvent and take left/right mouse button from there setBgColor(color); else setFgColor(color); m_lock = false; }
Cell::Cell(QGraphicsItem *parent) : QGraphicsSvgItem(parent), mLayer(0), mStitch(0), mHighlight(false) { setCachingEnabled(false); setAcceptHoverEvents(true); setFlag(QGraphicsItem::ItemIsMovable); setFlag(QGraphicsItem::ItemIsSelectable); //if we don't set the bgColor it'll end up black. setBgColor(); }
StylesPlugin::StylesPlugin(unsigned base, const char *config) : Plugin(base) { m_saveBaseFont = NULL; m_saveMenuFont = NULL; m_savePalette = new QPalette(QApplication::palette()); load_data(stylesData, &data, config); setFonts(); if (getSystemColors()){ setBtnColor(m_savePalette->active().color(QColorGroup::Button).rgb() & 0xFFFFFF); setBgColor(m_savePalette->active().color(QColorGroup::Background).rgb() & 0xFFFFFF); }else{ setColors(); } setStyles(); }
void KopeteRichTextEditPart::setBgColor() { QColor col=mBgColor; int s = KColorDialog::getColor( col, KGlobalSettings::baseColor(), editor ); if(!col.isValid()) { col=KGlobalSettings::baseColor(); } if ( s != QDialog::Accepted ) return; setBgColor( col ); writeConfig(); }
TupPaintArea::TupPaintArea(TupProject *project, QWidget * parent) : TupPaintAreaBase(parent, project->dimension()), k(new Private) { #ifdef K_DEBUG T_FUNCINFO; #endif k->project = project; setBgColor(project->bgColor()); k->currentSceneIndex = 0; k->deleteMode = false; k->menuOn = false; setCurrentScene(0); k->currentTool = tr("Pencil"); if (graphicsScene()->scene()) graphicsScene()->setCurrentFrame(0, 0); }
VolleyOctopus::VolleyOctopus(Panel* container, GridOctopus * gridO, Spell* s, Character* caster, SpellTarget* target) : OctopusBaby(gridO->getRelativeRect().w, gridO->getRelativeRect().h), _grid(gridO), _target(target), _caster(caster) { Texture t = (*ServiceLocator::getTextureManager())["VoleeFlechesFrame1"]; Point d = gridO->getCellDimensions() * 5; // compute ratio double ratiox = (double)d.x / t.getWidth(); double ratioy = (double)d.y / t.getHeight(); ratio = min(ratioy, ratiox); container->add(this, gridO->getPosition().x, gridO->getPosition().y); setBgColor(Color::TRANSPARENT); setActive(false); beginTime = TIMESERVICE->time(); finishTime = beginTime + totalTime; }
FeTextPrimative::FeTextPrimative( const sf::Font *font, const sf::Color &colour, const sf::Color &bgcolour, unsigned int charactersize, Alignment align ) : m_texts( 1, sf::Text() ), m_align( align ), m_first_line( -1 ), m_needs_pos_set( false ) { if ( font ) setFont( *font ); setColor( colour ); setBgColor( bgcolour ); setCharacterSize( charactersize ); }
CharacterWidget::CharacterWidget(QWidget *parent, CharSetCharacter ch) : QWidget(parent), m_character(ch) { m_dobitshift = true; m_showgrid = true; // setMaximumSize(this->size()); // setMinimumSize(this->size()); m_pixmap = QPixmap(this->size()); setFgColor(Qt::black); setBgColor(Qt::white); setGridColor(Qt::red); QString name = QChar(ch.asciiVal()); if (ch.asciiVal() == ' ') { name = "<Space>"; } if (ch.asciiVal() == 0x7f) { name = "<Delete>"; } QString ttstring = QString("Ascii: %1\nCharacter: %2").arg(ch.asciiVal()).arg(name); setToolTip(ttstring); doRepaint(); }
void PlayScene::init() { // crea un sprite sprite = new fSprite(); // posiciona el fSprite en la mitad de la pantalla sprite->setPosition(windowWidth/2, windowHeight/2); // asigna una textura al fSprite sprite->setTexture("assets/img/ImpGuy_0.png"); // centra el origen del sprite en el centro de la imagen sprite->centerOrigin(); // agrega el fSprite a la escena add(sprite); // cambia el color de fondo de la escena setBgColor(sf::Color::White); }
void KopeteRichTextEditPart::readConfig() { // Don't update config untill we read whole config first m_configWriteLock = true; KConfig *config = KGlobal::config(); config->setGroup("RichTextEditor"); QColor tmpColor = KGlobalSettings::textColor(); setFgColor( config->readColorEntry("FgColor", &tmpColor ) ); tmpColor = KGlobalSettings::baseColor(); setBgColor( config->readColorEntry("BgColor", &tmpColor ) ); QFont tmpFont = KopetePrefs::prefs()->fontFace(); setFont( config->readFontEntry("Font", &tmpFont ) ); int tmp = KGlobalSettings::generalFont().pixelSize(); setFontSize( config->readNumEntry( "FontSize", tmp ) ); action_bold->setChecked( config->readBoolEntry( "FontBold" ) ); action_italic->setChecked( config->readBoolEntry( "FontItalic" ) ); action_underline->setChecked( config->readBoolEntry( "FontUnderline" ) ); switch( config->readNumEntry( "EditAlignment", AlignLeft ) ) { case AlignLeft: action_align_left->activate(); break; case AlignCenter: action_align_center->activate(); break; case AlignRight: action_align_right->activate(); break; case AlignJustify: action_align_justify->activate(); break; } m_configWriteLock = false; }
void BigTime::resizeEvent(QResizeEvent *ev) { dwin->resize(ev->size()); QFont f = dwin->font(); QFontMetrics fm(f); int fs = f.pixelSize(); int hspace = 20; //int tw = fm.width(QString("00:00:00:00")); int tw = fm.width(QString("000:00:00:00")); fs = ((ev->size().width() - hspace * 2) * fs) / tw; //fs -= 20; // set min/max if (fs < 10) fs = 10; else if (fs > 200) fs = 200; else fs -= 20; //if(debugMsg) // printf("resize BigTime: Font name:%s CurSize:%d NewSize:%d, NewWidth:%d\n", // f.family().toLatin1().constData(), fs, nfs, ev->size().width()); //f.setPixelSize(fs); //dwin->setFont(f); QString fstr = QString("font-size:%1px; font-family:'Arial'; ").arg(fs); // Tim p4.0.8 dwin->setStyleSheet(fstr); setBgColor(config.bigTimeBackgroundColor); setFgColor(config.bigTimeForegroundColor); int digitWidth = dwin->fontMetrics().width(QString("0")); int vspace = (ev->size().height() - (fs * 2)) / 3; int tickY = vspace; int timeY = vspace * 2 + fs; int absTickY = tickY; int absFrameY = timeY; barLabel->resize(digitWidth * 4, fs); beatLabel->resize(digitWidth * 2, fs); tickLabel->resize(digitWidth * 3, fs); //hourLabel->resize(digitWidth*2, fs); //minLabel->resize(digitWidth*2, fs); minLabel->resize(digitWidth * 3, fs); secLabel->resize(digitWidth * 2, fs); frameLabel->resize(digitWidth * 2, fs); subFrameLabel->resize(digitWidth * 2, fs); absTickLabel->resize(digitWidth * 10, fs); absFrameLabel->resize(digitWidth * 10, fs); sep1->resize(digitWidth, fs); sep2->resize(digitWidth, fs); sep3->resize(digitWidth, fs); sep4->resize(digitWidth, fs); sep5->resize(digitWidth, fs); barLabel->move(hspace + (digitWidth * 0), tickY); sep1->move(hspace + (digitWidth * 4), tickY); beatLabel->move(hspace + (digitWidth * 5), tickY); sep2->move(hspace + (digitWidth * 7), tickY); tickLabel->move(hspace + (digitWidth * 8), tickY); //hourLabel->move( hspace + (digitWidth*0), timeY); //sep3->move( hspace + (digitWidth*2), timeY); //minLabel->move( hspace + (digitWidth*3), timeY); //sep4->move( hspace + (digitWidth*5), timeY); //secLabel->move( hspace + (digitWidth*6), timeY); //sep5->move( hspace + (digitWidth*8), timeY); //frameLabel->move( hspace + (digitWidth*9), timeY); minLabel->move(hspace + (digitWidth * 0), timeY); sep3->move(hspace + (digitWidth * 3), timeY); secLabel->move(hspace + (digitWidth * 4), timeY); sep4->move(hspace + (digitWidth * 6), timeY); frameLabel->move(hspace + (digitWidth * 7), timeY); sep5->move(hspace + (digitWidth * 9), timeY); subFrameLabel->move(hspace + (digitWidth * 10), timeY); absTickLabel->move(hspace + (digitWidth * 0), absTickY); absFrameLabel->move(hspace + (digitWidth * 0), absFrameY); }
void BigTime::configChanged() { setBgColor(config.bigTimeBackgroundColor); setFgColor(config.bigTimeForegroundColor); }
void FeListBox::set_bga(int a) { sf::Color c=m_base_text.getBgColor(); c.a=a; setBgColor( c ); }
void FeListBox::set_bgb(int b) { sf::Color c=m_base_text.getBgColor(); c.b=b; setBgColor( c ); }
void FeListBox::set_bgg(int g) { sf::Color c=m_base_text.getBgColor(); c.g=g; setBgColor( c ); }
void FeListBox::set_bgr(int r) { sf::Color c=m_base_text.getBgColor(); c.r=r; setBgColor( c ); }
//----------------------------------------------------------------------------- // Purpose: Create the ScoreBoard panel //----------------------------------------------------------------------------- ScorePanel::ScorePanel(int x,int y,int wide,int tall) : Panel(x,y,wide,tall) { CSchemeManager *pSchemes = gViewPort->GetSchemeManager(); SchemeHandle_t hTitleScheme = pSchemes->getSchemeHandle("Scoreboard Title Text"); SchemeHandle_t hSmallScheme = pSchemes->getSchemeHandle("Scoreboard Small Text"); SchemeHandle_t hTinyScheme = pSchemes->getSchemeHandle("Scoreboard Tiny Text"); Font *tfont = pSchemes->getFont(hTitleScheme); Font *smallfont = pSchemes->getFont(hSmallScheme); Font *tinyfont = pSchemes->getFont(hTinyScheme); setBgColor(0, 0, 0, 96); m_pCurrentHighlightLabel = NULL; m_iHighlightRow = -1; // puzl: 0001073 m_pTrackerIcon = NULL; m_pDevIcon = NULL; m_pPTIcon = NULL; m_pGuideIcon = NULL; m_pServerOpIcon = NULL; m_pContribIcon = NULL; m_pCheatingDeathIcon = NULL; m_pVeteranIcon = NULL; m_pTrackerIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardtracker.tga"); m_pDevIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboarddev.tga"); m_pPTIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardpt.tga"); m_pGuideIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardguide.tga"); m_pServerOpIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardserverop.tga"); m_pContribIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardcontrib.tga"); m_pCheatingDeathIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardcd.tga"); m_pVeteranIcon = vgui_LoadTGANoInvertAlpha("gfx/vgui/640_scoreboardveteran.tga"); m_iIconFrame = 0; m_iLastFrameIncrementTime = gHUD.GetTimeOfLastUpdate(); // Initialize the top title. m_TitleLabel.setFont(tfont); m_TitleLabel.setText(""); m_TitleLabel.setBgColor( 0, 0, 0, 255 ); m_TitleLabel.setFgColor( Scheme::sc_primary1 ); m_TitleLabel.setContentAlignment( vgui::Label::a_west ); LineBorder *border = new LineBorder(Color(60, 60, 60, 128)); setBorder(border); setPaintBorderEnabled(true); int xpos = g_ColumnInfo[0].m_Width + 3; if (ScreenWidth() >= 640) { // only expand column size for res greater than 640 xpos = XRES(xpos); } m_TitleLabel.setBounds(xpos, 4, wide, SBOARD_TITLE_SIZE_Y); m_TitleLabel.setContentFitted(false); m_TitleLabel.setParent(this); // Setup the header (labels like "name", "class", etc..). m_HeaderGrid.SetDimensions(NUM_COLUMNS, 1); m_HeaderGrid.SetSpacing(0, 0); for(int i=0; i < NUM_COLUMNS; i++) { if (g_ColumnInfo[i].m_pTitle && g_ColumnInfo[i].m_pTitle[0] == '#') m_HeaderLabels[i].setText(CHudTextMessage::BufferedLocaliseTextString(g_ColumnInfo[i].m_pTitle)); else if(g_ColumnInfo[i].m_pTitle) m_HeaderLabels[i].setText(g_ColumnInfo[i].m_pTitle); int xwide = g_ColumnInfo[i].m_Width; if (ScreenWidth() >= 640) { xwide = XRES(xwide); } else if (ScreenWidth() == 400) { // hack to make 400x300 resolution scoreboard fit if (i == 1) { // reduces size of player name cell xwide -= 28; } else if (i == 0) { // tracker icon cell xwide -= 8; } } m_HeaderGrid.SetColumnWidth(i, xwide); m_HeaderGrid.SetEntry(i, 0, &m_HeaderLabels[i]); m_HeaderLabels[i].setBgColor(0,0,0,255); m_HeaderLabels[i].setBgColor(0,0,0,255); int theColorIndex = 0; Color gammaAdjustedTeamColor = BuildColor(kTeamColors[theColorIndex][0], kTeamColors[theColorIndex][1], kTeamColors[theColorIndex][2], gHUD.GetGammaSlope()); int theR, theG, theB, theA; gammaAdjustedTeamColor.getColor(theR, theG, theB, theA); m_HeaderLabels[i].setFgColor(theR, theG, theB, theA); m_HeaderLabels[i].setFont(smallfont); m_HeaderLabels[i].setContentAlignment(g_ColumnInfo[i].m_Alignment); int yres = 12; if (ScreenHeight() >= 480) { yres = YRES(yres); } m_HeaderLabels[i].setSize(50, yres); } // Set the width of the last column to be the remaining space. int ex, ey, ew, eh; m_HeaderGrid.GetEntryBox(NUM_COLUMNS - 2, 0, ex, ey, ew, eh); m_HeaderGrid.SetColumnWidth(NUM_COLUMNS - 1, (wide - X_BORDER) - (ex + ew)); m_HeaderGrid.AutoSetRowHeights(); m_HeaderGrid.setBounds(X_BORDER, SBOARD_TITLE_SIZE_Y, wide - X_BORDER*2, m_HeaderGrid.GetRowHeight(0)); m_HeaderGrid.setParent(this); m_HeaderGrid.setBgColor(0,0,0,255); // Now setup the listbox with the actual player data in it. int headerX, headerY, headerWidth, headerHeight; m_HeaderGrid.getBounds(headerX, headerY, headerWidth, headerHeight); m_PlayerList.setBounds(headerX, headerY+headerHeight, headerWidth, tall - headerY - headerHeight - 6); m_PlayerList.setBgColor(0,0,0,255); m_PlayerList.setParent(this); for(int row=0; row < NUM_ROWS; row++) { CGrid *pGridRow = &m_PlayerGrids[row]; pGridRow->SetDimensions(NUM_COLUMNS, 1); for(int col=0; col < NUM_COLUMNS; col++) { m_PlayerEntries[col][row].setContentFitted(false); m_PlayerEntries[col][row].setRow(row); m_PlayerEntries[col][row].addInputSignal(this); pGridRow->SetEntry(col, 0, &m_PlayerEntries[col][row]); } pGridRow->setBgColor(0,0,0,255); // pGridRow->SetSpacing(2, 0);f pGridRow->SetSpacing(0, 0); pGridRow->CopyColumnWidths(&m_HeaderGrid); pGridRow->AutoSetRowHeights(); pGridRow->setSize(PanelWidth(pGridRow), pGridRow->CalcDrawHeight()); pGridRow->RepositionContents(); m_PlayerList.AddItem(pGridRow); } // Add the hit test panel. It is invisible and traps mouse clicks so we can go into squelch mode. m_HitTestPanel.setBgColor(0,0,0,255); m_HitTestPanel.setParent(this); m_HitTestPanel.setBounds(0, 0, wide, tall); m_HitTestPanel.addInputSignal(this); m_pCloseButton = new CommandButton( "x", wide-XRES(12 + 4), YRES(2), XRES( 12 ) , YRES( 12 ) ); m_pCloseButton->setParent( this ); m_pCloseButton->addActionSignal( new CMenuHandler_StringCommandWatch( "-showscores", true ) ); m_pCloseButton->setBgColor(0,0,0,255); m_pCloseButton->setFgColor( 255, 255, 255, 0 ); m_pCloseButton->setFont(tfont); m_pCloseButton->setBoundKey( (char)255 ); m_pCloseButton->setContentAlignment(Label::a_center); Initialize(); }