本文整理汇总了C++中Compass::SetCompassBodyTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ Compass::SetCompassBodyTexture方法的具体用法?C++ Compass::SetCompassBodyTexture怎么用?C++ Compass::SetCompassBodyTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Compass
的用法示例。
在下文中一共展示了Compass::SetCompassBodyTexture方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
irr::IrrlichtDevice* device = irr::createDevice(irr::video::EDT_OPENGL, irr::core::dimension2du(1024, 768));
if (device == 0)
return 1;
irr::gui::IGUIEnvironment* guienv = device->getGUIEnvironment();
irr::video::IVideoDriver* driver = device->getVideoDriver();
irr::scene::ISceneManager* smgr = device->getSceneManager();
guienv->addStaticText(L"Press ALT + F4 to exit", irr::core::rect<irr::s32>(20, 20, 200, 40));
irr::scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS();
//an empty scene is boring
for (irr::u32 i = 0; i < 10; ++i)
smgr->addCubeSceneNode(10.0f, 0, -1, irr::core::vector3df(10.0f*i + 10, 0.0f, 50.0));
// add a compass
const irr::core::dimension2di compassSize(128, 128);
irr::core::rect<irr::s32> compassRect;
compassRect.UpperLeftCorner.X = 880;
compassRect.UpperLeftCorner.Y = 10;
compassRect.LowerRightCorner.X = 880 + compassSize.Width;
compassRect.LowerRightCorner.Y = 10 + compassSize.Height;
Compass* compass = new Compass(compassRect, guienv, guienv->getRootGUIElement());
compass->SetCompassBodyTexture(driver->getTexture("compass_body.png"));
compass->SetCompassNeedleTexture(driver->getTexture("compass_needle.png"));
while (device->run())
{
//update compass
irr::core::vector3df vec(0.0f, 0.0f, 1.0f);
camera->getAbsoluteTransformation().rotateVect(vec);
compass->SetCompassHeading(vec.getHorizontalAngle().Y);
driver->beginScene(true, true, irr::video::SColor(255, 128, 128, 128));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
device->drop();
compass->drop();
return 0;
}