예제 #1
0
void Joint::build(const Vector3d &v, const Rotation &r, bool dynamics)
{
	if (m_bodyNum != BODY_NUM) { return; }
	assert(m_world);
	m_joint = createJoint(m_bodies[0], m_bodies[1]);

	Parts *parts = (Parts*) dBodyGetData(m_bodies[1]);
	assert(parts);
	double x, y, z;
	parts->givePosition(x, y, z);
	m_rotv.set(x, y, z);
	
	m_rotv -= m_anchor;
	
	Vector3d av = m_anchor;
	av.rotate(r);
	av += v;
	applyAnchor(av.x(), av.y(), av.z());

	if (m_fixed) {
		dJointSetFixed(m_joint);
	}

	if (dynamics) {
		m_jfb = new dJointFeedback;
		dJointSetFeedback(m_joint, m_jfb);
	}
}
	void ComponentWidget::updateClientDimensions()
	{
		Size previousSize = mClientDimensions.size;

		mClientDimensions.position = Point::ZERO;
		mClientDimensions.size = mWidgetDesc->widget_dimensions.size;

		if(mSkinElement != NULL)
		{
			mClientDimensions.position.x = mSkinElement->getBorderThickness(BORDER_LEFT);
			mClientDimensions.position.y = mSkinElement->getBorderThickness(BORDER_TOP);
			mClientDimensions.size.width = mWidgetDesc->widget_dimensions.size.width - (mSkinElement->getBorderThickness(BORDER_LEFT) + mSkinElement->getBorderThickness(BORDER_RIGHT));
			mClientDimensions.size.height = mWidgetDesc->widget_dimensions.size.height - (mSkinElement->getBorderThickness(BORDER_TOP) + mSkinElement->getBorderThickness(BORDER_BOTTOM));
		}

		// Get difference.  A larger size indicates a positive difference
		Size difference = mClientDimensions.size - previousSize;

		// Handle anchoring for Components
		for(std::map<Ogre::String,Widget*>::iterator it = mComponents.begin(); it != mComponents.end(); ++it)
		{
			applyAnchor((*it).second,difference);
		}

		WidgetEventArgs args(this);
		fireWidgetEvent(WIDGET_EVENT_CLIENTSIZE_CHANGED,args);

		redraw();
	}
예제 #3
0
bool Label::setAnchorIndex(int _index) {
    if (_index >= int(m_options.anchors.count) || _index < 0) {
        return false;
    }
    m_anchorIndex = _index;

    applyAnchor(m_options.anchors[m_anchorIndex]);

    return true;
}
예제 #4
0
void Label::setParent(Label& _parent, bool _definePriority, bool _defineCollide) {
    m_parent = &_parent;

    if (_definePriority) {
        m_options.priority = _parent.options().priority + 0.5f;
    }

    if (_defineCollide) {
        m_options.collide = _parent.options().collide;
    }

    applyAnchor(m_options.anchors[m_anchorIndex]);
}