示例#1
0
bool UGUIWidget::CanReceiveInputKey() const
{
	return bAllowInputKey 
		&& GetIsEnabled() 
		&& GetIsOpen()
		&& GetVisibility() != ESlateVisibility::Hidden 
		&& GetVisibility() != ESlateVisibility::Collapsed;
}
void g2Controller::__Render(int x, int y)
{
    // Ignore if not visible
    if(!GetVisibility())
        return;
    
    // Update rendering position to localized positions
    x += pX;
    y += pY;
    
    // Render self
    Render(x, y);
    
    // Update all children
    int QueueSize = (int)ChildObjects.size();
    for(int i = 0; i < QueueSize; i++)
    {
        // Get child
        g2Controller* Child = ChildObjects.front();
        ChildObjects.pop();
        
        // Render children
        Child->__Render(x, y);
        
        // Put back
        ChildObjects.push(Child);
    }
    
    // After a full render cycle, reset the mouse state so we
    // don't keep full-clicking
    if(ControllerState == g2ControllerState_Clicked)
        ControllerState = g2ControllerState_None;
}
示例#3
0
文件: Layer.cpp 项目: 4ian/GD
void Layer::SerializeTo(SerializerElement& element) const {
  element.SetAttribute("name", GetName());
  element.SetAttribute("visibility", GetVisibility());

  SerializerElement& camerasElement = element.AddChild("cameras");
  camerasElement.ConsiderAsArrayOf("camera");
  for (std::size_t c = 0; c < GetCameraCount(); ++c) {
    SerializerElement& cameraElement = camerasElement.AddChild("camera");
    cameraElement.SetAttribute("defaultSize", GetCamera(c).UseDefaultSize());
    cameraElement.SetAttribute("width", GetCamera(c).GetWidth());
    cameraElement.SetAttribute("height", GetCamera(c).GetHeight());

    cameraElement.SetAttribute("defaultViewport",
                               GetCamera(c).UseDefaultViewport());
    cameraElement.SetAttribute("viewportLeft", GetCamera(c).GetViewportX1());
    cameraElement.SetAttribute("viewportTop", GetCamera(c).GetViewportY1());
    cameraElement.SetAttribute("viewportRight", GetCamera(c).GetViewportX2());
    cameraElement.SetAttribute("viewportBottom", GetCamera(c).GetViewportY2());
  }

  SerializerElement& effectsElement = element.AddChild("effects");
  effectsElement.ConsiderAsArrayOf("effect");
  for (std::size_t i = 0; i < GetEffectsCount(); ++i) {
    SerializerElement& effectElement = effectsElement.AddChild("effect");
    GetEffect(i).SerializeTo(effectElement);
  }
}
示例#4
0
void DrawSdk::Rectangle::Write(CharArray *pArray, bool bUseFullImagePath)
{
   if (pArray == NULL)
      return;
  
   static _TCHAR tszVisibility[100];
   tszVisibility[0] = 0;
   if (HasVisibility())
      _stprintf(tszVisibility, _T(" visible=\"%s\""), GetVisibility());

   static _TCHAR tszBuffer[1000];
   tszBuffer[0] = 0;

   if (isFilled_)
   {
      _stprintf(tszBuffer, 
         _T("<FILLEDRECT x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" xf=\"%.2f\" yf=\"%.2f\" widthf=\"%.2f\" heightf=\"%.2f\" rgb=\"0x%08x\"%s></FILLEDRECT>\n"),
         (int)x_, (int)y_, (int)width_, (int)height_, x_, y_, width_, height_, m_argbFillColor, tszVisibility);
   }
   else
   {
      _stprintf(tszBuffer, 
         _T("<OUTLINERECT x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" xf=\"%.2f\" yf=\"%.2f\" widthf=\"%.2f\" heightf=\"%.2f\" linewidth=\"%d\" linewidthf=\"%.2f\" linestyle=\"%d\" rgb=\"0x%08x\"%s></OUTLINERECT>\n"),
         (int)x_, (int)y_, (int)width_, (int)height_, x_, y_, width_, height_, 
         (int)lineWidth_, lineWidth_, lineStyle_, m_argbLineColor, tszVisibility);
   
   }
 
   pArray->AppendData(tszBuffer);
}
void CXTPMarkupUIElement::Measure(CXTPMarkupDrawingContext* pDC, CSize szAvailableSize)
{
	if (GetVisibility() == xtpMarkupVisibilityCollapsed)
	{
		m_bMeasureDirty = TRUE;
		m_bNeverMeasured = FALSE;
		m_szPreviousAvailableSize = szAvailableSize;
		m_szDesiredSize = CSize(0, 0);
		return;
	}

	if ((!m_bMeasureDirty && !m_bNeverMeasured) && (szAvailableSize == m_szPreviousAvailableSize) && !pDC->IsPrinting())
	{
		return;
	}

	m_bNeverMeasured = FALSE;

	m_bArrangeDirty = TRUE;

	m_bMeasureInProgress = TRUE;
	CSize size = MeasureCore(pDC, szAvailableSize);
	m_bMeasureInProgress = FALSE;

	m_szDesiredSize = size;
	m_szPreviousAvailableSize = szAvailableSize;
	m_bMeasureDirty = pDC->IsPrinting() ? TRUE : FALSE;
}
void CXTPMarkupUIElement::Arrange(CRect rcFinalRect)
{
	if (GetVisibility() == xtpMarkupVisibilityCollapsed)
	{
		m_rcFinalRect = rcFinalRect;
		m_bArrangeDirty = FALSE;
		m_bNeverArranged = FALSE;
		return;
	}

	if (m_bNeverMeasured)
	{
		CXTPMarkupDrawingContext dc(GetMarkupContext());
		Measure(&dc, rcFinalRect.Size());
	}

	if ((m_bArrangeDirty || m_bNeverArranged) || (rcFinalRect != m_rcFinalRect))
	{
		m_bNeverArranged = FALSE;
		m_bArrangeInProgress = TRUE;
		ArrangeCore(rcFinalRect);
		m_bArrangeInProgress = FALSE;

		UpdateBoundRect();
	}

	m_rcFinalRect = rcFinalRect;
	m_bArrangeDirty = FALSE;
}
void tMercuryControlSeparator::UpdateGradient()
{
    tMercuryStyle* style = GetMercuryStyle();
    if( style == 0 || !GetVisibility() )
    {
        return;
    }

    m_Gradient.setStops(QGradientStops());

    QColor color = style->GetColor(tMercuryStyle::eColorRoleSelectionHighlight);
    color.setAlphaF(m_Alpha);

    m_Gradient.setStart(0, 0);
    if( m_IsVertical )
    {
        m_Gradient.setFinalStop(0, height());
    }
    else
    {
        m_Gradient.setFinalStop(width(), 0);
    }

    m_Gradient.setColorAt(0.5, color);
    color.setAlpha(0);
    m_Gradient.setColorAt(0, color);
    m_Gradient.setColorAt(1, color);
}
示例#8
0
void g2Controller::__MouseHover(int x, int y)
{
    // Ignore if not visible
    if(!GetVisibility())
        return;
    
    // Update mouse to localized positions
    x -= pX;
    y -= pY;
    
    // If the user is moving and pressing, then do a drag event
    if(InController(x, y) && ((ControllerState & g2ControllerState_Pressed) != 0) )
        __MouseDrag(x, y);
    
    // Update the hovering state
    if(InController(x, y))
        ControllerState |= g2ControllerState_Hover;
    // Remove if needed
    else if((ControllerState & g2ControllerState_Hover) != 0)
        ControllerState ^= g2ControllerState_Hover;
    
    // Update the hovering actions
    MouseHover(x, y);
    
    // Update all children
    for(ChildObjectsIt Child = ChildObjects.begin(); Child != ChildObjects.end(); Child++)
        (*Child)->__MouseHover(x, y);
}
void g2Controller::__MouseHover(int x, int y)
{
    // Ignore if not visible
    if(!GetVisibility())
        return;
    
    // Update mouse to localized positions
    x -= pX;
    y -= pY;
    
    // If the user is moving and pressing, then do a drag event
    if(InController(x, y) && ControllerState == g2ControllerState_Pressed)
        __MouseDrag(x, y);
    // Else, if we are out of the controller, we are done dragging
    if(!InController(x, y) && ControllerState == g2ControllerState_Pressed)
        ControllerState = g2ControllerState_None;
    
    // Update the hovering actions
    MouseHover(x, y);
    
    // Update all children
    int QueueSize = (int)ChildObjects.size();
    for(int i = 0; i < QueueSize; i++)
    {
        // Get child
        g2Controller* Child = ChildObjects.front();
        ChildObjects.pop();
        
        // Update child with localized coordinates
        Child->__MouseHover(x, y);
        
        // Put back
        ChildObjects.push(Child);
    }
}
void g2Controller::__MouseDrag(int x, int y)
{
    // Ignore if not visible
    if(!GetVisibility())
        return;
    
    // No need to change coordinates; they
    // are already localized by the calling parent
    
    // Update mouse drag
    MouseDrag(x, y);
    
    // Update all children
    int QueueSize = (int)ChildObjects.size();
    for(int i = 0; i < QueueSize; i++)
    {
        // Get child
        g2Controller* Child = ChildObjects.front();
        ChildObjects.pop();
        
        // Update child mouse drags
        Child->__MouseDrag(x, y);
        
        // Put back
        ChildObjects.push(Child);
    }
}
示例#11
0
bool CDigitanksEntity::ShouldRenderTransparent() const
{
	float flVisibility = GetVisibility();
	if (flVisibility < 1)
		return true;

	return BaseClass::ShouldRenderTransparent();
}
BOOL CXTPMarkupUIElement::GetLayoutClip(CRect& rc) const
{
	if (GetVisibility() != xtpMarkupVisibilityVisible)
	{
		rc.SetRectEmpty();
		return TRUE;
	}
	return FALSE;
}
示例#13
0
void SSection::Tick( const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime )
{	
	if( GetVisibility() == EVisibility::Visible )
	{
		KeyAreas.Reset();
		GetKeyAreas( ParentSectionArea, KeyAreas );

		SectionInterface->Tick(AllottedGeometry, ParentGeometry, InCurrentTime, InDeltaTime);
	}
}
示例#14
0
template<class T> void HTMLElementDisplay<T>::DrawThisOnly (DISPLAY_INT x, DISPLAY_INT y, WebGraphics *gc)
{
	WEBC_DEBUG_TIMER_START(WEBC_DEBUG_HTMLELEMENTDISPLAY_DRAWTHISONLY);

	if (GetVisibility() != TU_VISIBILITY_HIDE)
	{
		T::DrawThisOnly(x,y,gc);
	}

	WEBC_DEBUG_TIMER_STOP(WEBC_DEBUG_HTMLELEMENTDISPLAY_DRAWTHISONLY);
}
示例#15
0
float CDigitanksEntity::GetVisibility() const
{
	CDigitanksGame* pGame = DigitanksGame();
	if (!pGame)
		return 0;

	if (!m_bVisibilityDirty)
		return m_flVisibility;

	return GetVisibility(pGame->GetCurrentLocalDigitanksPlayer());
}
示例#16
0
	bool IComponent::IsVisible() const {
		boost::shared_ptr<ComponentInterface> pInterface = GetGlobalInterface();
		if (pInterface == nullptr || !pInterface->Visible)
			return false;

		for (auto pParent = getThis<IComponent>(); pParent != nullptr; pParent = pParent->GetUIParent()) {
			if (!pParent->GetVisibility())
				return false;
		}

		return true;
	}
