Esempio n. 1
0
/*
================================================
idMenuHandler::UpdateMenuDisplay
================================================
*/
void idMenuHandler::UpdateMenuDisplay( int menu ) {
	
	if ( menuScreens[ menu ] != NULL ) {
		menuScreens[ menu ]->Update();
	}

	UpdateChildren();

}
Esempio n. 2
0
   bool Layout::Update(const ActionMap & actions, unsigned int tElapsed)  {
      if (_layoutChanged)  {
         std::vector<Control*>::iterator iter = _children.begin();
         int curWide = _padding, curTall = _padding, maxHeight = 0;

         switch (_layout)  {
            case None:
               // Don't move controls
               _layoutChanged = false;
               break;
            case Grid:
               // Grid of controls
               for (; iter != _children.end(); iter++)  {
                  if (curWide + (*iter)->Width() > width)  {
                     curTall += maxHeight + _padding;
                     curWide = _padding;
                     maxHeight = 0;
                  }

                  if ((*iter)->Height() > static_cast<unsigned int>(maxHeight)) maxHeight = (int) (*iter)->Height();

                  _moveChildRelative(*iter, curWide, curTall);
                  curWide += (*iter)->Width() + _padding;
               }
               
               _layoutChanged = false;
               break;
            case HorizontalLine:
               // Horizontal line of controls
               for (; iter != _children.end(); iter++)  {
                  if (curWide + static_cast<int>((*iter)->Width()) > Right()) break;

                  _moveChildRelative(*iter, curWide, 0);
                  curWide += (*iter)->Width() + _padding;
               }

               _layoutChanged = false;
               break;
            case VerticalLine:
               // Vertical line of controls
               for (; iter != _children.end(); iter++)  {                 
                  if (curTall > Bottom()) break;

                  _moveChildRelative(*iter, 0, curTall);
                  curTall += (*iter)->Height() + _padding;
               }

               _layoutChanged = false;
               break;
         }
      }

      UpdateChildren(actions, tElapsed);

      return Collide(actions.GetInputState()->mouseX, actions.GetInputState()->mouseY);
   }
