void CGUIContextMenu::recalculateSize() { IGUISkin* skin = Environment->getSkin(); IGUIFont* font = skin->getFont(EGDF_MENU); if (!font) return; core::rect<s32> rect; rect.UpperLeftCorner = RelativeRect.UpperLeftCorner; s32 width = 100; s32 height = 3; u32 i; for (i=0; i<Items.size(); ++i) { if (Items[i].IsSeparator) { Items[i].Dim.Width = 100; Items[i].Dim.Height = 10; } else { Items[i].Dim = font->getDimension(Items[i].Text.c_str()); Items[i].Dim.Width += 40; if (Items[i].Dim.Width > width) width = Items[i].Dim.Width; } Items[i].PosY = height; height += Items[i].Dim.Height; } height += 5; if (height < 10) height = 10; rect.LowerRightCorner.X = RelativeRect.UpperLeftCorner.X + width; rect.LowerRightCorner.Y = RelativeRect.UpperLeftCorner.Y + height; setRelativePosition(rect); // recalculate submenus for (i=0; i<Items.size(); ++i) { if (Items[i].SubMenu) { // move submenu const s32 w = Items[i].SubMenu->getAbsolutePosition().getWidth(); const s32 h = Items[i].SubMenu->getAbsolutePosition().getHeight(); Items[i].SubMenu->setRelativePosition( core::rect<s32>(width-5, Items[i].PosY, width+w-5, Items[i].PosY+h)); } } }
void CNrpBrowserWindow::_ApplyViewerStyle( core::dimension2du size, CImageGUISkin* skin ) { SImageGUIElementStyle::SBorder margins; if( skin ) { SImageGUIElementStyle& style = skin->Config.GetConfig( this, SImageGUISkinConfig::WindowBrowserViewer, SImageGUISkinConfig::Normal ); margins = style.margin; } setRelativePosition( core::recti( 0, 0, size.Width + margins.Left + margins.Right, size.Height + margins.Top + margins.Bottom ) ); _image = Environment->addImage( core::recti( margins.Left, margins.Top, size.Width + margins.Left, size.Height + margins.Top), this, -1, 0 ); _image->setScaleImage( true ); }
//! constructor CGUIToolBar::CGUIToolBar(IGUIEnvironment* environment, IGUIElement* parent, SINT32 id, rect<SINT32> rectangle) :IGUIToolBar(environment, parent, id, rectangle), ButtonX(5) { #ifdef _DEBUG setDebugName("CGUIToolBar"); #endif // calculate position and find other menubars SINT32 y = 0; SINT32 parentwidth = 100; if (parent) { parentwidth = Parent->getAbsolutePosition().getWidth(); const list<IGUIElement*>::type& children = parent->getChildren(); list<IGUIElement*>::const_iterator it = children.begin(); for (; it != children.end(); ++it) { rect<SINT32> r = (*it)->getAbsolutePosition(); if (r.UpperLeftCorner.x == 0 && r.UpperLeftCorner.y <= y && r.LowerRightCorner.x == parentwidth) y = r.LowerRightCorner.y; } } rect<SINT32> rr; rr.UpperLeftCorner.x = 0; rr.UpperLeftCorner.y = y; SINT32 height = Environment->getSkin()->getSize(EGDS_MENU_HEIGHT); /*IGUISkin* skin = Environment->getSkin(); IGUIFont* font = skin->getFont(); if (font) { SINT32 t = font->getDimension(L"A").Height + 5; if (t > height) height = t; }*/ rr.LowerRightCorner.x = parentwidth; rr.LowerRightCorner.y = rr.UpperLeftCorner.y + height; setRelativePosition(rr); }
//! Moves the icon to the passed slot void CGUIIcon::moveToSlot(IGUIElement* slot) { //check if the slot is usable bool usable = false; u32 size = UsableSlots->size(); for(u32 i = 0; i < size; i++) { if((*UsableSlots)[i] == slot) usable = true; } //if the slot is not usable - make it usable if(!usable) UsableSlots->push_back(slot); //if the slot is in use (if the slot has a children) if(slot->getChildren().getSize()) { /* get the icon from the slot. Gets the last child of the child list, asuming that this is the only child the slot has, and that this child is an CGUIIcon */ CGUIIcon* icon = (CGUIIcon*)(*slot->getChildren().getLast()); //move the icon to where the currently moving icon came from if(Slot) { icon->moveToSlot(Slot); } } //add the currently moving icon to the slot slot->addChild(this); //save the slot Slot = slot; //set the relative position setRelativePosition(core::rect<s32>(core::position2d<s32>(0,0), Texture->getOriginalSize())); }
void CGUIMenu::recalculateSize() { IGUISkin* skin = Environment->getSkin(); IGUIFont* font = skin->getFont(EGDF_MENU); if (!font) { if (Parent && skin) RelativeRect = core::rect<s32>(0,0, Parent->getAbsolutePosition().LowerRightCorner.X, skin->getSize(EGDS_MENU_HEIGHT)); return; } core::rect<s32> rect; rect.UpperLeftCorner.X = 0; rect.UpperLeftCorner.Y = 0; s32 height = font->getDimension(L"A").Height + 5; //if (skin && height < skin->getSize ( EGDS_MENU_HEIGHT )) // height = skin->getSize(EGDS_MENU_HEIGHT); s32 width = 0; s32 i; for (i=0; i<(s32)Items.size(); ++i) { if (Items[i].IsSeparator) { Items[i].Dim.Width = 0; Items[i].Dim.Height = height; } else { Items[i].Dim = font->getDimension(Items[i].Text.c_str()); Items[i].Dim.Width += 20; } Items[i].PosY = width; width += Items[i].Dim.Width; } if (Parent) width = Parent->getAbsolutePosition().getWidth(); rect.LowerRightCorner.X = width; rect.LowerRightCorner.Y = height; setRelativePosition(rect); // recalculate submenus for (i=0; i<(s32)Items.size(); ++i) if (Items[i].SubMenu) { // move submenu s32 w = Items[i].SubMenu->getAbsolutePosition().getWidth(); s32 h = Items[i].SubMenu->getAbsolutePosition().getHeight(); Items[i].SubMenu->setRelativePosition( core::rect<s32>(Items[i].PosY, height , Items[i].PosY+w-5, height+h)); } }
//! Sets the new position of the cursor. void CWin32CursorControl::setRelativePosition(const core::position2d<f32> &pos) { setRelativePosition(pos.X, pos.Y); }
void CGUIContextMenu::recalculateSize() { IGUIFont* font = Environment->getSkin()->getFont(EGDF_MENU); if (!font) return; core::rect<s32> rect; rect.UpperLeftCorner = RelativeRect.UpperLeftCorner; u32 width = 100; u32 height = 3; u32 i; for (i=0; i<Items.size(); ++i) { if (Items[i].IsSeparator) { Items[i].Dim.Width = 100; Items[i].Dim.Height = 10; } else { Items[i].Dim = font->getDimension(Items[i].Text.c_str()); Items[i].Dim.Width += 40; if (Items[i].Dim.Width > width) width = Items[i].Dim.Width; } Items[i].PosY = height; height += Items[i].Dim.Height; } height += 5; if (height < 10) height = 10; rect.LowerRightCorner.X = RelativeRect.UpperLeftCorner.X + width; rect.LowerRightCorner.Y = RelativeRect.UpperLeftCorner.Y + height; setRelativePosition(rect); // recalculate submenus for (i=0; i<Items.size(); ++i) { if (Items[i].SubMenu) { // move submenu const s32 w = Items[i].SubMenu->getAbsolutePosition().getWidth(); const s32 h = Items[i].SubMenu->getAbsolutePosition().getHeight(); core::rect<s32> subRect(width-5, Items[i].PosY, width+w-5, Items[i].PosY+h); // if it would be drawn beyond the right border, then add it to the left side gui::IGUIElement * root = Environment->getRootGUIElement(); if ( root ) { core::rect<s32> rectRoot( root->getAbsolutePosition() ); if ( getAbsolutePosition().UpperLeftCorner.X+subRect.LowerRightCorner.X > rectRoot.LowerRightCorner.X ) { subRect.UpperLeftCorner.X = -w; subRect.LowerRightCorner.X = 0; } } Items[i].SubMenu->setRelativePosition(subRect); } } }
void CGUIMenu::recalculateSize() { rect<SINT32> clientRect; // client rect of parent if (Parent && Parent->hasType(EGUIET_WINDOW)) { clientRect = static_cast<IGUIWindow*>(Parent)->getClientRect(); } else if (Parent) { clientRect = rect<SINT32>(0, 0, Parent->getAbsolutePosition().getWidth(), Parent->getAbsolutePosition().getHeight()); } else { clientRect = RelativeRect; } IGUISkin* skin = Environment->getSkin(); IGUIFont* font = skin->getFont(EGDF_MENU); if (!font) { if (Parent && skin) RelativeRect = rect<SINT32>(clientRect.UpperLeftCorner.x, clientRect.UpperLeftCorner.y, clientRect.LowerRightCorner.x, clientRect.UpperLeftCorner.y + skin->getSize(EGDS_MENU_HEIGHT)); return; } rect<SINT32> rect; rect.UpperLeftCorner = clientRect.UpperLeftCorner; SINT32 height = font->getDimension(L"A").Height + 5; //if (skin && height < skin->getSize ( EGDS_MENU_HEIGHT )) // height = skin->getSize(EGDS_MENU_HEIGHT); SINT32 width = rect.UpperLeftCorner.x; SINT32 i; for (i = 0; i<(SINT32)Items.size(); ++i) { if (Items[i].IsSeparator) { Items[i].Dim.Width = 0; Items[i].Dim.Height = height; } else { Items[i].Dim = font->getDimension(Items[i].Text.c_str()); Items[i].Dim.Width += 20; } Items[i].PosY = width; width += Items[i].Dim.Width; } width = clientRect.getWidth(); rect.LowerRightCorner.x = rect.UpperLeftCorner.x + width; rect.LowerRightCorner.y = rect.UpperLeftCorner.y + height; setRelativePosition(rect); // recalculate submenus for (i = 0; i<(SINT32)Items.size(); ++i) if (Items[i].SubMenu) { // move submenu SINT32 w = Items[i].SubMenu->getAbsolutePosition().getWidth(); SINT32 h = Items[i].SubMenu->getAbsolutePosition().getHeight(); Items[i].SubMenu->setRelativePosition( Sapphire::rect<SINT32>(Items[i].PosY, height, Items[i].PosY + w - 5, height + h)); } }
//! constructor CGUIMessageBox::CGUIMessageBox(IGUIEnvironment* environment, const wchar_t* caption, const wchar_t* text, s32 flags, IGUIElement* parent, s32 id, core::rect<s32> rectangle) : CGUIWindow(environment, parent, id, rectangle), StaticText(0), OkButton(0), YesButton(0), NoButton(0), CancelButton(0) { #ifdef _DEBUG setDebugName("CGUIMessageBox"); #endif // remove focus Environment->setFocus(0); // remove buttons getMaximizeButton()->remove(); getMinimizeButton()->remove(); if (caption) setText(caption); IGUISkin* skin = Environment->getSkin(); s32 buttonHeight = skin->getSize(EGDS_BUTTON_HEIGHT); s32 buttonWidth = skin->getSize(EGDS_BUTTON_WIDTH); s32 titleHeight = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH)+2; s32 buttonDistance = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH); // add static multiline text core::dimension2d<s32> dim(AbsoluteClippingRect.getWidth() - buttonWidth, AbsoluteClippingRect.getHeight() - (buttonHeight * 3)); core::position2d<s32> pos((AbsoluteClippingRect.getWidth() - dim.Width) / 2, buttonHeight / 2 + titleHeight); StaticText = Environment->addStaticText(text, core::rect<s32>(pos, dim), false, false, this); StaticText->setWordWrap(true); StaticText->grab(); // adjust static text height s32 textHeight = StaticText->getTextHeight(); core::rect<s32> tmp = StaticText->getRelativePosition(); tmp.LowerRightCorner.Y = tmp.UpperLeftCorner.Y + textHeight; StaticText->setRelativePosition(tmp); dim.Height = textHeight; // adjust message box height tmp = getRelativePosition(); s32 msgBoxHeight = textHeight + (s32)(2.5f * buttonHeight) + titleHeight; // adjust message box position tmp.UpperLeftCorner.Y = (parent->getAbsolutePosition().getHeight() - msgBoxHeight) / 2; tmp.LowerRightCorner.Y = tmp.UpperLeftCorner.Y + msgBoxHeight; setRelativePosition(tmp); // add buttons s32 countButtons = 0; if (flags & EMBF_OK) ++countButtons; if (flags & EMBF_CANCEL) ++countButtons; if (flags & EMBF_YES) ++countButtons; if (flags & EMBF_NO) ++countButtons; core::rect<s32> btnRect; btnRect.UpperLeftCorner.Y = pos.Y + dim.Height + buttonHeight / 2; btnRect.LowerRightCorner.Y = btnRect.UpperLeftCorner.Y + buttonHeight; btnRect.UpperLeftCorner.X = (AbsoluteClippingRect.getWidth() - ((buttonWidth + buttonDistance)*countButtons)) / 2; btnRect.LowerRightCorner.X = btnRect.UpperLeftCorner.X + buttonWidth; // add ok button if (flags & EMBF_OK) { OkButton = Environment->addButton(btnRect, this); OkButton->setText(skin->getDefaultText(EGDT_MSG_BOX_OK)); OkButton->grab(); btnRect.LowerRightCorner.X += buttonWidth + buttonDistance; btnRect.UpperLeftCorner.X += buttonWidth + buttonDistance; Environment->setFocus(OkButton); } // add yes button if (flags & EMBF_YES) { YesButton = Environment->addButton(btnRect, this); YesButton->setText(skin->getDefaultText(EGDT_MSG_BOX_YES)); YesButton->grab(); btnRect.LowerRightCorner.X += buttonWidth + buttonDistance; btnRect.UpperLeftCorner.X += buttonWidth + buttonDistance; } // add no button if (flags & EMBF_NO) { NoButton = Environment->addButton(btnRect, this); NoButton->setText(skin->getDefaultText(EGDT_MSG_BOX_NO)); NoButton->grab(); btnRect.LowerRightCorner.X += buttonWidth + buttonDistance; btnRect.UpperLeftCorner.X += buttonWidth + buttonDistance; } // add cancel button if (flags & EMBF_CANCEL) { CancelButton = Environment->addButton(btnRect, this); CancelButton->setText(skin->getDefaultText(EGDT_MSG_BOX_CANCEL)); CancelButton->grab(); btnRect.LowerRightCorner.X += buttonWidth + buttonDistance; btnRect.UpperLeftCorner.X += buttonWidth + buttonDistance; } }
void Badge::setRelativePosition(const QPointF &pos) { setRelativePosition(pos.x(), pos.y()); }
void GUIForumPostItem::setItemData(ForumThread* pThread) { std::wstringstream ss; core::rect<s32> itemRect(5, 0, RelativeRect.getWidth()-5, RelativeRect.getHeight()), startRect; IGUIFont* pFont = Environment->getSkin()->getFont(); startRect = itemRect; itemRect.LowerRightCorner.Y = itemRect.UpperLeftCorner.Y + FPI_AUTHOR_HEIGHT; if ( !m_pTxtAuthor ) { ss << L"Author: " << pThread->getAuthorName().c_str(); m_pTxtAuthor = Environment->addStaticText(ss.str().c_str(), itemRect, false, false, this); m_pTxtAuthor->setOverrideColor(m_colText); m_pTxtAuthor->setTextAlignment( EGUIA_UPPERLEFT, EGUIA_CENTER ); ss.str(L""); } if ( pThread->getTitle().size() ) { offsetRect(itemRect, 0, itemRect.getHeight() + 5); if ( !m_pTxtSubject ) { ss << L"Subject: " << pThread->getTitle().c_str(); m_pTxtSubject = Environment->addStaticText(ss.str().c_str(), itemRect, false, false, this); m_pTxtSubject->setOverrideColor(m_colText); m_pTxtSubject->setTextAlignment( EGUIA_UPPERLEFT, EGUIA_CENTER ); ss.str(L""); } } offsetRect(itemRect, 0, itemRect.getHeight() + 5); if ( !m_pTxtContent ) { ss << pThread->getContent().c_str(); m_pTxtContent = Environment->addStaticText(ss.str().c_str(), itemRect, true, true, this); m_pTxtContent->setBackgroundColor(m_colBkg); m_pTxtContent->setOverrideColor(m_colText); itemRect.LowerRightCorner.Y = itemRect.UpperLeftCorner.Y + m_pTxtContent->getTextHeight(); m_pTxtContent->setRelativePosition( itemRect ); ss.str(L""); } // if this is a mission thread, then we need to create the button to accept the mission if ( pThread->getMissionID() ) { // check which options should be shown MissionMgr& missionMgr = FCModel::instance().GetMissionMgr(); bool bAccepted = missionMgr.isMissionAccepted(pThread->getMissionID()); bool bCompleted = missionMgr.isMissionComplete(pThread->getMissionID()); if ( !bAccepted && !bCompleted ) { offsetRect(itemRect, 0, itemRect.getHeight() + 5); itemRect.LowerRightCorner.Y = itemRect.UpperLeftCorner.Y + 20; core::rect<s32> btnRect = itemRect; ss << "Accept"; btnRect.LowerRightCorner.X = btnRect.UpperLeftCorner.X + pFont->getDimension(ss.str().c_str()).Width + 20; m_pBtnAccept = Environment->addButton(btnRect, this, BTN_ACCEPT, ss.str().c_str()); } } core::rect<s32> myRect = getRelativePosition(); myRect.LowerRightCorner.Y = myRect.UpperLeftCorner.Y + ( itemRect.LowerRightCorner.Y - startRect.UpperLeftCorner.Y ) + 5; setRelativePosition(myRect); m_pThread = pThread; }
void CGUIMessageBox::refreshControls() { // Layout can be seen as 4 boxes (a layoutmanager would be nice) // One box at top over the whole width for title // Two boxes with same height at the middle beside each other for icon and for text // One box at the bottom for the buttons const IGUISkin* skin = Environment->getSkin(); const s32 buttonHeight = skin->getSize(EGDS_BUTTON_HEIGHT); const s32 buttonWidth = skin->getSize(EGDS_BUTTON_WIDTH); const s32 titleHeight = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH)+2; // titlebar has no own constant const s32 buttonDistance = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH); const s32 borderWidth = skin->getSize(EGDS_MESSAGE_BOX_GAP_SPACE); // add the static text for the message core::rect<s32> staticRect; staticRect.UpperLeftCorner.X = borderWidth; staticRect.UpperLeftCorner.Y = titleHeight + borderWidth; staticRect.LowerRightCorner.X = staticRect.UpperLeftCorner.X + skin->getSize(EGDS_MESSAGE_BOX_MAX_TEXT_WIDTH); staticRect.LowerRightCorner.Y = staticRect.UpperLeftCorner.Y + skin->getSize(EGDS_MESSAGE_BOX_MAX_TEXT_HEIGHT); if (!StaticText) { StaticText = Environment->addStaticText(MessageText.c_str(), staticRect, false, false, this); StaticText->setWordWrap(true); StaticText->setSubElement(true); StaticText->grab(); } else { StaticText->setRelativePosition(staticRect); StaticText->setText(MessageText.c_str()); } s32 textHeight = StaticText->getTextHeight(); s32 textWidth = StaticText->getTextWidth() + 6; // +6 because the static itself needs that const s32 iconHeight = IconTexture ? IconTexture->getOriginalSize().Height : 0; if ( textWidth < skin->getSize(EGDS_MESSAGE_BOX_MIN_TEXT_WIDTH) ) textWidth = skin->getSize(EGDS_MESSAGE_BOX_MIN_TEXT_WIDTH) + 6; // no neeed to check for max because it couldn't get larger due to statictextbox. if ( textHeight < skin->getSize(EGDS_MESSAGE_BOX_MIN_TEXT_HEIGHT) ) textHeight = skin->getSize(EGDS_MESSAGE_BOX_MIN_TEXT_HEIGHT); if ( textHeight > skin->getSize(EGDS_MESSAGE_BOX_MAX_TEXT_HEIGHT) ) textHeight = skin->getSize(EGDS_MESSAGE_BOX_MAX_TEXT_HEIGHT); // content is text + icons + borders (but not titlebar) s32 contentHeight = textHeight > iconHeight ? textHeight : iconHeight; contentHeight += borderWidth; s32 contentWidth = 0; // add icon if ( IconTexture ) { core::position2d<s32> iconPos; iconPos.Y = titleHeight + borderWidth; if ( iconHeight < textHeight ) iconPos.Y += (textHeight-iconHeight) / 2; iconPos.X = borderWidth; if (!Icon) { Icon = Environment->addImage(IconTexture, iconPos, true, this); Icon->setSubElement(true); Icon->grab(); } else { core::rect<s32> iconRect( iconPos.X, iconPos.Y, iconPos.X + IconTexture->getOriginalSize().Width, iconPos.Y + IconTexture->getOriginalSize().Height ); Icon->setRelativePosition(iconRect); } contentWidth += borderWidth + IconTexture->getOriginalSize().Width; } else if ( Icon ) { Icon->drop(); Icon->remove(); Icon = 0; } // position text core::rect<s32> textRect; textRect.UpperLeftCorner.X = contentWidth + borderWidth; textRect.UpperLeftCorner.Y = titleHeight + borderWidth; if ( textHeight < iconHeight ) textRect.UpperLeftCorner.Y += (iconHeight-textHeight) / 2; textRect.LowerRightCorner.X = textRect.UpperLeftCorner.X + textWidth; textRect.LowerRightCorner.Y = textRect.UpperLeftCorner.Y + textHeight; contentWidth += 2*borderWidth + textWidth; StaticText->setRelativePosition( textRect ); // find out button size needs s32 countButtons = 0; if (Flags & EMBF_OK) ++countButtons; if (Flags & EMBF_CANCEL) ++countButtons; if (Flags & EMBF_YES) ++countButtons; if (Flags & EMBF_NO) ++countButtons; s32 buttonBoxWidth = countButtons * buttonWidth + 2 * borderWidth; if ( countButtons > 1 ) buttonBoxWidth += (countButtons-1) * buttonDistance; s32 buttonBoxHeight = buttonHeight + 2 * borderWidth; // calc new message box sizes core::rect<s32> tmp = getRelativePosition(); s32 msgBoxHeight = titleHeight + contentHeight + buttonBoxHeight; s32 msgBoxWidth = contentWidth > buttonBoxWidth ? contentWidth : buttonBoxWidth; // adjust message box position tmp.UpperLeftCorner.Y = (Parent->getAbsolutePosition().getHeight() - msgBoxHeight) / 2; tmp.LowerRightCorner.Y = tmp.UpperLeftCorner.Y + msgBoxHeight; tmp.UpperLeftCorner.X = (Parent->getAbsolutePosition().getWidth() - msgBoxWidth) / 2; tmp.LowerRightCorner.X = tmp.UpperLeftCorner.X + msgBoxWidth; setRelativePosition(tmp); // add buttons core::rect<s32> btnRect; btnRect.UpperLeftCorner.Y = titleHeight + contentHeight + borderWidth; btnRect.LowerRightCorner.Y = btnRect.UpperLeftCorner.Y + buttonHeight; btnRect.UpperLeftCorner.X = borderWidth; if ( contentWidth > buttonBoxWidth ) btnRect.UpperLeftCorner.X += (contentWidth - buttonBoxWidth) / 2; // center buttons btnRect.LowerRightCorner.X = btnRect.UpperLeftCorner.X + buttonWidth; IGUIElement* focusMe = 0; setButton(OkButton, (Flags & EMBF_OK) != 0, btnRect, skin->getDefaultText(EGDT_MSG_BOX_OK), focusMe); if ( Flags & EMBF_OK ) btnRect += core::position2d<s32>(buttonWidth + buttonDistance, 0); setButton(CancelButton, (Flags & EMBF_CANCEL) != 0, btnRect, skin->getDefaultText(EGDT_MSG_BOX_CANCEL), focusMe); if ( Flags & EMBF_CANCEL ) btnRect += core::position2d<s32>(buttonWidth + buttonDistance, 0); setButton(YesButton, (Flags & EMBF_YES) != 0, btnRect, skin->getDefaultText(EGDT_MSG_BOX_YES), focusMe); if ( Flags & EMBF_YES ) btnRect += core::position2d<s32>(buttonWidth + buttonDistance, 0); setButton(NoButton, (Flags & EMBF_NO) != 0, btnRect, skin->getDefaultText(EGDT_MSG_BOX_NO), focusMe); if (Environment->hasFocus(this) && focusMe) Environment->setFocus(focusMe); }
void GraphicsHelper::setPositionToCenter(cc::Node *pNode, cc::Node *pParentNode) { setRelativePosition(50, 50, pNode, pParentNode); }