void edbPackageVariable::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
    if (properties)
    {
        CreateListColumns(properties);

        properties->AppendItem(_("Name"), GetName());
        properties->AppendItem(_("OID"), GetOid());
        properties->AppendItem(_("Data type"), GetDataType());
        properties->AppendItem(_("Visibility"), GetVisibility());
    }
}
示例#18
0
文件: cpu.cpp 项目: BSVino/Digitanks
void CCPU::ModifyContext(class CRenderingContext* pContext) const
{
	BaseClass::ModifyContext(pContext);

	if (GameServer()->GetGameTime() - m_flConstructionStartTime < 3)
	{
		pContext->SetBlend(BLEND_ALPHA);
		pContext->SetColor(Color(255, 255, 255));
		pContext->SetAlpha(GetVisibility() * RemapValClamped((float)(GameServer()->GetGameTime() - m_flConstructionStartTime), 0.0f, 2.0f, 0.0f, 1.0f));
		pContext->Translate(Vector(0, 0, RemapValClamped((float)(GameServer()->GetGameTime() - m_flConstructionStartTime), 0.0f, 3.0f, -3.0f, 0.0f)));
	}
}
示例#19
0
void CDigitanksEntity::ModifyContext(CRenderingContext* pContext) const
{
	BaseClass::ModifyContext(pContext);

	CDigitanksPlayer* pTeam = DigitanksGame()->GetCurrentPlayer();

	float flVisibility = GetVisibility();
	if (flVisibility < 1)
	{
		pContext->SetAlpha(flVisibility);
		pContext->SetBlend(BLEND_ALPHA);
	}
}
示例#20
0
void g2Controller::__Update(float dT)
{
    // Ignore if not visible
    if(!GetVisibility())
        return;
    
    // Update self
    Update(dT);
    
    // Update all children
    for(ChildObjectsIt Child = ChildObjects.begin(); Child != ChildObjects.end(); Child++)
        (*Child)->__Update(dT);
}
示例#21
0
void g2Controller::__KeyEvent(unsigned char key, bool IsSpecial)
{
    // Ignore if not visible
    if(!GetVisibility())
        return;
    
    // Update key event
    KeyEvent(key, IsSpecial);
    
    // Update all children
    for(ChildObjectsIt Child = ChildObjects.begin(); Child != ChildObjects.end(); Child++)
        (*Child)->__KeyEvent(key, IsSpecial);
}
示例#22
0
文件: cpu.cpp 项目: BSVino/Digitanks
void CCPU::OnRender(class CGameRenderingContext* pContext) const
{
	BaseClass::OnRender(pContext);

	if (m_iFanModel == ~0)
		return;

	if (GetVisibility() == 0)
		return;

	CGameRenderingContext r(GameServer()->GetRenderer(), true);

	r.SetUniform("bColorSwapInAlpha", true);

	if (GetDigitanksPlayer())
		r.SetUniform("vecColorSwap", GetDigitanksPlayer()->GetColor());
	else
		r.SetUniform("vecColorSwap", Color(255, 255, 255, 255));

	float flVisibility = GetVisibility();

	if (flVisibility < 1 && !GameServer()->GetRenderer()->IsRenderingTransparent())
		return;

	if (flVisibility == 1 && GameServer()->GetRenderer()->IsRenderingTransparent())
		return;

	if (GameServer()->GetRenderer()->IsRenderingTransparent())
	{
		r.SetAlpha(GetVisibility());
		if (r.GetAlpha() < 1)
			r.SetBlend(BLEND_ALPHA);
	}

	r.Rotate(m_flFanRotation, Vector(0, 0, 1));

	r.RenderModel(m_iFanModel);
}
示例#23
0
void CDigitanksEntity::StartTurn()
{
	// Recache it and make sure it's not dirty.
	DirtyVisibility();
	GetVisibility();

	float flHealth = m_flHealth;
	m_flHealth = Approach(m_flTotalHealth, m_flHealth, HealthRechargeRate());

	if (flHealth - m_flHealth < 0)
		DigitanksGame()->OnTakeDamage(this, NULL, NULL, flHealth - m_flHealth, true, false);

	m_ahSupplyLinesIntercepted.clear();
}
void SCaptureRegionWidget::Deactivate(bool bKeepChanges)
{
	if (GetVisibility() != EVisibility::Hidden)
	{
		SetVisibility(EVisibility::Hidden);

		bIgnoreExistingCaptureRegion = false;

		if (!bKeepChanges)
		{
			GetHighResScreenshotConfig().UnscaledCaptureRegion = OriginalCaptureRegion;
		}
	}
}
示例#25
0
文件: TzCtlTAB.cpp 项目: DeegC/10d
TZPainterCtrl *
TZNoteBook::IsDeletable( )
{
#ifdef DEBUG_ALL
   TraceLineS( "TZNoteBook::IsDeletable","" );
#endif
   if ( m_bDeletable == FALSE )
      return( 0 );

   if ( IsSelected( ) && GetVisibility( ) == 0 )
   {
      zSHORT nTabCnt;
      m_bDeletable = FALSE;

      if ( (nTabCnt = GetItemCount( )) == 0 )
      {
         return( this );
      }
      else
      {
         TZNotePage *pNotePage = m_pZNotePage;
         while ( pNotePage )
         {
            if ( nTabCnt == 1 ||
                 pNotePage->GetVisibility( ) <= 1 )  // at least visible
            {
               return( pNotePage );
            }

            pNotePage = pNotePage->m_pNext;
         }

         // If we got out of the above loop, we didn't locate a "visible"
         // tab, so let's find out who the tab control thinks is active
         // and make that tab visible.
         zSHORT nTabIdx = GetCurSel( );
         pNotePage = m_pZNotePage;
         while ( pNotePage )
         {
            if ( pNotePage && pNotePage->m_nTabIdx == nTabIdx )
               return( pNotePage );

            pNotePage = pNotePage->m_pNext;
         }
      }
   }

   return( 0 );
}
示例#26
0
float CDigitanksEntity::GetVisibility()
{
	CDigitanksGame* pGame = DigitanksGame();
	if (!pGame)
		return 0;

	if (!m_bVisibilityDirty)
		return m_flVisibility;

	float flOldVisibility = m_flVisibility;

	CDigitanksPlayer* pLocalPlayer = pGame->GetCurrentLocalDigitanksPlayer();
	m_flVisibility = GetVisibility(pLocalPlayer);

	Vector vecOrigin = GetGlobalOrigin();

	// Find the nearest entity in the local team. If he's close enough, reduce this unit's concealment.
	CDigitanksEntity* pOther = this;
	while (true)
	{
		pOther = CBaseEntity::FindClosest<CDigitanksEntity>(vecOrigin, pOther);

		if (!pOther)
			break;

		if (pOther->Distance(vecOrigin) > 20)
			break;

		if (pOther == this)
			continue;

		if (pOther->GetDigitanksPlayer() != pLocalPlayer)
			continue;

		m_flVisibility = 1 - ((1-m_flVisibility)/2);
		break;
	}

	bool bBecameVisible = (flOldVisibility < 0.25f && m_flVisibility >= 0.25f);
	bool bBecameFullyVisible = (flOldVisibility < 1.0f && m_flVisibility >= 1.0f);

	if (bBecameFullyVisible)
		CallOutput("OnBecomeFullyVisible");
	if (bBecameVisible)
		CallOutput("OnBecomeVisible");

	m_bVisibilityDirty = false;
	return m_flVisibility;
}
void g2Controller::__MouseClick(g2MouseButton button, g2MouseClick state, int x, int y)
{
    // Ignore if not visible
    if(!GetVisibility())
        return;
    
    // Update mouse to localized positions
    x -= pX;
    y -= pY;
    
    // Are we in this object's volume and do we have a full left-click?
    if(InController(x, y) && button == g2MouseButton_Left && state == g2MouseClick_Down)
        ControllerState = g2ControllerState_Pressed;
    
    // Else, if there is a mouse release AND we are coming from a pressed state....
    else if(InController(x, y) && button == g2MouseButton_Left && state == g2MouseClick_Up && ControllerState == g2ControllerState_Pressed)
        ControllerState = g2ControllerState_Clicked;
    
    // Else, reset to either hover or none...
    else if(InController(x, y))
        ControllerState = g2ControllerState_Hover;
    
    // Else, no hovering, just nothing
    else
        ControllerState = g2ControllerState_None;
    
    // Update mouse click
    MouseClick(button, state, x, y);
    
    // Update all children
    int QueueSize = (int)ChildObjects.size();
    for(int i = 0; i < QueueSize; i++)
    {
        // Get child
        g2Controller* Child = ChildObjects.front();
        ChildObjects.pop();
        
        // Update child window event
        Child->__MouseClick(button, state, x, y);
        
        // Put back
        ChildObjects.push(Child);
    }
    
    // Execute callback
    if(!GetDisabled() && GetControllerState() == g2ControllerState_Clicked && PressedCallback != 0)
        PressedCallback(this);
}
示例#28
0
void CDigitanksEntity::CalculateVisibility()
{
	if (!DigitanksGame())
		return;

	for (size_t i = 0; i < DigitanksGame()->GetNumPlayers(); i++)
	{
		if (!DigitanksGame()->GetDigitanksPlayer(i))
			continue;

		DigitanksGame()->GetDigitanksPlayer(i)->CalculateEntityVisibility(this);
	}

	m_flVisibility = GetVisibility(DigitanksGame()->GetCurrentLocalDigitanksPlayer());
	m_bVisibilityDirty = false;
}
示例#29
0
void g2Controller::__MouseDrag(int x, int y)
{
    // Ignore if not visible
    if(!GetVisibility())
        return;
    
    // No need to change coordinates; they
    // are already localized by the calling parent
    
    // Update mouse drag
    MouseDrag(x, y);
    
    // Update all children
    for(ChildObjectsIt Child = ChildObjects.begin(); Child != ChildObjects.end(); Child++)
        (*Child)->__MouseDrag(x, y);
}
示例#30
0
void CStructure::PostRender() const
{
	BaseClass::PostRender();

	if (GameServer()->GetRenderer()->IsRenderingTransparent() && (m_flConstructionStartTime > 0) && GetVisibility() > 0)
	{
		CGameRenderingContext c(GameServer()->GetRenderer(), true);
		c.Translate(GetGlobalOrigin());
		c.Scale(m_flScaffoldingSize, m_flScaffoldingSize, m_flScaffoldingSize);
		c.SetBlend(BLEND_ADDITIVE);
		c.SetAlpha(GetVisibility() * 0.2f * RemapValClamped((float)(GameServer()->GetGameTime() - m_flConstructionStartTime), 0.0f, 3.0f, 0.0f, 1.0f));
		c.SetDepthMask(false);
		c.SetBackCulling(false);
		c.RenderModel(m_iScaffolding);
	}
}