Esempio n. 3
0
void VSP_Window::resizeFromParent(int x_in, int y_in, int w_in, int h_in)
{
    if ( m_GeomScreen && shown() )
    {
        m_x = x_in;
        m_y = y_in;
    }

    Fl_Double_Window::resize( x_in, y_in, w_in, h_in );
    UpdateChildren();
}
void
CMVarNode::ShouldUpdate
	(
	const JBoolean update
	)
{
	itsShouldUpdateFlag = update;
	if (itsShouldUpdateFlag && itsNeedsUpdateFlag)
		{
		UpdateChildren();
		}
}
void CMyTreeView::UpdateChildren(HTREEITEM hParent,LPITEMIDLIST pidlParent)
{
	HTREEITEM hChild;
	TVITEMEX tvItem;
	LPITEMIDLIST pidl = NULL;
	BOOL bRes;

	hChild = TreeView_GetChild(m_hTreeView,hParent);

	if(hChild != NULL)
	{
		tvItem.mask		= TVIF_PARAM;
		tvItem.hItem	= hChild;
		bRes = TreeView_GetItem(m_hTreeView,&tvItem);

		if(bRes)
		{
			pidl = UpdateItemInfo(pidlParent,(int)tvItem.lParam);

			UpdateChildren(hChild,pidl);

			while((hChild = TreeView_GetNextItem(m_hTreeView,hChild,TVGN_NEXT)) != NULL)
			{
				tvItem.mask		= TVIF_PARAM;
				tvItem.hItem	= hChild;
				bRes = TreeView_GetItem(m_hTreeView,&tvItem);

				if(bRes)
				{
					pidl = UpdateItemInfo(pidlParent,(int)tvItem.lParam);

					UpdateChildren(hChild,pidl);
				}
			}
		}
	}
}
/* Renames an item in the treeview. This essentially involves changing
the items display text, and updating it's pidl. Note that the children of
this item MUST ALL BE UPDATED as well, since their pidl's will also
change. */
void CMyTreeView::RenameItem(HTREEITEM hItem, const TCHAR *szFullFileName)
{
	TVITEMEX	tvItem;
	ItemInfo_t	*pItemInfo = NULL;
	LPITEMIDLIST	pidlParent;
	SHFILEINFO	shfi;
	TCHAR		szFileName[MAX_PATH];
	HRESULT		hr;
	BOOL		res;

	if(hItem == NULL)
		return;

	tvItem.mask		= TVIF_PARAM;
	tvItem.hItem	= hItem;
	res = TreeView_GetItem(m_hTreeView,&tvItem);

	if(res)
	{
		pItemInfo = &m_pItemInfo[(int)tvItem.lParam];

		CoTaskMemFree(pItemInfo->pidl);

		StringCchCopy(szFileName, SIZEOF_ARRAY(szFileName), szFullFileName);
		PathStripPath(szFileName);

		hr = GetIdlFromParsingName(szFullFileName,&pItemInfo->pidl);

		pidlParent = pItemInfo->pidl;

		if(SUCCEEDED(hr))
		{
			SHGetFileInfo(szFullFileName,NULL,&shfi,sizeof(shfi),SHGFI_SYSICONINDEX);

			tvItem.mask				= TVIF_HANDLE|TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
			tvItem.hItem			= hItem;
			tvItem.pszText			= szFileName;
			tvItem.iImage			= shfi.iIcon;
			tvItem.iSelectedImage	= shfi.iIcon;
			TreeView_SetItem(m_hTreeView,&tvItem);

			/* Now recursively go through each of this items children and
			update their pidl's. */
			UpdateChildren(hItem,pidlParent);
		}
	}
}
Esempio n. 7
0
void VSP_Window::resizeFromChild(int x_in, int y_in, int w_in, int h_in, VSP_Window * child)
{
    if ( m_GeomScreen && shown() )
    {
        m_x = x_in;
        m_y = y_in;
    }

    Fl_Double_Window::resize( x_in, y_in, w_in, h_in );

    bool update = ( x_in != x() || y_in != y() || w_in != w() || h_in != h() );
    if ( update )
    {
//        UpdateParent();
        UpdateChildren( child );
    }
}
Esempio n. 8
0
void VSP_Window::resize( int x_in, int y_in, int w_in, int h_in )
{
    if ( m_GeomScreen && shown() )
    {
        m_x = x_in;
        m_y = y_in;
    }

    bool update_par = ( x_in != x() || y_in != y() || w_in != w() || h_in != h() );

    Fl_Double_Window::resize(x_in,y_in,w_in,h_in);

    // Update parents location if the parent exists

    if ( m_Parent && update_par )
    {
 //       UpdateParent();
    }

    UpdateChildren();
}
void
CMVarNode::Receive
	(
	JBroadcaster*	sender,
	const Message&	message
	)
{
	if (sender == CMGetLink() && ShouldUpdate(message))
		{
		// root node only

		if (itsShouldUpdateFlag)
			{
			UpdateChildren();
			}
		else
			{
			itsNeedsUpdateFlag = kJTrue;
			}
		}

	else if (sender == itsValueCommand &&
			 message.Is(CMVarCommand::kValueUpdated))
		{
		const CMVarCommand::ValueMessage& info =
			dynamic_cast<const CMVarCommand::ValueMessage&>(message);

		SetValid(kJTrue);
		Update(info.GetRootNode());
		}
	else if (sender == itsValueCommand &&
			 message.Is(CMVarCommand::kValueFailed))
		{
		SetValue(itsValueCommand->GetData());
		MakePointer(kJFalse);
		}

	else if (sender == itsContentCommand &&
			 message.Is(CMVarCommand::kValueUpdated))
		{
		const CMVarCommand::ValueMessage& info =
			dynamic_cast<const CMVarCommand::ValueMessage&>(message);

		CMVarNode* root = info.GetRootNode();

		// value or pointer

		if (!root->HasChildren())
			{
			DeleteAllChildren();
			CMVarNode* child = (CMGetLink())->CreateVarNode(this, root->GetName(),
															root->GetFullName(),
															root->GetValue());
			assert( child != NULL );
			child->MakePointer(root->itsIsPointerFlag);
			}

		// struct or static array

		else if (SameElements(root))
			{
			MergeChildren(root);
			}
		else
			{
			StealChildren(root);
			}
		}
	else if (sender == itsContentCommand &&
			 message.Is(CMVarCommand::kValueFailed))
		{
		DeleteAllChildren();
		CMVarNode* child = (CMGetLink())->CreateVarNode(this, "", "", itsContentCommand->GetData());
		assert( child != NULL );
		child->SetValid(kJFalse);
		}

	else
		{
		JNamedTreeNode::Receive(sender, message);
		}
}
Esempio n. 10
0
void cUIObject::Update()
{
	UpdateWorldTM();
	UpdateChildren();
}
Esempio n. 11
0
void SceneNode::Update(sf::Time delta)
{
	UpdateCurrent(delta);
	UpdateChildren(delta);
}
Esempio n. 12
0
float C4ParticleValueProvider::GetValue(C4Particle *forParticle)
{
	UpdateChildren(forParticle);
	return (this->*valueFunction)(forParticle);
}
Esempio n. 13
0
void Object::OnUpdate() {
	UpdateChildren();
}
Esempio n. 14
0
void Actor::Update(float dt)
{
	UpdateComponents(dt);
	UpdateChildren(dt);
}
Esempio n. 15
0
	void EntityManager::Update(float deltaTime, SODA::Event currentEvent)
	{
		UpdateChildren(deltaTime, currentEvent);
	}
