本文整理汇总了C++中PtrVector::get方法的典型用法代码示例。如果您正苦于以下问题:C++ PtrVector::get方法的具体用法?C++ PtrVector::get怎么用?C++ PtrVector::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PtrVector
的用法示例。
在下文中一共展示了PtrVector::get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buildTrackList
/** Rebuild the list of tracks and GPs. This need to be recomputed e.g. to
* take unlocked tracks into account.
*/
void TracksScreen::buildTrackList()
{
DynamicRibbonWidget* tracks_widget = this->getWidget<DynamicRibbonWidget>("tracks");
RibbonWidget* tabs = this->getWidget<RibbonWidget>("trackgroups");
// Reset track list everytime (accounts for locking changes, etc.)
tracks_widget->clearItems();
m_random_track_list.clear();
const std::string& curr_group_name = tabs->getSelectionIDString(0);
const int track_amount = (int)track_manager->getNumberOfTracks();
// First build a list of all tracks to be displayed
// (e.g. exclude arenas, ...)
PtrVector<Track, REF> tracks;
for (int n = 0; n < track_amount; n++)
{
Track* curr = track_manager->getTrack(n);
if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_EASTER_EGG
&& !curr->hasEasterEggs())
continue;
if (curr->isArena() || curr->isSoccer()||curr->isInternal()) continue;
if (curr_group_name != ALL_TRACK_GROUPS_ID &&
!curr->isInGroup(curr_group_name)) continue;
tracks.push_back(curr);
} // for n<track_amount
tracks.insertionSort();
for (unsigned int i = 0; i < tracks.size(); i++)
{
Track *curr = tracks.get(i);
if (PlayerManager::getCurrentPlayer()->isLocked(curr->getIdent()))
{
tracks_widget->addItem(
_("Locked : solve active challenges to gain access to more!"),
"locked", curr->getScreenshotFile(), LOCKED_BADGE,
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
}
else
{
tracks_widget->addItem(translations->fribidize(curr->getName()),
curr->getIdent(),
curr->getScreenshotFile(), 0,
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
m_random_track_list.push_back(curr->getIdent());
}
}
tracks_widget->addItem(_("Random Track"), "random_track",
"/gui/track_random.png", 0 /* no badge */,
IconButtonWidget::ICON_PATH_TYPE_RELATIVE);
tracks_widget->updateItemDisplay();
std::random_shuffle( m_random_track_list.begin(), m_random_track_list.end() );
} // buildTrackList
示例2: getKeyboardConfig
KeyboardConfig* getKeyboardConfig(const int i) { return m_keyboard_configs.get(i); }
示例3: getKeyboard
KeyboardDevice* getKeyboard(const int i) { return m_keyboards.get(i); }
示例4: getGamepadConfig
GamepadConfig* getGamepadConfig(const int i) { return m_gamepad_configs.get(i); }
示例5: getGamePad
GamePadDevice* getGamePad(const int i) { return m_gamepads.get(i); }
示例6: setKartsFromCurrentGroup
void KartSelectionScreen::setKartsFromCurrentGroup()
{
RibbonWidget* tabs = getWidget<RibbonWidget>("kartgroups");
assert(tabs != NULL);
std::string selected_kart_group =
tabs->getSelectionIDString(PLAYER_ID_GAME_MASTER);
UserConfigParams::m_last_used_kart_group = selected_kart_group;
// This can happen if addons are removed so that also the previously
// selected kart group is removed. In this case, select the
// 'standard' group
if (selected_kart_group != ALL_KART_GROUPS_ID &&
!kart_properties_manager->getKartsInGroup(selected_kart_group).size())
{
selected_kart_group = DEFAULT_GROUP_NAME;
}
DynamicRibbonWidget* w = getWidget<DynamicRibbonWidget>("karts");
w->clearItems();
int usable_kart_count = 0;
PtrVector<const KartProperties, REF> karts;
for(unsigned int i=0; i<kart_properties_manager->getNumberOfKarts(); i++)
{
const KartProperties* prop = kart_properties_manager->getKartById(i);
// Ignore karts that are not in the selected group
if(selected_kart_group != ALL_KART_GROUPS_ID &&
!prop->isInGroup(selected_kart_group))
continue;
karts.push_back(prop);
}
karts.insertionSort();
for(unsigned int i=0; i<karts.size(); i++)
{
const KartProperties* prop = karts.get(i);
if (PlayerManager::getCurrentPlayer()->isLocked(prop->getIdent()) &&
!m_multiplayer)
{
w->addItem(_("Locked : solve active challenges to gain access to more!"),
ID_LOCKED + prop->getIdent(),
prop->getAbsoluteIconFile(), LOCKED_BADGE,
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
}
else
{
w->addItem(translations->fribidize(prop->getName()),
prop->getIdent(),
prop->getAbsoluteIconFile(), 0,
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
usable_kart_count++;
}
}
// add random
if (usable_kart_count > 1)
{
w->addItem(_("Random Kart"), RANDOM_KART_ID, "/gui/random_kart.png");
}
w->updateItemDisplay();
}
示例7: setupRTTScene
void ModelViewWidget::setupRTTScene(PtrVector<scene::IMesh, REF>& mesh,
AlignedArray<Vec3>& mesh_location,
AlignedArray<Vec3>& mesh_scale,
const std::vector<int>& model_frames)
{
irr_driver->suppressSkyBox();
if (m_rtt_main_node != NULL) m_rtt_main_node->remove();
if (m_light != NULL) m_light->remove();
if (m_camera != NULL) m_camera->remove();
m_rtt_main_node = NULL;
m_camera = NULL;
m_light = NULL;
irr_driver->clearLights();
if (model_frames[0] == -1)
{
scene::ISceneNode* node = irr_driver->addMesh(mesh.get(0), "rtt_mesh", NULL);
node->setPosition(mesh_location[0].toIrrVector());
node->setScale(mesh_scale[0].toIrrVector());
node->setMaterialFlag(video::EMF_FOG_ENABLE, false);
m_rtt_main_node = node;
}
else
{
scene::IAnimatedMeshSceneNode* node =
irr_driver->addAnimatedMesh((scene::IAnimatedMesh*)mesh.get(0), "rtt_mesh", NULL);
node->setPosition(mesh_location[0].toIrrVector());
node->setFrameLoop(model_frames[0], model_frames[0]);
node->setAnimationSpeed(0);
node->setScale(mesh_scale[0].toIrrVector());
node->setMaterialFlag(video::EMF_FOG_ENABLE, false);
m_rtt_main_node = node;
}
assert(m_rtt_main_node != NULL);
assert(mesh.size() == mesh_location.size());
assert(mesh.size() == model_frames.size());
const int mesh_amount = mesh.size();
for (int n = 1; n<mesh_amount; n++)
{
if (model_frames[n] == -1)
{
scene::ISceneNode* node =
irr_driver->addMesh(mesh.get(n), "rtt_node", m_rtt_main_node);
node->setPosition(mesh_location[n].toIrrVector());
node->updateAbsolutePosition();
node->setScale(mesh_scale[n].toIrrVector());
}
else
{
scene::IAnimatedMeshSceneNode* node =
irr_driver->addAnimatedMesh((scene::IAnimatedMesh*)mesh.get(n),
"modelviewrtt", m_rtt_main_node);
node->setPosition(mesh_location[n].toIrrVector());
node->setFrameLoop(model_frames[n], model_frames[n]);
node->setAnimationSpeed(0);
node->updateAbsolutePosition();
node->setScale(mesh_scale[n].toIrrVector());
//Log::info("ModelViewWidget", "Set frame %d", model_frames[n]);
}
}
irr_driver->getSceneManager()->setAmbientLight(video::SColor(255, 35, 35, 35));
const core::vector3df &spot_pos = core::vector3df(0, 30, 40);
m_light = irr_driver->addLight(spot_pos, 0.3f /* energy */, 10 /* distance */, 1.0f /* r */, 1.0f /* g */, 1.0f /* g*/, true, NULL);
m_rtt_main_node->setMaterialFlag(video::EMF_GOURAUD_SHADING, true);
m_rtt_main_node->setMaterialFlag(video::EMF_LIGHTING, true);
const int materials = m_rtt_main_node->getMaterialCount();
for (int n = 0; n<materials; n++)
{
m_rtt_main_node->getMaterial(n).setFlag(video::EMF_LIGHTING, true);
// set size of specular highlights
m_rtt_main_node->getMaterial(n).Shininess = 100.0f;
m_rtt_main_node->getMaterial(n).SpecularColor.set(255, 50, 50, 50);
m_rtt_main_node->getMaterial(n).DiffuseColor.set(255, 150, 150, 150);
m_rtt_main_node->getMaterial(n).setFlag(video::EMF_GOURAUD_SHADING,
true);
}
m_camera = irr_driver->getSceneManager()->addCameraSceneNode();
m_camera->setAspectRatio(1.0f);
m_camera->setPosition(core::vector3df(0.0, 20.0f, 70.0f));
m_camera->setUpVector(core::vector3df(0.0, 1.0, 0.0));
m_camera->setTarget(core::vector3df(0, 10, 0.0f));
m_camera->setFOV(DEGREE_TO_RAD*50.0f);
m_camera->updateAbsolutePosition();
}