Example #1
0
void ChatUserInterface::renderHeader() const
{
   // Draw title, subtitle, and footer
   RenderUtils::drawCenteredString_fixed(vertMargin + MENU_TITLE_SIZE, MENU_TITLE_SIZE, Colors::green, "LOBBY CHAT");

   string subtitle = getSubtitle(getGame());

   S32 ypos = vertMargin + MENU_TITLE_SIZE + TITLE_SUBTITLE_GAP + MENU_SUBTITLE_SIZE;
   RenderUtils::drawCenteredString_fixed(ypos, MENU_SUBTITLE_SIZE, getGame()->getConnectionToServer() ? Colors::yellow : Colors::red, subtitle.c_str());
}
void MainWindow::sliderMoved(int val)
{
    if (!engine)
        return;

    currentTime = val * SLIDER_RATIO;

    ui->subtitleLabel->setText(getSubtitle(true));
    ui->timeLabel->setText((SrtEngine::millisToTimeString(currentTime)+ " / " + SrtEngine::millisToTimeString(engine->getFinishTime())));
}
Example #3
0
void SuspendedUserInterface::renderHeader() const
{
   S32 ypos = vertMargin + MENU_TITLE_SIZE;

   if(getGame()->isSuspended())
      RenderUtils::drawCenteredString_fixed(ypos, MENU_TITLE_SIZE, Colors::white, "-- GAME SUSPENDED -- ");
   
   else
      RenderUtils::drawCenteredString_fixed(ypos, MENU_TITLE_SIZE, Colors::red, "!! GAME RESTARTED !! ");

   string subtitle = getSubtitle(getGame());

   RenderUtils::drawCenteredString_fixed(ypos + MENU_SUBTITLE_SIZE + TITLE_SUBTITLE_GAP, MENU_SUBTITLE_SIZE, Colors::green, subtitle.c_str());
}
void MainWindow::update()
{
    if (!engine)
        return;

    if (currentTime >= engine->getFinishTime()) {
        setPlay(false);
        return;
    }

    currentTime += INTERVAL;
    ui->subtitleLabel->setText(getSubtitle(false));
    ui->timeLabel->setText((SrtEngine::millisToTimeString(currentTime) + " / " + SrtEngine::millisToTimeString(engine->getFinishTime())));
    ui->horizontalSlider->setValue((int) (currentTime / SLIDER_RATIO));
}
Example #5
0
void CComponent::init(Etype Type, int Subtype, int Val, ESize imageSize)
{
	OBJ_CONSTRUCTION_CAPTURING_ALL;

	compType = Type;
	subtype = Subtype;
	val = Val;
	size = imageSize;

	assert(compType < typeInvalid);
	assert(size < sizeInvalid);

	setSurface(getFileName()[size], getIndex());

	pos.w = image->pos.w;
	pos.h = image->pos.h;

	EFonts font = FONT_SMALL;
	if (imageSize < small)
		font = FONT_TINY; //other sizes?

	pos.h += 4; //distance between text and image

	std::vector<std::string> textLines = CMessage::breakText(getSubtitle(), std::max<int>(80, pos.w), font);
	for(auto & line : textLines)
	{
		int height = graphics->fonts[font]->getLineHeight();
		auto   label = new CLabel(pos.w/2, pos.h + height/2, font, CENTER, Colors::WHITE, line);

		pos.h += height;
		if (label->pos.w > pos.w)
		{
			pos.x -= (label->pos.w - pos.w)/2;
			pos.w = label->pos.w;
		}
	}
}
void MainWindow::resizeEvent(QResizeEvent *event)
{
    if (engine) ui->subtitleLabel->setText(getSubtitle(false));
}