Beispiel #1
0
// Render the control
void CLTGUISlider::Render ()
{
	if (m_pText)
	{
		m_pText->SetColor(GetCurrentColor());
		m_pText->Render();
	}

	g_pDrawPrim->SetTexture(m_hBar);

	// set up the render state	
	SetRenderState();


//	draw bar

	if (m_bEnabled && m_nSliderPos > m_nMinSlider)
	{
		g_pDrawPrim->SetTexture(m_hBar);
		g_pDrawPrim->DrawPrim(&m_Bar[eFull]);
	}

	if (m_bEnabled && m_nSliderPos < m_nMaxSlider)
	{
		g_pDrawPrim->SetTexture(m_hBar);
		g_pDrawPrim->DrawPrim(&m_Bar[eEmpty]);
	}
	
//	draw arrows
	if (!m_bDisplayOnly)
	{
		if (m_bOverLeft)
			g_pDrawPrim->SetAlphaBlendMode(DRAWPRIM_BLEND_MUL_SRCALPHA_ONE);
		else
			g_pDrawPrim->SetAlphaBlendMode(DRAWPRIM_BLEND_MOD_SRCALPHA);
		g_pDrawPrim->SetTexture(m_hBar);
		g_pDrawPrim->DrawPrim(&m_Bar[eLeft]);

		if (m_bOverRight)
			g_pDrawPrim->SetAlphaBlendMode(DRAWPRIM_BLEND_MUL_SRCALPHA_ONE);
		else
			g_pDrawPrim->SetAlphaBlendMode(DRAWPRIM_BLEND_MOD_SRCALPHA);
		g_pDrawPrim->SetTexture(m_hBar);
		g_pDrawPrim->DrawPrim(&m_Bar[eRight]);
	}	


//	Draw Numbers
	if (m_pNumbers)
	{
		m_pNumbers->SetColor(GetCurrentColor());
		m_pNumbers->Render();
	}



}
Beispiel #2
0
// Render the control
void CLTGUIFillFrame::Render()
{
	if( !IsVisible() )
		return;

	// fill with a background color
	LT_POLYG4 polyBackground;
	DrawPrimSetRGBA( polyBackground, m_nBackgroundColor );
	DrawPrimSetXYWH( polyBackground, GetPos().x, GetPos().y, GetWidth(), GetHeight() );
	g_pDrawPrim->SetRenderMode(eLTDrawPrimRenderMode_Modulate_Translucent);
	g_pDrawPrim->DrawPrim( &polyBackground );

	// render the border
	if( m_nFrameWidth )
	{
		// set up the render state	
		g_pDrawPrim->SetRenderMode(eLTDrawPrimRenderMode_Modulate_NoBlend);

		for (int f = 0;f < LTARRAYSIZE(m_Frame); ++f)
			DrawPrimSetRGBA(m_Frame[f],GetCurrentColor());

		// draw our frames
		if( (m_nBorderFlags & eBorder_Left) )
			g_pDrawPrim->DrawPrim( &m_Frame[0], 1 );
		if( (m_nBorderFlags & eBorder_Top) )
			g_pDrawPrim->DrawPrim( &m_Frame[1], 1 );
		if( (m_nBorderFlags & eBorder_Right) )
			g_pDrawPrim->DrawPrim( &m_Frame[2], 1 );
		if( (m_nBorderFlags & eBorder_Bottom) )
			g_pDrawPrim->DrawPrim( &m_Frame[3], 1 );
	}
}
void FsGuiColorDialog::UpdateRGBSliderFromCurrentColor(void)
{
	auto col=GetCurrentColor();
	redSlider->SetPosition(col.Rd());
	greenSlider->SetPosition(col.Gd());
	blueSlider->SetPosition(col.Bd());
}
Beispiel #4
0
//光标消息
BOOL CDlgSkinControl::OnSetCursor(CWnd * pWnd, UINT nHitTest, UINT uMessage)
{
	//获取光标
	CPoint MousePoint;
	GetCursorPos(&MousePoint);
	ScreenToClient(&MousePoint);

	//设置选择
	WORD wHoverItem=m_wHoverItem;
	m_wHoverItem=GetCurrentItem(MousePoint);
	m_wHoverColor=GetCurrentColor(MousePoint);

	//更新界面
	if (m_wHoverItem!=wHoverItem)
	{
		RedrawWindow(NULL,NULL,RDW_FRAME|RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASENOW);
	}

	//设置光标
	if ((m_wHoverItem!=INVALID_WORD)||(m_wHoverColor!=INVALID_WORD))
	{
		SetCursor(LoadCursor(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDC_HAND_CUR)));
		return true;
	}

	return __super::OnSetCursor(pWnd,nHitTest,uMessage);
}
Property::Value AnimatableMesh::GetDefaultProperty(Property::Index index) const
{
  Property::Value value;
  int vertexProperty = index % VERTEX_PROPERTY_COUNT;
  int vertexIndex    = index / VERTEX_PROPERTY_COUNT;

  switch ( vertexProperty )
  {
    case Dali::AnimatableVertex::POSITION:
    {
      value = GetCurrentPosition(vertexIndex);
      break;
    }
    case Dali::AnimatableVertex::COLOR:
    {
      value = GetCurrentColor(vertexIndex);
      break;
    }
    case Dali::AnimatableVertex::TEXTURE_COORDS:
    {
      value = GetCurrentTextureCoords(vertexIndex);
      break;
    }
  }

  return value;
}
Beispiel #6
0
void CHUDFader::Update( float fDeltaTime )
{
	if (m_bActive == false)
		return;

	if (m_bUpdateAlways)
	{
		float fCurrTime = gEnv->pTimer->GetAsyncCurTime();
		fDeltaTime = fCurrTime - m_lastTime;
		m_lastTime = fCurrTime;
	}

	if (m_curTime >= m_duration)
	{
		// when we're logically supposed to fade 'in' (meaning, to go away), do so
		if (m_direction < 0)
		{
			m_bActive = false;
			m_currentColor = m_targetColor;
		}
		m_currentColor = m_targetColor;
		m_ticket = 0;
	}
	m_drawColor = GetCurrentColor();
	m_curTime+=fDeltaTime;
}
void FsGuiColorDialog::UpdateHSVSliderFromCurrentColor(void)
{
	auto col=GetCurrentColor();
	hueSlider->SetPosition(col.Hd());
	saturationSlider->SetPosition(col.Sd());
	valueSlider->SetPosition(col.Vd());
}
Beispiel #8
0
// Render the control
void CLTGUIButton::Render()
{
	// Sanity checks...
	if (!IsVisible()) return;

	HTEXTURE hCurrTex;
	if (IsSelected() && m_hSelected)
		hCurrTex = m_hSelected;
	else if (IsDisabled() && m_hDisabled)
		hCurrTex = m_hDisabled;
	else
		hCurrTex = m_hNormal;

	//setup the texture
	g_pDrawPrim->SetTexture(hCurrTex);

	//setup the UV coordinates on our quad, since it is dependant upon
	//the texture for correct filtering
	SetupQuadUVs(m_Poly, hCurrTex, 0.0f, 0.0f, 1.0f, 1.0f);

	// set up the render state
	SetRenderState();

	// draw our button
	g_pDrawPrim->DrawPrim(&m_Poly);

	if (m_pText)
	{
		uint32 argbColor = m_argbNormal;
		if (m_bHighlightText)
			argbColor = GetCurrentColor();
		m_pText->SetColor(argbColor);
		m_pText->Render();
	}
}
void vParticle::Render()
{
	Assert( pRenderer != NULL );

	if ( GetCurrentAlpha() <= 0.0f ||
		GetCurrentColor().LengthSqr() <= 0.0f ||
		GetCurrentSize() < 1 )
		return;

	pRenderer->Render( this );
}
Beispiel #10
0
// Render the control
void CLTGUIEditCtrl::Render ()
{
	if ( !m_pText || !IsVisible())
		return;

    uint32 color = GetCurrentColor();

	// Render the text

	if (m_pText)
	{
		m_pText->SetColor(color);
		m_pText->Render();

		// draw the caret
		g_pDrawPrim->SetTransformType(DRAWPRIM_TRANSFORM_SCREEN);
		g_pDrawPrim->SetZBufferMode(DRAWPRIM_NOZ); 
		g_pDrawPrim->SetClipMode(DRAWPRIM_NOCLIP);
		g_pDrawPrim->SetFillMode(DRAWPRIM_FILL);
		g_pDrawPrim->SetColorOp(DRAWPRIM_NOCOLOROP);
		g_pDrawPrim->SetAlphaTestMode(DRAWPRIM_NOALPHATEST);
		g_pDrawPrim->SetAlphaBlendMode(DRAWPRIM_NOBLEND);

		if (IsCaretOn() && IsEnabled())
		{
			LT_POLYGT4*	pPolys = m_pText->GetPolys();
			
			float x = (float)m_pos.x;
			float y = (float)m_pos.y;
			float w = 2.0f;
			float h = m_pText->GetHeight();
			if (m_nCaretPos > 0 && m_nCaretPos <= m_pText->GetLength())
			{
				x = pPolys[m_nCaretPos-1].verts[1].x;
			}
			g_pDrawPrim->SetXYWH(&m_Caret,x,y,w,h);



			g_pDrawPrim->DrawPrim(&m_Caret);

		}

		// draw our frame
		if (m_bUseFrame)
			g_pDrawPrim->DrawPrim(m_Frame,4);

	}
}
Beispiel #11
0
// Render the control
void CLTGUIEditCtrl::Render ()
{
	if ( !IsVisible())
		return;


	// Render the text
	m_Text.SetColor(GetCurrentColor());
	m_Text.SetGlow(IsSelected());
	m_Text.Render( );

	g_pDrawPrim->SetRenderMode(eLTDrawPrimRenderMode_Modulate_NoBlend);

	// draw the caret
	if (IsCaretOn() && IsEnabled())
	{
		LTRect2n rRect;

		uint32 len = LTStrLen(GetText());
		if (m_nCaretPos > len)
			m_nCaretPos = len;
		
		float x = m_rfRect.Left();
		float y = m_rfRect.Top();
		float w = 2.0f;
		float h = GetHeight();
		if (m_nCaretPos > 0)
		{

			LTRect2n rRect;
			if (m_Text.GetCharRect(m_nCaretPos-1,rRect) == LT_OK)
			{
				x = (float)rRect.Right();
			}
		}
		DrawPrimSetXYWH(m_Caret,x,y,w,h);
		g_pDrawPrim->DrawPrim(&m_Caret);
	}

	g_pDrawPrim->SetRenderMode(eLTDrawPrimRenderMode_Modulate_Translucent);


	// draw our frame
	if (m_bUseFrame)
		g_pDrawPrim->DrawPrim(m_Frame,4);

}
Beispiel #12
0
	int FadeIn(const ColorF& targetColor, float fDuration, bool bUseCurrentColor=true)
	{
		if (m_ticket == 0 || bUseCurrentColor == false)
		{
			m_currentColor = targetColor;
			m_currentColor.a = 1.0f;
		}
		else
			m_currentColor = GetCurrentColor();
		m_targetColor = targetColor;
		m_targetColor.a = 0.0f;
		m_duration = fDuration > 0.0f ? fDuration : 0.0f;
		m_curTime = 0.0f;
		m_direction = -1;
		m_bActive = true;
		return ++m_ticket;
	}
