本文整理汇总了C++中setPosition函数的典型用法代码示例。如果您正苦于以下问题:C++ setPosition函数的具体用法?C++ setPosition怎么用?C++ setPosition使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setPosition函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: img
vmain::vmain() : img(NULL){
setSize(283,342);
setPosition(800/2-283/2,600/2-342/2);
setMovable(false);
setTitleBarHeight(0);
setPadding(0);
setFocusable(false);
login_added=false;
/*puerto= new _TextField("7666",gcn::Graphics::CENTER);
puerto->setSize(133,14);
puerto->setBackgroundColor(gcn::Color(0,0,0,0));
puerto->setForegroundColor(gcn::Color(255,255,255,255));
puerto->setBorderSize(0);
add(puerto,200,163);*/
/*host= new _TextField("testserver.aonx.com.ar",gcn::Graphics::CENTER);
host->setSize(208,14);
host->setBackgroundColor(gcn::Color(0,0,0,0));
host->setForegroundColor(gcn::Color(255,255,255,255));
host->setBorderSize(0);
add(host,366,163);*/
/*blogin = new NoDrawButton;
blogin->setSize(230,80);
blogin->setFocusable(false);
blogin->setActionEventId("blogin");
blogin->addActionListener(this);
add(blogin,560,340);*/
/*bcreate = new NoDrawButton;
bcreate->setSize(230,80);
bcreate->setFocusable(false);
bcreate->setActionEventId("CREATE");
bcreate->addActionListener(ClienteArgentum::instancia());
add(bcreate,560,440);*/
login_button = new ImageButton();
create_button = new ImageButton();
servers_button = new ImageButton();
options_button = new ImageButton();
exit_button = new ImageButton();
login_button->setSize(250, 40);
create_button->setSize(250, 40);
servers_button->setSize(250, 40);
options_button->setSize(250, 40);
exit_button->setSize(250, 40);
std::string path;
path=ConfigData::GetPath("gui") + std::string("main_menu/");
login_button->setNormalImage(path + std::string("login.png"));
login_button->setMoserOverImage(path + std::string("loginb.png"));
login_button->setActionEventId("LOGIN_DIALOG");
login_button->addActionListener(ClienteArgentum::instancia());
create_button->setNormalImage(path + std::string("create.png"));
create_button->setMoserOverImage(path + std::string("createb.png"));
create_button->setActionEventId("CREATE");
create_button->addActionListener(ClienteArgentum::instancia());
servers_button->setNormalImage(path + std::string("servers.png"));
servers_button->setMoserOverImage(path + std::string("serversb.png"));
options_button->setNormalImage(path + std::string("opciones.png"));
options_button->setMoserOverImage(path + std::string("opcionesb.png"));
options_button->setActionEventId("OPTIONS");
options_button->addActionListener(ClienteArgentum::instancia());
exit_button->setNormalImage(path + std::string("salir.png"));
exit_button->setMoserOverImage(path + std::string("salirb.png"));
exit_button->setActionEventId("EXIT");
exit_button->addActionListener(ClienteArgentum::instancia());
add(login_button,17, 66);
add(create_button,17, 121);
add(servers_button,17, 176);
add(options_button,17, 231);
add(exit_button,17, 287);
}
示例2: setPosition
void Widget::setLeft( int newLeft )
{
setPosition( Point( newLeft, getTop() ) );
}
示例3: updateQuantityLabel
////////////////////////////////////////////////////////
//
// ParticleMainScene
//
////////////////////////////////////////////////////////
void ParticleMainScene::initWithSubTest(int asubtest, int particles)
{
//srandom(0);
subtestNumber = asubtest;
auto s = Director::getInstance()->getWinSize();
lastRenderedCount = 0;
quantityParticles = particles;
MenuItemFont::setFontSize(65);
auto decrease = MenuItemFont::create(" - ", [&](Ref *sender) {
quantityParticles -= kNodesIncrease;
if( quantityParticles < 0 )
quantityParticles = 0;
updateQuantityLabel();
createParticleSystem();
});
decrease->setColor(Color3B(0,200,20));
auto increase = MenuItemFont::create(" + ", [&](Ref *sender) {
quantityParticles += kNodesIncrease;
if( quantityParticles > kMaxParticles )
quantityParticles = kMaxParticles;
updateQuantityLabel();
createParticleSystem();
});
increase->setColor(Color3B(0,200,20));
auto menu = Menu::create(decrease, increase, NULL);
menu->alignItemsHorizontally();
menu->setPosition(Vec2(s.width/2, s.height/2+15));
addChild(menu, 1);
auto infoLabel = Label::createWithTTF("0 nodes", "fonts/Marker Felt.ttf", 30);
infoLabel->setColor(Color3B(0,200,20));
infoLabel->setPosition(Vec2(s.width/2, s.height - 90));
addChild(infoLabel, 1, kTagInfoLayer);
// particles on stage
auto labelAtlas = LabelAtlas::create("0000", "fps_images.png", 12, 32, '.');
addChild(labelAtlas, 0, kTagLabelAtlas);
labelAtlas->setPosition(Vec2(s.width-66,50));
// Next Prev Test
auto menuLayer = new ParticleMenuLayer(true, TEST_COUNT, s_nParCurIdx);
addChild(menuLayer, 1, kTagMenuLayer);
menuLayer->release();
// Sub Tests
MenuItemFont::setFontSize(40);
auto pSubMenu = Menu::create();
for (int i = 1; i <= 6; ++i)
{
char str[10] = {0};
sprintf(str, "%d ", i);
auto itemFont = MenuItemFont::create(str, CC_CALLBACK_1(ParticleMainScene::testNCallback, this));
itemFont->setTag(i);
pSubMenu->addChild(itemFont, 10);
if (i <= 3)
{
itemFont->setColor(Color3B(200,20,20));
}
else
{
itemFont->setColor(Color3B(0,200,20));
}
}
pSubMenu->alignItemsHorizontally();
pSubMenu->setPosition(Vec2(s.width/2, 80));
addChild(pSubMenu, 2);
auto label = Label::createWithTTF(title().c_str(), "fonts/arial.ttf", 32);
addChild(label, 1);
label->setPosition(Vec2(s.width/2, s.height-50));
updateQuantityLabel();
createParticleSystem();
schedule(schedule_selector(ParticleMainScene::step));
}
示例4: setPosition
void TextCursor::setPosition(const KTextEditor::Cursor& position)
{
setPosition(position, false);
}
示例5: setPosition
void AutoTank::moveTo(TVector newPosition)
{
setPosition(newPosition.X(), newPosition.Y(), newPosition.Z());
currentPosition.setY(terrain->GetHeight((float)currentPosition.X(), (float)currentPosition.Z()) + 6.4);
}
示例6: setPosition
void BasicScreenObject::setX(float _x) {
setPosition(_x, getY(), getZ());
}
示例7: setPosition
void Sprite::setCurrentFrame(u16 animID, u16 frameID) {
setPosition(m_animations.at(animID).getFramePosition(frameID).x,
m_animations.at(animID).getFramePosition(frameID).y);
setCurrentFrame(m_animations.at(animID).getFrame(frameID));
}
示例8: CRRCDialog
//.........这里部分代码省略.........
}
mapgroup->close();
mapgroup->hide();
// The combo box above the "mapping group"
combo_radiotype = new puaComboBox(LABEL_W + DLG_DEF_SPACE,
BUTTON_BOX_HEIGHT + (NUM_FUNCTIONS)* DLG_DEF_SPACE + (NUM_FUNCTIONS) * INPUT_H,
LABEL_W + DLG_DEF_SPACE + COMBO_W,
BUTTON_BOX_HEIGHT + (NUM_FUNCTIONS)* DLG_DEF_SPACE + (NUM_FUNCTIONS + 1) * INPUT_H,
NULL, false);
combo_radiotype->setChildColourScheme(PUCLASS_POPUPMENU, dlgCol1[0], dlgCol1[1], dlgCol1[2]);
combo_radiotype->newList(radioTypes);
combo_radiotype->setLabelPlace(PUPLACE_CENTERED_LEFT);
combo_radiotype->setLabel(_("Radio type"));
combo_radiotype->setUserData(this);
combo_radiotype->setCurrentItem(Global::TXInterface->map->radioType());
combo_radiotype->setCallback(CGUIComboCallback);
if (combo_radiotype->getCurrentItem() == T_AxisMapper::CUSTOM)
{
mapgroup->reveal();
}
if ((Global::TXInterface->inputMethod() == T_TX_Interface::eIM_mouse)
||
(Global::TXInterface->inputMethod() == T_TX_Interface::eIM_joystick))
{
Global::TXInterface->map->setRadioType(T_AxisMapper::CUSTOM);
combo_radiotype->setCurrentItem(Global::TXInterface->map->radioType());
combo_radiotype->hide();
}
else
{
combo_radiotype->reveal();
}
// The "calibration group" (right part of the dialog).
calibgroup = new puGroup(LABEL_W + 3*DLG_DEF_SPACE + DLG_CHECK_W + INPUT_W + HORIZ_SPACER,
BUTTON_BOX_HEIGHT + DLG_DEF_SPACE);
for (int i = 0; i < TX_MAXAXIS; i++)
{
axis[i] = new puSlider( i*SLIDER_SP + i * SLIDER_W,
LABEL_H + DLG_DEF_SPACE + DLG_DEF_BUTTON_HEIGHT,
SLIDER_SZ,
TRUE,
SLIDER_W);
axis[i]->setLabelPlace(PUPLACE_BOTTOM_CENTERED);
axis[i]->setLabel(axislabel[i]);
axis[i]->setValue((float)0.5);
// set min and max to some excessive values
minval[i] = 1.0e30;
maxval[i] = -1.0e30;
}
butCalibrate = new puOneShot( 0,
0,
DLG_DEF_BUTTON_WIDTH + 10,
DLG_DEF_BUTTON_HEIGHT);
butCalibrate->setLegend(_("Calibrate"));
butCalibrate->setLabelPlace(PUPLACE_BOTTOM_LEFT);
butCalibrate->setLabel("");
butCalibrate->setUserData(this);
butCalibrate->setCallback(CGUICalibButtonCallback);
if (Global::TXInterface->usesCalibration())
{
butCalibrate->reveal();
}
else
{
butCalibrate->hide();
}
calibgroup->close();
close();
//resize
setSize(LABEL_W + (TX_MAXAXIS -1)*SLIDER_SP + DLG_DEF_SPACE+ DLG_CHECK_W + INPUT_W + 2*HORIZ_SPACER + TX_MAXAXIS * SLIDER_W,
BUTTON_BOX_HEIGHT + (NUM_FUNCTIONS+3) * DLG_DEF_SPACE + (NUM_FUNCTIONS+1) * INPUT_H);
setCallback(CGUICalibMapCallback);
// center the dialog on screen
int wwidth, wheight;
int current_width = getABox()->max[0] - getABox()->min[0];
int current_height = getABox()->max[1] - getABox()->min[1];
puGetWindowSize(&wwidth, &wheight);
setPosition(wwidth/2 - current_width/2, wheight/2 - current_height/2);
//set the dialogue transparent and hide the others dialogues to better see the model
setTransparency(.3);
hideOthers();
reveal();
}
示例9: setPosition
YInfoJumpListRecord::YInfoJumpListRecord(const QString & filename, const QPoint pos)
{
mFilename = filename;
setPosition(pos);
}
示例10: insertCodeSnippet
void TextDocumentManipulator::insertCodeSnippet(int position, const QString &text)
{
auto cursor = m_textEditorWidget->textCursor();
cursor.setPosition(position, QTextCursor::KeepAnchor);
m_textEditorWidget->insertCodeSnippet(cursor, text);
}
示例11: setPosition
bool Explosive::doAction(float _f)
{
#ifdef GOLDEN_MINER_2_VERSION_TIME
statusTimeCount += _f;
double _positionX = 0;
double _positionY = 0;
float _ratio = (GRENADE_TIME/60.0 - statusTimeCount) / (GRENADE_TIME/60.0);
if (_ratio < 0)
{
_ratio = 0;
}
if(hanger->carryTargetType == GAMECONTROL_TYPE_TARGET_STATIC)
{
_positionX = ((Target *)hanger->carryTargetPoint)->getPositionX() + (Global::getInstance()->getcentreX() - ((Target *)hanger->carryTargetPoint)->getPositionX()) * _ratio;
_positionY = ((Target *)hanger->carryTargetPoint)->getPositionY() + (Global::getInstance()->getcentreY() - ((Target *)hanger->carryTargetPoint)->getPositionY()) * _ratio;
setPosition(ccp(_positionX, _positionY));
}
else if (hanger->carryTargetType == GAMECONTROL_TYPE_TARGET_DYNAMIC)
{
if (((DynamicTarget *)hanger->carryTargetPoint)->getId() == DYNAMIC_ID_SHELL)
{
_positionX = ((DynamicTargetShell *)hanger->carryTargetPoint)->shellSprite->getPositionX() + (Global::getInstance()->getcentreX() - ((DynamicTarget *)hanger->carryTargetPoint)->getArmature()->getPositionX()) * _ratio;
_positionY = ((DynamicTargetShell *)hanger->carryTargetPoint)->shellSprite->getPositionY() + (Global::getInstance()->getcentreY() - ((DynamicTarget *)hanger->carryTargetPoint)->getArmature()->getPositionY()) * _ratio;
}
else
{
_positionX = ((DynamicTarget *)hanger->carryTargetPoint)->getArmature()->getPositionX() + (Global::getInstance()->getcentreX() - ((DynamicTarget *)hanger->carryTargetPoint)->getArmature()->getPositionX()) * _ratio;
_positionY = ((DynamicTarget *)hanger->carryTargetPoint)->getArmature()->getPositionY() + (Global::getInstance()->getcentreY() - ((DynamicTarget *)hanger->carryTargetPoint)->getArmature()->getPositionY()) * _ratio;
}
setPosition(ccp(_positionX, _positionY));
}
else
{
return true;
}
if ((statusTimeCount >= GRENADE_TIME/60.0)&& ((statusTimeCount - _f) >= GRENADE_TIME/60.0))
{
return true;
//releaseSkills(SKILL_ID_GRENADE);
}
#else
statusTimeCount++;
double _positionX = 0;
double _positionY = 0;
if(hanger->carryTargetType == GAMECONTROL_TYPE_TARGET_STATIC)
{
_positionX = ((Target *)hanger->carryTargetPoint)->getPositionX() + (Global::getInstance()->getcentreX() - ((Target *)hanger->carryTargetPoint)->getPositionX()) * (GRENADE_TIME - statusTimeCount) / GRENADE_TIME;
_positionY = ((Target *)hanger->carryTargetPoint)->getPositionY() + (Global::getInstance()->getcentreY() - ((Target *)hanger->carryTargetPoint)->getPositionY()) * (GRENADE_TIME - statusTimeCount) / GRENADE_TIME;
setPosition(ccp(_positionX, _positionY));
}
else if (hanger->carryTargetType == GAMECONTROL_TYPE_TARGET_DYNAMIC)
{
if (((DynamicTarget *)hanger->carryTargetPoint)->getId() == DYNAMIC_ID_SHELL)
{
_positionX = ((DynamicTargetShell *)hanger->carryTargetPoint)->shellSprite->getPositionX() + (Global::getInstance()->getcentreX() - ((DynamicTarget *)hanger->carryTargetPoint)->getArmature()->getPositionX()) * (GRENADE_TIME - statusTimeCount) / GRENADE_TIME;
_positionY = ((DynamicTargetShell *)hanger->carryTargetPoint)->shellSprite->getPositionY() + (Global::getInstance()->getcentreY() - ((DynamicTarget *)hanger->carryTargetPoint)->getArmature()->getPositionY()) * (GRENADE_TIME - statusTimeCount) / GRENADE_TIME;
}
else
{
_positionX = ((DynamicTarget *)hanger->carryTargetPoint)->getArmature()->getPositionX() + (Global::getInstance()->getcentreX() - ((DynamicTarget *)hanger->carryTargetPoint)->getArmature()->getPositionX()) * (GRENADE_TIME - statusTimeCount) / GRENADE_TIME;
_positionY = ((DynamicTarget *)hanger->carryTargetPoint)->getArmature()->getPositionY() + (Global::getInstance()->getcentreY() - ((DynamicTarget *)hanger->carryTargetPoint)->getArmature()->getPositionY()) * (GRENADE_TIME - statusTimeCount) / GRENADE_TIME;
}
setPosition(ccp(_positionX, _positionY));
}
else
{
return true;
}
if (statusTimeCount == GRENADE_TIME)
{
return true;
//releaseSkills(SKILL_ID_GRENADE);
}
#endif
return false;
}
示例12: setPosition
void OrthoViewControllerCustom::lookAt( const Ogre::Vector3& point )
{
setPosition( point - target_scene_node_->getPosition() );
}
示例13: clearTrajectory
void clearTrajectory() {
setPosition(0, 0, 0);
lastLeft = 0.0f;
lastRight = 0.0f;
lastAngle = 0.0f;
}
示例14: setPosition
void Bullet::move(float dt) {
setPosition(cocos2d::Vec2(getPositionX() + (velocity.x*dt),
getPositionY() + (velocity.y*dt)));
}
示例15: setPosition
void HeroFrog::setCurPosition(Point pos){
setPosition(pos);
if (pos.x - downPoint.x>=0) {
setHeroStatus(frogJumpDown);
}
}