本文整理汇总了C++中ItemPtr类的典型用法代码示例。如果您正苦于以下问题:C++ ItemPtr类的具体用法?C++ ItemPtr怎么用?C++ ItemPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ItemPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetSelectedItem
// Update the skeleton transforms based on the dragger.
void IvObjectDragger::UpdateSkeleton()
{
ItemPtr selectedItem = GetSelectedItem();
if( !selectedItem ) {
return;
}
RaveTransform<float> tbox;
const float* q = _transformBox->rotation.getValue().getValue();
tbox.rot = Vector(q[3], q[0], q[1], q[2]);
SbVec3f v = _transformBox->translation.getValue();
tbox.trans = Vector(v[0], v[1], v[2]);
Transform told; told.trans = -_ab.pos;
RaveTransform<float> tnew = tbox*told*_toffset;
SetSoTransform(selectedItem->GetIvTransform(), tnew);
KinBodyItemPtr pbody = boost::dynamic_pointer_cast<KinBodyItem>(selectedItem);
if( !!pbody ) {
pbody->UpdateFromIv();
CheckCollision(_checkCollision);
}
// other motion handler calls
_viewer.lock()->_UpdateCameraTransform(0);
}
示例2: insertMenuItem
void Menu::insertMenuItem( HMENU hmenu, int index, ItemPtr item )
{
MENUITEMINFO info = { sizeof( info ), MIIM_STRING | MIIM_ID | MIIM_DATA, 0, 0,
item->commandID(), NULL, NULL, NULL, (DWORD)item.getObject(), "menu"
};
InsertMenuItem( hmenu, index, MF_BYPOSITION, &info );
}
示例3: updateAction
void Menu::updateAction( HMENU hmenu, int& index, ItemPtr item, const MENUITEMINFO& info )
{
if( !info.dwTypeData || buildMenuText( item ) != (LPCTSTR)info.dwTypeData )
ModifyMenu( hmenu, index, MF_BYPOSITION | MF_STRING, item->commandID(),
buildMenuText( item ).c_str() );
EnableMenuItem( hmenu, index, MF_BYPOSITION | ( item->update() ? MF_ENABLED : MF_GRAYED ) );
}
示例4: getGround
bool Tile::isFullGround()
{
ItemPtr ground = getGround();
if(ground && ground->isFullGround())
return true;
return false;
}
示例5: add
void Item::add( ItemPtr item )
{
if( isAncestor( item.getObject() ) )
throw 1;
subitems_.push_back( item );
item->addParent( this );
}
示例6: Intersects
void Space::Intersects( ItemPtr item )
{
switch( item->Behavior() ) {
case Nothing:
L_("I'm a master of nothing!\n");
break;
case AddJunk:
JunkAdded( 1 );
break;
case Hurts:
satellite.ChangeLife( -TWEAKS->GetNum( "asteroid_damage" ) );
hit_snd.Play();
break;
case Heal:
satellite.ChangeLife( TWEAKS->GetNum( "asteroid_damage" ) );
heal_snd.Play();
break;
case AddCovet:
coveted_snd.Play();
satellite.ChangeCoveted( 1 );
break;
default: break;
}
item->Kill();
}
示例7: getToolbarsItem
/*static*/
int Toolbar::getToolbarsCount( const std::string appTbsSection )
{
ItemPtr appTbsItem = getToolbarsItem( appTbsSection );
if ( !appTbsItem )
return 0;
return appTbsItem->num();
}
示例8: getParent
void
Item::extractVariables( VariableSet &vs ) const
{
ItemPtr i = getParent();
if ( i )
i->extractVariables( vs );
for ( auto x = myVariables.begin(); x != myVariables.end(); ++x )
vs.emplace( std::make_pair( x->first, x->second ) );
}
示例9: updateToggle
void Menu::updateToggle( HMENU hmenu, int& index, ItemPtr item, const MENUITEMINFO& info )
{
if( !info.dwTypeData || buildMenuText( item ) != (LPCTSTR)info.dwTypeData )
ModifyMenu( hmenu, index, MF_BYPOSITION | MF_STRING, item->commandID(),
buildMenuText( item ).c_str() );
if( item->num() != 2 )// exactly 2
throw 1;
EnableMenuItem( hmenu, index, MF_BYPOSITION | ( item->update() ? MF_ENABLED : MF_GRAYED ) );
CheckMenuItem( hmenu, index, MF_BYPOSITION | ( ( *item )[ 0 ]->update() ? MF_UNCHECKED : MF_CHECKED ) );
}
示例10:
bool operator<(const ItemPtr& itemptr1, const ItemPtr& itemptr2)
{
if (itemptr1.getPtr()->getTitle() < itemptr2.getPtr()->getTitle())
{
return true;
} else
{
return false;
}
}
示例11: internalGetItem
ItemPtr ProtocolGame::internalGetItem(InputMessage& msg, int id)
{
if(id == 0)
id = msg.getU16();
ItemPtr item = Item::create(id);
if(item->isStackable() || item->isFluidContainer() || item->isFluid())
item->setData(msg.getU8());
return item;
}
示例12: useWith
void Game::useWith(const ItemPtr& item, const ThingPtr& toThing)
{
if(!canPerformGameAction() || !item || !toThing)
return;
Position pos = item->getPosition();
if(!pos.isValid()) // virtual item
pos = Position(0xFFFF, 0, 0); // means that is a item in inventory
m_protocolGame->sendUseItemWith(pos, item->getId(), item->getStackPos(), toThing->getPosition(), toThing->getId(), toThing->getStackPos());
}
示例13: shortcutPressed
virtual void shortcutPressed( ItemPtr item )
{
if( item->update() )
{
for( unsigned int i = 0; i < item->num(); ++i )
if( ( *item )[ i ]->update() )
{
( *item )[ ( i + 1 ) % item->num() ]->act();
break;
}
}
}
示例14: act
virtual bool act( ItemPtr item )
{
bool enabled = false;
for( unsigned int i = 0; i < item->parentNum(); ++i )
{
Item* parent = item->parent( i );
enabled = enabled || parent->update();
}
if( enabled && !item->action().empty() )
return Manager::instance().functors().act( item->action(), item );
return false;
}
示例15: _SetColor
IvObjectDragger::~IvObjectDragger()
{
_SetColor(_normalColor);
_transformBox->removeMotionCallback(_MotionHandler, this);
if( _draggerRoot != NULL ) {
ItemPtr selectedItem = GetSelectedItem();
if( !!selectedItem ) {
selectedItem->GetIvRoot()->removeChild(_draggerRoot);
}
}
}