本文整理汇总了C++中kernel::Object::setName方法的典型用法代码示例。如果您正苦于以下问题:C++ Object::setName方法的具体用法?C++ Object::setName怎么用?C++ Object::setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kernel::Object
的用法示例。
在下文中一共展示了Object::setName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: oneShip
void TestDemonstration::oneShip()
{
InternalMessage("Sound","entering TestDemonstration::oneShip") ;
std::cerr << "TestDemonstration::oneShip" << std::endl ;
std::cerr.flush() ;
std::auto_ptr<Kernel::Model> model(new Kernel::Model()) ;
model->init() ;
Kernel::Object* root = model->createObject() ;
Kernel::Object* universe = root->createObject() ;
universe->addTrait(new Model::Universe()) ;
universe->addTrait(new Model::Positioned()) ;
universe->setName("universe") ;
Kernel::Object* system = universe->createObject() ;
system->addTrait(new Model::StellarSystem()) ;
system->addTrait(new Model::Positioned()) ;
system->setName("system") ;
// Kernel::Object* ship = Model::loadShip("test_ship",system) ;
Kernel::Object* pilot = system->createObject() ;
pilot->addTrait(new Model::Listener()) ;
pilot->addTrait(new Model::Positioned()) ;
pilot->addTrait(new Model::Oriented()) ;
pilot->addTrait(new Model::Player()) ;
pilot->addTrait(new Model::Observer()) ;
pilot->addTrait(new Model::Active()) ;
pilot->addTrait(new Model::Mobile()) ;
Kernel::Object* ship2 = Model::loadShip("test_ship",system) ;
Model::Positioned* ship2_positioned = ship2->getTrait<Model::Positioned>() ;
ship2_positioned->setPosition(Model::Position::Meter(0,0,200)) ;
ship2->getTrait<Model::Mobile>()->setSpeed(Model::Speed::MeterPerSecond(0,0,-50)) ;
Kernel::Timer global_timer ;
Kernel::Timer timer ;
std::set<Model::Throttle*> throttles = ship2->getChildren<Model::Throttle>() ;
(*throttles.begin())->set(100) ;
while (global_timer.getSecond() <= 4)
{
float seconds = timer.getSecond() ;
if (seconds > 0)
{
timer.reset() ;
ship2_positioned->setPosition(ship2_positioned->getPosition()+Model::Position::Meter(0,0,-50*seconds)) ;
model->update(seconds) ;
}
}
InternalMessage("Sound","leaving TestDemonstration::oneShip") ;
}
示例2: load
void CustomMission::load()
{
// setup the system
Kernel::Object* universe = getObject()->createObject() ;
universe->addTrait(new Universe()) ;
universe->addTrait(new Positioned()) ;
universe->setName("universe") ;
m_system = universe->createObject() ;
m_system->addTrait(new StellarSystem()) ;
m_system->addTrait(new Positioned()) ;
m_system->setName("system") ;
}