Esempio n. 16
0
void
SceneNode::Update( sf::Time dt, CommandQueue& commands ) {
    UpdateCurrent( dt, commands );
    UpdateChildren( dt, commands );
}
Esempio n. 17
0
    bool Entity::Update()
    {
        float currentUpdateTime = EffectsLibrary::GetCurrentUpdateTime();

        // Update speed in pixels per second
        if (_updateSpeed && _speed)
        {
            _pixelsPerSecond = _speed / currentUpdateTime;
            _speedVec.x = sinf(_direction / 180.0f * (float)M_PI) * _pixelsPerSecond;
            _speedVec.y = cosf(_direction / 180.0f * (float)M_PI) * _pixelsPerSecond;

            _x += _speedVec.x * _z;
            _y -= _speedVec.y * _z;
        }

        // update the gravity
        if (_weight != 0)
        {
            _gravity += _weight / currentUpdateTime;
            _y += (_gravity / currentUpdateTime) * _z;
        }

        // set the matrix if it is relative to the parent
        if (_relative)
            _matrix.Set(cosf(_angle / 180.f * (float)M_PI), sinf(_angle / 180.0f * (float)M_PI), -sinf(_angle / 180.0f * (float)M_PI), cosf(_angle / 180.0f * (float)M_PI));

        // calculate where the entity is in the world
        if (_parent && _relative)
        {
            _z = _parent->_z;
            _matrix = _matrix.Transform(_parent->_matrix);
            Vector2 rotVec = _parent->_matrix.TransformVector(Vector2(_x, _y));
            if (_z != 1.0f)
            {
                _wx = _parent->_wx + rotVec.x * _z;
                _wy = _parent->_wy + rotVec.y * _z;
            }
            else
            {
                _wx = _parent->_wx + rotVec.x;
                _wy = _parent->_wy + rotVec.y;
            }
            _relativeAngle = _parent->_relativeAngle + _angle;
        }
        else
        {
            // If parent setz(parent.z)
            _wx = _x;
            _wy = _y;
        }

        if (!_parent)
            _relativeAngle = _angle;

        // update animation frame
        if (_avatar && _animating)
        {
            _currentFrame += _framerate / currentUpdateTime;
            if (_animateOnce)
            {
                if (_currentFrame > _avatar->GetFramesCount() - 1)
                {
                    _currentFrame = (float)(_avatar->GetFramesCount() - 1);
                }
                else if (_currentFrame <= 0)
                {
                    _currentFrame = 0;
                }
            }
        }

        // update the Axis Aligned Bounding Box
        if (_AABB_Calculate)
            UpdateBoundingBox();

        // update the radius of influence
        if (_radiusCalculate)
            UpdateEntityRadius();

        // update the children
        UpdateChildren();

        return true;
    }
Esempio n. 18
0
//--------------------------------------------------------------------------------
void Timeline::OnUpdate		(int _step, int _lastStep, bool _isIterationStep, float _dt)
{
	if(!_isIterationStep && _step > _lastStep)
	{
		TWEEN_ASSERT(_dt >= 0, "Delta should be positive");
		
		float currentDelta = IsReverse(_lastStep) ? (-_dt - 1.0f) : (_dt + 1.0f);
		UpdateChildren(currentDelta);
		return;
	}

	if(!_isIterationStep && _step < _lastStep)
	{
		TWEEN_ASSERT(_dt <= 0, "Delta should be negative");
		float currentDelta = IsReverse(_lastStep) ? (-_dt - 1.0f) : (_dt + 1.0f);
		UpdateChildren(currentDelta, true);
		return;
	}

	TWEEN_ASSERT(_isIterationStep, "Not an iteration step and last step equal to step should not happen");

	if(_step > _lastStep)
	{
		if(IsReverse(_step))
        {
			ForceEndValues();
        }
		else
        {
			ForceStartValues();
        }

		UpdateChildren(_dt);
	}
	else if( _step < _lastStep)
	{
		if(IsReverse(_step))
        {
			ForceStartValues();
        }
		else
        {
			ForceEndValues();
        }

		UpdateChildren(_dt, true);
	}
	else
	{
		float currentDelta = IsReverse(_step) ? -_dt : _dt;

		if(_dt >= 0.0f)
        {
			UpdateChildren(currentDelta);
        }
		else
        {
			UpdateChildren(currentDelta, true);
        }
	}
}