Example #1
0
static CInterfaceGroup *buildLineWithCommand(CInterfaceGroup *commandGroup, CViewText *text)
{
	nlassert(commandGroup);
	nlassert(text);
	CInterfaceGroup *group = new CInterfaceGroup(CViewBase::TCtorParam());
	static int groupId = 0;
	group->setId(NLMISC::toString("%d", groupId++));
	static volatile bool sizeref = 1;
	static volatile sint32 w = 0;
	group->setSizeRef(sizeref);
	group->setW(w);
	group->setResizeFromChildH(true);
	//
	group->addGroup(commandGroup);
	commandGroup->setParent(group);
	text->setParent(group);
	text->setParentPos(commandGroup);
	text->setPosRef(Hotspot_TL);
	text->setParentPosRef(Hotspot_TR);
	group->addView(text);
	return group;
}
Example #2
0
// *********************************************************************************************************
void CDisplayerVisual::onPostRender()
{
	//H_AUTO(R2_CDisplayerVisual_onPostRender)
	if (!getActive()) return;

	// if this entity is currently moving then don't display the 'stop' icon
	// (it is already drawn by the mouse cursor)
	if (getDisplayedInstance() == getEditor().getSelectedInstance()
		&& dynamic_cast<CToolSelectMove *>(getEditor().getCurrentTool()))
	{
		if (_IconInScene)
		{
			_IconInScene->setActive(false);
		}
	}
	else
	{
		if (getDisplayFlag(FlagBadPos))
		{
			if (!_IconInScene && !_IconInSceneCreationFailed)
			{
				CInterfaceManager *pIM = CInterfaceManager::getInstance();
				const char *iconTemplateName = "r2ed_bad_pos_icon";
				// if the in scene 'stop' window wasn't created, then create it now
				CInterfaceGroup *group = CWidgetManager::getInstance()->getParser()->createGroupInstance (iconTemplateName , "ui:interface", NULL, 0);
				if (group)
				{
					_IconInScene = dynamic_cast<CGroupInScene *>(group);
					if (!_IconInScene)
					{
						nlwarning("Template %s has bad type : should be a derived group from CGroupInScene", iconTemplateName);
						delete group;
						_IconInSceneCreationFailed = true;
					}
					else
					{
						// Link to the interface
						CWidgetManager::getInstance()->addWindowToMasterGroup("ui:interface", group);
						CInterfaceGroup *pRoot = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId("ui:interface"));
						group->setParent(pRoot);
						if (pRoot)
							pRoot->addGroup (group);
					}
				}
				else
				{
					_IconInSceneCreationFailed = true;
				}
			}
			if (_IconInScene)
			{
				_IconInScene->setActive(true);
				// tmp set a position above head
				evalIconInScenePos(_IconInScene->Position);
			}
		}
		else
		{
			if (_IconInScene)
			{
				_IconInScene->setActive(false);
			}
		}
	}
}