Beispiel #13
0
	int FadeOut(const ColorF& targetColor, float fDuration, const char* textureName="", bool bUseCurrentColor=true)
	{
		SetTexture(textureName);
		if (m_ticket == 0 || bUseCurrentColor == false)
		{
			m_currentColor = targetColor;
			m_currentColor.a = 0.0f;
		}
		else
			m_currentColor = GetCurrentColor();

		m_targetColor = targetColor;
		m_targetColor.a = 1.0f;
		m_duration = fDuration > 0.0 ? fDuration : 0.0f;
		m_curTime = 0.0f;
		m_direction = 1;
		m_bActive = true;
		return ++m_ticket;
	}
Beispiel #14
0
	virtual void Update(float fDeltaTime)
	{
		if (m_bActive == false)
			return;

		if (m_curTime >= m_duration)
		{
			// when we're logically supposed to fade 'in' (meaning, to go away), do so
			if (m_direction < 0)
			{
				m_bActive = false;
				m_currentColor = m_targetColor;
			}
			m_currentColor = m_targetColor;
			m_ticket = 0;
		}
		m_drawColor = GetCurrentColor();
		m_curTime+=fDeltaTime;
	}
Beispiel #15
0
void CMGTrigger::Render(CDrawPort *pdp)
{
  SetFontMedium(pdp);

  PIXaabbox2D box = FloatBoxToPixBox(pdp, mg_boxOnScreen);
  PIX pixIL = box.Min()(1) + box.Size()(1)*0.45f;
  PIX pixIR = box.Min()(1) + box.Size()(1)*0.55f;
  PIX pixJ = box.Min()(2);

  COLOR col = GetCurrentColor();
  if (!mg_bVisual || mg_strValue == "") {
    CTString strValue = mg_strValue;
    if (mg_bVisual) {
      strValue = TRANS("none");
    }

    if (mg_iCenterI == -1) {
      pdp->PutText(mg_strLabel, box.Min()(1), pixJ, col);
      pdp->PutTextR(strValue, box.Max()(1), pixJ, col);
    } else {
      pdp->PutTextR(mg_strLabel, pixIL, pixJ, col);
      pdp->PutText(strValue, pixIR, pixJ, col);
    }
  } else {
    CTString strLabel = mg_strLabel + ": ";
    pdp->PutText(strLabel, box.Min()(1), pixJ, col);
    CTextureObject to;
    try {
      to.SetData_t(mg_strValue);
      CTextureData *ptd = (CTextureData *)to.GetData();
      PIX pixSize = box.Size()(2);
      PIX pixCX = box.Max()(1) - pixSize / 2;
      PIX pixCY = box.Center()(2);
      pdp->PutTexture(&to, PIXaabbox2D(
        PIX2D(pixCX - pixSize / 2, pixCY - pixSize / 2),
        PIX2D(pixCX - pixSize / 2 + pixSize, pixCY - pixSize / 2 + pixSize)), C_WHITE | 255);
    } catch (char *strError) {
      CPrintF("%s\n", strError);
    }
    to.SetData(NULL);
  }
}
Beispiel #16
0
// Render the control
void CLTGUICycleCtrl::Render ()
{
	// Sanity checks...
	if (!IsVisible()) return;

    uint32 argbColor=GetCurrentColor();
	if (m_pHeaderText)
	{
		m_pHeaderText->SetColor(argbColor);
		m_pHeaderText->Render();
	}

	if (m_nSelIndex > m_stringArray.size() || m_stringArray.size() == 0)
	{
		return;
	}

	m_stringArray[m_nSelIndex]->SetColor(argbColor);
	m_stringArray[m_nSelIndex]->Render();

}
Beispiel #17
0
int CHUDFader::FadeIn( const ColorF& targetColor, float fDuration, bool bUseCurrentColor/*=true*/, bool bUpdateAlways/*=false*/ )
{
	if (m_ticket == 0 || bUseCurrentColor == false)
	{
		m_currentColor = targetColor;
		m_currentColor.a = 1.0f;
	}
	else
	{
		m_currentColor = GetCurrentColor();
	}

	m_targetColor = targetColor;
	m_targetColor.a = 0.0f;
	m_duration = fDuration > 0.0f ? fDuration : 0.0f;
	m_curTime = 0.0f;
	m_direction = -1;
	m_bActive = true;
	m_bUpdateAlways = bUpdateAlways;
	m_lastTime = gEnv->pTimer->GetAsyncCurTime();
	return ++m_ticket;
}
Beispiel #18
0
int CHUDFader::FadeOut( const ColorF& targetColor, float fDuration, const char* textureName/*=""*/, bool bUseCurrentColor/*=true*/, bool bUpdateAlways/*=false*/, float fTargetAlpha/*=1.f*/, float fSourceAlpha /*=-1.f*/)
{
	SetTexture(textureName);
	if (m_ticket == 0 || bUseCurrentColor == false)
	{
		m_currentColor = targetColor;

		m_currentColor.a = (fSourceAlpha > FLT_EPSILON) ? fSourceAlpha : 0.0f;
	}
	else
	{
		m_currentColor = GetCurrentColor();
	}

	m_targetColor = targetColor;
	m_targetColor.a = fTargetAlpha;
	m_duration = fDuration > 0.0 ? fDuration : 0.0f;
	m_curTime = 0.0f;
	m_direction = 1;
	m_bActive = true;
	m_bUpdateAlways = bUpdateAlways;
	m_lastTime = gEnv->pTimer->GetAsyncCurTime();
	return ++m_ticket;
}
Beispiel #19
0
void graphics::brush::BrushSet::SetColorSet(const graphics::color::ColorSet &colorSet)
{
    Clear();

    for (size_t i = 0; i < colorSet.GetNumberOfColors(); ++i) {
        auto color = colorSet.GetColor(i);
        switch (color->GetColorType()) {
        case graphics::color::IColor::COLOR_TYPE_SOLID_COLOR: {
            auto solidColor =
                std::dynamic_pointer_cast<graphics::color::SolidColor>(color);
            auto solidBrush =
                std::make_shared<graphics::brush::SolidColorBrush>();
            solidBrush->SetColor(solidColor->GetCurrentColor());
            if (solidColor->GetLabel().length() > 0) {
                solidBrush->SetLabel(solidColor->GetLabel());
                m_labelToBrashMap.insert(
                    std::make_pair<std::wstring, std::shared_ptr<graphics::brush::IBrush>>(
                        solidColor->GetLabel(),
                        solidBrush));
            }
            m_brushes.push_back(solidBrush);
        }
        break;
        case graphics::color::IColor::COLOR_TYPE_LINEAR_GRADIENT_COLOR: {
            auto linearGradientColor =
                std::dynamic_pointer_cast<graphics::color::LinearGradientColor>(color);
            auto linearBrush =
                std::make_shared<graphics::brush::LinearGradientBrush>();
            linearBrush->SetGradientDirection(linearGradientColor->GetGradientDirection());
            linearBrush->SetGradientStops(linearGradientColor->GetCurrentColor());
            if (linearGradientColor->GetLabel().length() > 0) {
                linearBrush->SetLabel(linearGradientColor->GetLabel());
                m_labelToBrashMap.insert(
                    std::make_pair<std::wstring, std::shared_ptr<graphics::brush::IBrush>>(
                        linearGradientColor->GetLabel(),
                        linearBrush));
            }
            m_brushes.push_back(linearBrush);
        }
        break;
        case graphics::color::IColor::COLOR_TYPE_RADIAL_GRADIENT_COLOR: {
            auto radialGradientColor =
                std::dynamic_pointer_cast<graphics::color::RadialGradientColor>(color);
            auto radialBrush =
                std::make_shared<graphics::brush::RadialGradientBrush>();
            radialBrush->SetGradientOriginOffsetRate(
                radialGradientColor->GetGradientOffsetX(),
                radialGradientColor->GetGradientOffsetY());
            radialBrush->SetGradientStops(radialGradientColor->GetCurrentColor());
            if (radialGradientColor->GetLabel().length() > 0) {
                radialBrush->SetLabel(radialGradientColor->GetLabel());
                m_labelToBrashMap.insert(
                    std::make_pair<std::wstring, std::shared_ptr<graphics::brush::IBrush>>(
                        radialGradientColor->GetLabel(),
                        radialBrush));
            }
            m_brushes.push_back(radialBrush);
        }
        break;
        }
    }
}
Beispiel #20
0
 DefaultColors() : defaultColor(GetCurrentColor()) {
 }