コード例 #1
0
void SettingsFormDialog::build()
{
    mainLayout = new QVBoxLayout;
    topLayout = new QHBoxLayout;
    infobLabel = new QLabel(info,this);
    infobLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    infobLabel->setWordWrap(true);
    QString backCol("white");
    QString textCol("black");
    infobLabel->setStyleSheet("QLabel {"
                              "background-color: " + backCol + ";"
                              "color: " + textCol + ";"
                              "border: 1px solid black;"
                              "padding: 4px;"
                              "font: bold 12pt;"
                              "}");
    buttonsLayout = new QVBoxLayout;
    okButton = new QPushButton("OK");
    cancelButton = new QPushButton("Cancel");
    connect(okButton, SIGNAL(clicked()), this, SLOT(checkBeforeAccept()));
    connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
    buttonsLayout->addWidget(okButton);
    buttonsLayout->addWidget(cancelButton);
    topLayout->addWidget(infobLabel);
    topLayout->addStretch();
    topLayout->addLayout(buttonsLayout);
    mainLayout->addLayout(topLayout);
    addExtraWidgets();
    setLayout(mainLayout);
    form->build();
    mainLayout->addWidget(form);
}
コード例 #2
0
ファイル: SmokeManager.cpp プロジェクト: eBunny/EmberProject
void CSmokeManager::DrawSmokeDebugSpheres()
{
    if(g_pGameCVars->g_debugSmokeGrenades)
        {
            SAuxGeomRenderFlags oldFlags = gEnv->pRenderer->GetIRenderAuxGeom()->GetRenderFlags();
            SAuxGeomRenderFlags newFlags = oldFlags;
            newFlags.SetAlphaBlendMode(e_AlphaBlended);

            gEnv->pRenderer->GetIRenderAuxGeom()->SetRenderFlags(newFlags);

            const int kNumActiveSmokeInstances = m_numActiveSmokeInstances;

            ColorB smokeDebugColor(255, 0, 0, 70);

            for(int i = 0; i < kNumActiveSmokeInstances; i++)
                {
                    //DRAW SPHERE
                    SSmokeInstance& smokeInstance = m_smokeInstances[i];
                    gEnv->pRenderer->GetIRenderAuxGeom()->DrawSphere(smokeInstance.vPositon, smokeInstance.fCurrentRadius, smokeDebugColor);
                }

            gEnv->pRenderer->GetIRenderAuxGeom()->SetRenderFlags(oldFlags);

            // Draw blur amount to screen
            ColorF textCol(0.0f,1.0f,0.0f,1.0f);
            gEnv->pRenderer->Draw2dLabel(50.0f,20.0f,1.4f,&textCol.r,false,"Client Blur Amount: %f",m_clientBlurAmount);
        }
}
コード例 #3
0
//--------------------------------------------------------------------------------------------------
// Name: DebugDisplay
// Desc: Display when this effect is selected to debug through the game effects system
//--------------------------------------------------------------------------------------------------
void CExplosionGameEffect::DebugDisplay(const Vec2& textStartPos,float textSize,float textYStep)
{
	ColorF textCol(1.0f,1.0f,0.0f,1.0f);
	Vec2 currentTextPos = textStartPos;
	gEnv->pRenderer->Draw2dLabel(currentTextPos.x,currentTextPos.y,textSize,&textCol.r,false,"Reset distance: NumPad 0");
	currentTextPos.y += textYStep;
	gEnv->pRenderer->Draw2dLabel(currentTextPos.x,currentTextPos.y,textSize,&textCol.r,false,"Add distance: NumPad *");
	currentTextPos.y += textYStep;
	gEnv->pRenderer->Draw2dLabel(currentTextPos.x,currentTextPos.y,textSize,&textCol.r,false,"Subtract distance: NumPad /");
	currentTextPos.y += textYStep;
	gEnv->pRenderer->Draw2dLabel(currentTextPos.x,currentTextPos.y,textSize,&textCol.r,false,"Frag: NumPad 1");
	currentTextPos.y += textYStep;
	gEnv->pRenderer->Draw2dLabel(currentTextPos.x,currentTextPos.y,textSize,&textCol.r,false,"Flashbang: NumPad 2");
	currentTextPos.y += textYStep;
	gEnv->pRenderer->Draw2dLabel(currentTextPos.x,currentTextPos.y,textSize,&textCol.r,false,"L-tag: NumPad 3");
}//-------------------------------------------------------------------------------------------------
コード例 #4
0
//--------------------------------------------------------------------------------------------------
// Name: DebugDisplay
// Desc: Display when this effect is selected to debug through the game effects system
//--------------------------------------------------------------------------------------------------
void CSceneBlurGameEffect::DebugDisplay(const Vec2& textStartPos,float textSize,float textYStep)
{
	ColorF textCol(1.0f,1.0f,0.0f,1.0f);
	Vec2 currentTextPos = textStartPos;

	if(s_sceneBlurGEData.isInitialised)
	{
		gEnv->pRenderer->Draw2dLabel(currentTextPos.x,currentTextPos.y,textSize,&textCol.r,false,"Create: NumPad 1");
		currentTextPos.y += textYStep;
		gEnv->pRenderer->Draw2dLabel(currentTextPos.x,currentTextPos.y,textSize,&textCol.r,false,"Destroy: NumPad 2");
		currentTextPos.y += textYStep;
		gEnv->pRenderer->Draw2dLabel(currentTextPos.x,currentTextPos.y,textSize,&textCol.r,false,"Turn on: NumPad 4");
		currentTextPos.y += textYStep;
		gEnv->pRenderer->Draw2dLabel(currentTextPos.x,currentTextPos.y,textSize,&textCol.r,false,"Turn off: NumPad 5");
		currentTextPos.y += textYStep;
	}
	else
	{
		gEnv->pRenderer->Draw2dLabel(currentTextPos.x,currentTextPos.y,textSize,&textCol.r,false,"Effect failed to load data");
	}
}
コード例 #5
0
// draw the item
bool wxOwnerDrawn::OnDrawItem(wxDC& dc, const wxRect& rc,
                              wxODAction, wxODStatus stat)
{
    // we do nothing if item isn't ownerdrawn
    if ( !IsOwnerDrawn() )
        return true;

    wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl();
    HDC hdc = GetHdcOf(*impl);

    RECT rect;
    wxCopyRectToRECT(rc, rect);

    {
        // set the font and colors
        wxFont font;
        GetFontToUse(font);

        wxColour colText, colBack;
        GetColourToUse(stat, colText, colBack);

        SelectInHDC selFont(hdc, GetHfontOf(font));

        wxMSWImpl::wxTextColoursChanger textCol(hdc, colText, colBack);
        wxMSWImpl::wxBkModeChanger bkMode(hdc, wxBRUSHSTYLE_TRANSPARENT);


        AutoHBRUSH hbr(wxColourToPalRGB(colBack));
        SelectInHDC selBrush(hdc, hbr);

        ::FillRect(hdc, &rect, hbr);

        // using native API because it recognizes '&'

        wxString text = GetName();

        SIZE sizeRect;
        ::GetTextExtentPoint32(hdc, text.c_str(), text.length(), &sizeRect);

        int flags = DST_PREFIXTEXT;
        if ( (stat & wxODDisabled) && !(stat & wxODSelected) )
            flags |= DSS_DISABLED;

        if ( (stat & wxODHidePrefix) )
            flags |= DSS_HIDEPREFIX;

        int x = rc.x + GetMarginWidth();
        int y = rc.y + (rc.GetHeight() - sizeRect.cy) / 2;
        int cx = rc.GetWidth() - GetMarginWidth();
        int cy = sizeRect.cy;

        ::DrawState(hdc, NULL, NULL, wxMSW_CONV_LPARAM(text),
                    text.length(), x, y, cx, cy, flags);

    } // reset to default the font, colors and brush

    if (stat & wxODHasFocus)
        ::DrawFocusRect(hdc, &rect);

    return true;
}
コード例 #6
0
ファイル: waveformview.cpp プロジェクト: muddcliff/Papagayo
void WaveformView::paintEvent(QPaintEvent *event)
{
	PG_UNUSED(event);

	QPainter	dc(this);

	int32		clientWidth = width();
	int32		clientHeight = height();

	if (fDoc == NULL)
	{
		dc.drawText(QRect(0, 0, clientWidth, clientHeight), Qt::AlignHCenter | Qt::AlignVCenter, tr("Drop WAV audio file here"));
		return;
	}

	int32		topBorder = 16; // should be the height of frame label text
	int32		halfClientHeight;
	int32		sampleHeight, halfSampleHeight, textHeight;
	int32		fps = fDoc->Fps();
	int32		x = 0;
	int32		frameX;
	int32		sample = 0;
	int32		frame = 0;
	bool		drawPlayMarker = false;
	QRect		r;
	QColor		textCol(64, 64, 64);
	QColor		sampleFillCol(162, 205, 242);
	QColor		sampleOutlineCol(30, 121, 198);
	QColor		playBackCol(255, 127, 127);
	QColor		playForeCol(209, 102, 121, 128);
	QColor		playOutlineCol(128, 0, 0);
	QColor		frameCol(192, 192, 192);
	QColor		phraseFillCol(205, 242, 162);
	QColor		phraseOutlineCol(121, 198, 30);
	QColor		wordFillCol(242, 205, 162);
	QColor		wordOutlineCol(198, 121, 30);
	QColor		wordMissingFillCol(255, 127, 127);
	QColor		wordMissingOutlineCol(255, 0, 0);
	QColor		phonemeFillCol(231, 185, 210);
	QColor		phonemeOutlineCol(173, 114, 146);
	QMediaPlayer	*audioPlayer = fDoc->GetAudioPlayer();

	textHeight = dc.fontMetrics().height() + 4;
	topBorder = textHeight;
	halfClientHeight = (clientHeight - textHeight) / 2;

	if (audioPlayer && audioPlayer->state() == QMediaPlayer::PlayingState)
	{
		drawPlayMarker = true;
		x = fCurFrame * fFrameWidth;
		dc.fillRect(QRect(x, 0, fFrameWidth, clientHeight), playBackCol);
	}

	x = 0;
	for (int32 i = 0; i < fNumSamples; i++)
	{
		if (((sample + 1) % fSamplesPerFrame) == 0)
		{
			dc.setPen(frameCol);
			// draw frame marker
			frameX = (frame + 1) * fFrameWidth;
			if (fSampleWidth >= 2 && ((fFrameWidth > 2) || ((frame + 2) % fps == 0)))
			{
				dc.drawLine(frameX, topBorder, frameX, clientHeight);
			}
			// draw frame label
			if ((fFrameWidth > 30) || ((frame + 2) % fps == 0))
			{
				dc.drawLine(frameX, 0, frameX, topBorder);
				dc.drawText(frameX + 2, textHeight - 4, QString::number(frame + 2));
			}
		}

		sampleHeight = PG_ROUND(fAmp[i] * (real)(clientHeight - topBorder));
		halfSampleHeight = sampleHeight / 2;
		r.setRect(x, topBorder + halfClientHeight - halfSampleHeight, fSampleWidth + 1, sampleHeight);
		dc.fillRect(r, sampleFillCol);
		dc.setPen(sampleOutlineCol);
		dc.drawLine(r.topLeft(), r.topRight());
		dc.drawLine(r.bottomLeft(), r.bottomRight());
		dc.drawLine(r.topRight(), r.bottomRight());
		if (i == 0)
		{
			dc.drawLine(r.topLeft(), r.bottomLeft());
		}
		else if (fAmp[i] > fAmp[i - 1])
		{
			sampleHeight = PG_ROUND(fAmp[i - 1] * (real)(clientHeight - topBorder));
			halfSampleHeight = sampleHeight / 2;
			dc.drawLine(r.topLeft(), QPoint(r.left(), topBorder + halfClientHeight - halfSampleHeight));
			dc.drawLine(r.bottomLeft(), QPoint(r.left(), topBorder + halfClientHeight - halfSampleHeight + sampleHeight - 1));
		}

		x += fSampleWidth;
		sample++;
		if ((sample % fSamplesPerFrame) == 0)
			frame++;
	}

	if (fDoc->fCurrentVoice)
	{
		topBorder += 4;
		for (int32 p = 0; p < fDoc->fCurrentVoice->fPhrases.size(); p++)
		{
			LipsyncPhrase *phrase = fDoc->fCurrentVoice->fPhrases[p];
			r = QRect(phrase->fStartFrame * fFrameWidth, topBorder, (phrase->fEndFrame - phrase->fStartFrame + 1) * fFrameWidth, textHeight);
			phrase->fTop = r.top();
			phrase->fBottom = r.bottom();
			dc.fillRect(r, phraseFillCol);
			dc.setPen(phraseOutlineCol);
			dc.drawRect(r);
			dc.setClipRect(r);
			dc.setPen(textCol);
			r = r.marginsRemoved(QMargins(2, 2, 2, 2));
			dc.drawText(QPoint(r.left(), r.bottom() - 2), phrase->fText);
			dc.setClipping(false);

			for (int32 w = 0; w < phrase->fWords.size(); w++)
			{
				LipsyncWord *word = phrase->fWords[w];
				r = QRect(word->fStartFrame * fFrameWidth, topBorder + 4 + textHeight, (word->fEndFrame - word->fStartFrame + 1) * fFrameWidth, textHeight);
				if (w & 1)
					r.translate(0, textHeight - textHeight / 4);
				word->fTop = r.top();
				word->fBottom = r.bottom();
				if (word->fPhonemes.size() == 0)
				{
					dc.fillRect(r, wordMissingFillCol);
					dc.setPen(wordMissingOutlineCol);
				}
				else
				{
					dc.fillRect(r, wordFillCol);
					dc.setPen(wordOutlineCol);
				}
				dc.drawRect(r);
				dc.setClipRect(r);
				dc.setPen(textCol);
				r = r.marginsRemoved(QMargins(2, 2, 2, 2));
				dc.drawText(QPoint(r.left(), r.bottom() - 2), word->fText);
				dc.setClipping(false);

				for (int32 i = 0; i < word->fPhonemes.size(); i++)
				{
					LipsyncPhoneme *phoneme = word->fPhonemes[i];
					r = QRect(phoneme->fFrame * fFrameWidth, clientHeight - 4 - textHeight, fFrameWidth, textHeight);
					if (i & 1)
						r.translate(0, -(textHeight - textHeight / 4));
					phoneme->fTop = r.top();
					phoneme->fBottom = r.bottom();
					dc.fillRect(r, phonemeFillCol);
					dc.setPen(phonemeOutlineCol);
					dc.drawRect(r);
					dc.setPen(textCol);
					r = r.marginsRemoved(QMargins(2, 2, 2, 2));
					dc.drawText(QPoint(r.left(), r.bottom() - 2), phoneme->fText);
				} // for i
			} // for w
		} // for p
	}

	if (drawPlayMarker)
	{
		x = fCurFrame * fFrameWidth;
		dc.fillRect(QRect(x, 0, fFrameWidth, clientHeight), playForeCol);
		dc.setPen(playOutlineCol);
		dc.drawRect(QRect(x, 0, fFrameWidth, clientHeight));
	}
}