本文整理汇总了C++中ogre::RenderWindow::getCustomAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderWindow::getCustomAttribute方法的具体用法?C++ RenderWindow::getCustomAttribute怎么用?C++ RenderWindow::getCustomAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::RenderWindow
的用法示例。
在下文中一共展示了RenderWindow::getCustomAttribute方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getData
DataContainer GraphicsImpl::getData(const DataIdentifier& id)
{
if (id == "window.handle") {
std::ostringstream windowHndStr;
size_t windowHnd = 0;
window->getCustomAttribute("WINDOW", &windowHnd);
windowHndStr << windowHnd;
return DataContainer(windowHndStr.str());
}
return DataContainer();
}
示例2: windowAttributes
VIEW_API void windowAttributes(size_t& handle, u32& width, u32& height)
{
Ogre::Root* root = Ogre::Root::getSingletonPtr();
if (! root)
throw std::logic_error
("View::windowAttributes: Ogre hasn't been initialized yet.");
Ogre::RenderWindow* win = root->getAutoCreatedWindow();
win->getCustomAttribute("WINDOW", &handle);
height = win->getHeight();
width = win->getWidth();
}
示例3: initialise
void ClipboardManager::initialise()
{
MYGUI_ASSERT(false == mIsInitialise, INSTANCE_TYPE_NAME << " initialised twice");
MYGUI_LOG(Info, "* Initialise: " << INSTANCE_TYPE_NAME);
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
Ogre::RenderWindow * window = Gui::getInstance().getRenderWindow();
if (window != nullptr) {
window->getCustomAttribute("WINDOW", &mHwnd);
}
#endif
MYGUI_LOG(Info, INSTANCE_TYPE_NAME << " successfully initialized");
mIsInitialise = true;
}
示例4: create_frame_listener
void application::create_frame_listener()
{
Ogre::LogManager::getSingletonPtr() -> logMessage("Initializing OIS");
OIS::ParamList pl;
size_t wndhnd = 0;
std::ostringstream wndhndstr;
wnd->getCustomAttribute ("WINDOW", &wndhnd);
wndhndstr << wndhnd;
pl.insert (std::make_pair (std::string {"WINDOW"}, wndhndstr.str()));
input = OIS::InputManager::createInputSystem(pl);
kbd = static_cast<OIS::Keyboard*> (input->createInputObject (OIS::OISKeyboard, true));
mouse = static_cast<OIS::Mouse*> (input->createInputObject (OIS::OISMouse, true));
mouse -> setEventCallback(this);
kbd -> setEventCallback(this);
windowResized(wnd);
Ogre::WindowEventUtilities::addWindowEventListener (wnd, this);
OgreBites::InputContext inctx;
inctx.mMouse = mouse;
inctx.mKeyboard = kbd;
tray_mgr = new OgreBites::SdkTrayManager ("InterfaceName", wnd, inctx, this);
tray_mgr->showFrameStats(OgreBites::TL_BOTTOMLEFT);
tray_mgr->showLogo(OgreBites::TL_BOTTOMRIGHT);
tray_mgr->hideCursor();
Ogre::StringVector items;
items.push_back("cam.pX");
items.push_back("cam.pY");
items.push_back("cam.pZ");
items.push_back("");
items.push_back("cam.oW");
items.push_back("cam.oX");
items.push_back("cam.oY");
items.push_back("cam.oZ");
items.push_back("");
items.push_back("Filtering");
items.push_back("Poly Mode");
root->addFrameListener(this);
}
示例5: initialise
void OISInput::initialise()
{
Ogre::RenderWindow* window = GetRenderWindow();
OIS::ParamList param_list;
std::size_t window_handle = 0;
window->getCustomAttribute("WINDOW", &window_handle);
typedef OIS::ParamList::value_type ParamType;
param_list.insert(
ParamType("WINDOW",
boost::lexical_cast<std::string>(window_handle)));
OgreGUI* gui = OgreGUI::GetGUI();
assert(gui);
const Ogre::SharedPtr<Ogre::DataStream>& config_file_stream = gui->ConfigFileStream();
if (!config_file_stream.isNull()) {
Ogre::ConfigFile config_file;
config_file.load(config_file_stream);
for (Ogre::ConfigFile::SettingsIterator it = config_file.getSettingsIterator();
it.hasMoreElements();
it.getNext()) {
param_list.insert(ParamType(it.peekNextKey(), it.peekNextValue()));
Ogre::LogManager::getSingleton().logMessage("OISPlugin using config setting " + it.peekNextKey() + "=" + it.peekNextValue());
}
}
m_input_manager = OIS::InputManager::createInputSystem(param_list);
m_keyboard = boost::polymorphic_downcast<OIS::Keyboard*>(
m_input_manager->createInputObject(OIS::OISKeyboard, true));
m_keyboard->setEventCallback(this);
m_mouse = boost::polymorphic_downcast<OIS::Mouse*>(
m_input_manager->createInputObject(OIS::OISMouse, true));
m_mouse->setEventCallback(this);
const OIS::MouseState& mouse_state = m_mouse->getMouseState();
mouse_state.width = Value(gui->AppWidth());
mouse_state.height = Value(gui->AppHeight());
ConnectHandlers();
}
示例6: init
bool OISManager::init()
{
OIS::ParamList pl;
size_t windowHnd = 0;
std::ostringstream windowHndStr;
Ogre::RenderWindow* rw = OgreManager::getInstance().getRenderWindow();
rw->getCustomAttribute("WINDOW", &windowHnd);
windowHndStr << windowHnd;
pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
_inputManager = OIS::InputManager::createInputSystem( pl );
_keyboard = static_cast<OIS::Keyboard*>(_inputManager->createInputObject( OIS::OISKeyboard, true ));
_mouse = static_cast<OIS::Mouse*>(_inputManager->createInputObject( OIS::OISMouse, true ));
const OIS::MouseState &ms = _mouse->getMouseState();
ms.width = static_cast<int>(rw->getWidth());
ms.height = static_cast<int>(rw->getHeight());
_keyboard->setEventCallback(this);
_mouse->setEventCallback(this);
_L = ScriptManager::getInstance().getLuaVM();
return true;
}
示例7: initialize
// Sets up input devices and event callbacks
void InputManager::initialize() {
_lastKeyPressedEvt = NULL;
_lastKeyReleasedEvt = NULL;
_lastMouseMovedEvt = NULL;
_lastMousePressedEvt = NULL;
_lastMouseReleasedEvt = NULL;
OIS::ParamList pl;
size_t windowHnd = 0;
std::ostringstream windowHndStr;
Ogre::RenderWindow* mWindow;
// set up the render window
mWindow = GraphicsManager::instance()->getRenderWindow();
mWindow->getCustomAttribute("WINDOW", &windowHnd);
windowHndStr << windowHnd;
pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
// Set up the input thread
_mInputManager = OIS::InputManager::createInputSystem(pl);
// Set up the input devices
_mKeyboard = static_cast<OIS::Keyboard*>(_mInputManager->createInputObject(OIS::OISKeyboard, true));
_mMouse = static_cast<OIS::Mouse*>(_mInputManager->createInputObject(OIS::OISMouse, true));
// Register for events
_mMouse->setEventCallback(this);
_mKeyboard->setEventCallback(this);
// Set initial mouse clipping size
windowResized(mWindow);
// Register as a Window listener
Ogre::WindowEventUtilities::addWindowEventListener(mWindow, this);
}
示例8: WinMain
//.........这里部分代码省略.........
// new way to instantiate a CEGUIOgreRenderer (Ogre 1.7)
Ogre::RenderTarget *mRenderTarget = window;
CEGUI::OgreRenderer* pGUIRenderer = &CEGUI::OgreRenderer::bootstrapSystem(*mRenderTarget);
// create the root CEGUI class
CEGUI::System* pSystem = CEGUI::System::getSingletonPtr();
// tell us a lot about what is going on (see CEGUI.log in the working directory)
CEGUI::Logger::getSingleton().setLoggingLevel(CEGUI::Informative);
// use this CEGUI scheme definition (see CEGUI docs for more)
CEGUI::SchemeManager::getSingleton().create((CEGUI::utf8*)"TaharezLookSkin.scheme", (CEGUI::utf8*)"GUI");
// show the CEGUI mouse cursor (defined in the look-n-feel)
pSystem->setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow");
// use this font for text in the UI
CEGUI::FontManager::getSingleton().create("Tahoma-8.font", (CEGUI::utf8*)"GUI");
pSystem->setDefaultFont((CEGUI::utf8*)"Tahoma-8");
// load a layout from the XML layout file (you'll find this in resources/gui.zip), and
// put it in the GUI resource group
CEGUI::Window* pLayout = CEGUI::WindowManager::getSingleton().loadWindowLayout("katana.layout", "", "GUI");
// you need to tell CEGUI which layout to display. You can call this at any time to change the layout to
// another loaded layout (i.e. moving from screen to screen or to load your HUD layout). Note that this takes
// a CEGUI::Window instance -- you can use anything (any widget) that serves as a root window.
pSystem->setGUISheet(pLayout);
// this next bit is for the sake of the input handler
unsigned long hWnd;
// WINDOW is generic to all platforms now as of Eihort
window->getCustomAttribute("WINDOW", &hWnd);
// set up the input handlers
Simulation *sim = new Simulation();
// since the input handler deals with pushing input to CEGUI, we need to give it a pointer
// to the CEGUI System instance to use
InputHandler *handler = new InputHandler(pSystem, sim, hWnd);
// put us into our "main menu" state
sim->requestStateChange(GUI);
// make an instance of our GUI sheet handler class
MainMenuDlg* pDlg = new MainMenuDlg(pSystem, pLayout, sim);
//testing shit
Ogre::SceneNode *systemNode = sceneMgr->getRootSceneNode()->createChildSceneNode(Ogre::Vector3(0,0,0));
SphereMesh *sphere = NULL;
sphere->createSphere("sphereMesh", 80, 64, 64);
/*
// Now I can create several entities using that mesh
Ogre::Entity *MoonEntity = sceneMgr->createEntity("Moon", planetMesh);
// Now I attach it to a scenenode, so that it becomes present in the scene.
Ogre::SceneNode *EarthOrbitNode = systemNode->createChildSceneNode("Earth Orbit", Ogre::Vector3(0,0,0));
Ogre::SceneNode *EarthNode = EarthOrbitNode->createChildSceneNode("Earth", Ogre::Vector3(200,0,0));
Ogre::SceneNode *MoonNode = EarthNode->createChildSceneNode("Moon", Ogre::Vector3(150,0,0));
MoonNode->attachObject(MoonEntity);
MoonEntity->getParentNode()->scale(0.5,0.5,0.5);
示例9: WinMain
//.........这里部分代码省略.........
/* meshes */
Ogre::Entity* ent = sceneMgr->createEntity( "BouwPlaatsEntity", "world.mesh" );
Ogre::SceneNode* node = sceneMgr->getRootSceneNode()->createChildSceneNode("BouwNode", Ogre::Vector3(0, 0, 0));
node->attachObject(ent);
//node->setScale(Ogre::Vector3(0.7,0.7,0.7));
ent = sceneMgr->createEntity("plaats", "bouwplaats_step_00.mesh");
Ogre::Vector3 size = ent->getBoundingBox().getSize();
Ogre::LogManager::getSingletonPtr()->getDefaultLog()->logMessage(Ogre::String("Bouwplaats size: ") + Ogre::StringConverter::toString(size));
size = ent->getBoundingBox().getMaximum();
Ogre::LogManager::getSingletonPtr()->getDefaultLog()->logMessage(Ogre::String("Bouwplaats max: ") + Ogre::StringConverter::toString(size));
size = ent->getBoundingBox().getMinimum();
Ogre::LogManager::getSingletonPtr()->getDefaultLog()->logMessage(Ogre::String("Bouwplaats min: ") + Ogre::StringConverter::toString(size));
Ogre::Entity* ent1 = sceneMgr->createEntity( "KeetEntity", "keet.mesh" );
Ogre::SceneNode* scenenode = sceneMgr->getRootSceneNode()->createChildSceneNode("KeetNode", Ogre::Vector3(0, 0, 0));
scenenode->attachObject(ent1);
Ogre::Entity* ent2 = sceneMgr->createEntity( "HekjeEntity", "hekje.mesh" );
Ogre::SceneNode* scenenode2 = sceneMgr->getRootSceneNode()->createChildSceneNode("HekjeNode", Ogre::Vector3(0, -100, 0));
scenenode2->attachObject(ent2);
scenenode2->setScale(Ogre::Vector3(400,0,100));
// most examples get the viewport size to calculate this; for now, we'll just
// set it to 4:3 the easy way
camera->setAspectRatio((Ogre::Real)1.333333);
camera->setPosition(Ogre::Vector3(40,100,10));
guiCamera->setPosition(0, 0, 300);
guiCamera->lookAt(node->getPosition());
// this next bit is for the sake of the input handler
unsigned long hWnd;
window->getCustomAttribute("WINDOW", &hWnd);
// set up the input handlers
Simulation *sim = new Simulation();
InputHandler *handler = new InputHandler(sim, hWnd, camera);
DataManager *dataManager = new DataManager();
GameAI* gameAI = new GameAI(dataManager);
//Create Network
Network * net = new Network(dataManager);
//net->start();
sim->requestStateChange(GUI);
gui = new GuiManager();
// networkshit
while(!net->isConnected())
{
Sleep(1000);
}
net->Send(GETGROUPS, "", "", NULL);
net->Send(LOGIN, "gast", "gast", 1);
gui->setSimulation(sim);
gui->init("", ogre, guiSceneMgr, window);
gui->activate("main");
handler->setWindowExtents(1024,768);
SimulationState cState;
Ogre::WindowEventUtilities::addWindowEventListener(window, handler);
DWORD tFrameStart = 0x0; //in miliseconds
示例10: initialise
bool initialise()
{
mRoot = new Ogre::Root(PLUGINS_CFG, OGRE_CFG, OGRE_LOG);
if (!mRoot->restoreConfig())
if (!mRoot->showConfigDialog())
return false;
initResources();
mWindow = mRoot->initialise(true, "CS Clone Editor v0.0");
Ogre::WindowEventUtilities::addWindowEventListener(mWindow, this);
mSceneMgr = mRoot->createSceneManager(Ogre::ST_GENERIC);
mSceneMgr->setAmbientLight(Ogre::ColourValue(0.7, 0.7, 0.7));
mCamera = mSceneMgr->createCamera("camera");
mWindow->addViewport(mCamera);
mCamera->setAutoAspectRatio(true);
mCamera->setNearClipDistance(0.1);
mCamera->setFarClipDistance(10000);
mCamera->setPosition(10, 10, 10);
// mCamera->lookAt(0, 0, 0);
mRoot->addFrameListener(this);
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
//Initializing OIS
Ogre::LogManager::getSingletonPtr()->logMessage("*-*-* OIS Initialising");
OIS::ParamList pl;
size_t windowHnd = 0;
mWindow->getCustomAttribute("WINDOW", &windowHnd);
pl.insert(std::make_pair(std::string("WINDOW"), Ogre::StringConverter::toString(windowHnd)));
#if OGRE_DEBUG_MODE == 1
#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX
#define NO_EXCLUSIVE_INPUT
#endif
#endif
#ifdef NO_EXCLUSIVE_INPUT
#if defined OIS_WIN32_PLATFORM
pl.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_FOREGROUND" )));
pl.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_NONEXCLUSIVE")));
pl.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_FOREGROUND")));
pl.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_NONEXCLUSIVE")));
#elif defined OIS_LINUX_PLATFORM
pl.insert(std::make_pair(std::string("x11_mouse_grab"), std::string("false")));
pl.insert(std::make_pair(std::string("x11_mouse_hide"), std::string("false")));
pl.insert(std::make_pair(std::string("x11_keyboard_grab"), std::string("false")));
pl.insert(std::make_pair(std::string("XAutoRepeatOn"), std::string("true")));
#endif
#endif
mInputManager = OIS::InputManager::createInputSystem(pl);
mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject(OIS::OISKeyboard, true));
mKeyboard->setEventCallback(this);
mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject(OIS::OISMouse, true));
mMouse->setEventCallback(this);
windowResized(mWindow);
//Initialising GUI
Ogre::LogManager::getSingletonPtr()->logMessage("*-*-* MyGUI Initialising");
mGUI = new MyGUI::Gui;
mGUI->initialise(mWindow);
mGUI->load("editor.layout");
mMenuBar = mGUI->createWidget<MyGUI::MenuBar>("MenuBar",
MyGUI::IntCoord(0, 0, mGUI->getViewWidth(), 28),
MyGUI::ALIGN_TOP | MyGUI::ALIGN_HSTRETCH, "Overlapped");
mMenuBar->addItem("File");
mPopupMenuFile = mMenuBar->getItemMenu(0);
mPopupMenuFile->addItem("New");
mPopupMenuFile->addItem("Open ...");
mPopupMenuFile->addItem("Save");
mPopupMenuFile->addItem("Save as ...", false, true);
mPopupMenuFile->addItem("Settings", false, true);
mPopupMenuFile->addItem("Quit");
mMenuBar->addItem("Help");
mPopupMenuHelp = mMenuBar->getItemMenu(1);
mPopupMenuHelp->addItem("Help");
mPopupMenuHelp->addItem("About ...");
return (true);
}
示例11: initOgreAR
//.........这里部分代码省略.........
pMatrix[8], pMatrix[9], pMatrix[10], pMatrix[11],
pMatrix[12], pMatrix[13], pMatrix[14], pMatrix[15]);
camera->setCustomProjectionMatrix(true, PM);
camera->setCustomViewMatrix(true, Ogre::Matrix4::IDENTITY);
window->addViewport(camera);
cameraNode = smgr->getRootSceneNode()->createChildSceneNode("cameraNode");
cameraNode->attachObject(camera);
/// CREATE BACKGROUND FROM CAMERA IMAGE
int width = camParams.CamSize.width;
int height = camParams.CamSize.height;
// create background camera image
mPixelBox = Ogre::PixelBox(width, height, 1, Ogre::PF_R8G8B8, buffer);
// Create Texture
mTexture = Ogre::TextureManager::getSingleton().createManual("CameraTexture",Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::TEX_TYPE_2D,width,height,0,Ogre::PF_R8G8B8,Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE);
//Create Camera Material
Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().create("CameraMaterial", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
Ogre::Technique *technique = material->createTechnique();
technique->createPass();
material->getTechnique(0)->getPass(0)->setLightingEnabled(false);
material->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false);
material->getTechnique(0)->getPass(0)->createTextureUnitState("CameraTexture");
Ogre::Rectangle2D* rect = new Ogre::Rectangle2D(true);
rect->setCorners(-1.0, 1.0, 1.0, -1.0);
rect->setMaterial("CameraMaterial");
// Render the background before everything else
rect->setRenderQueueGroup(Ogre::RENDER_QUEUE_BACKGROUND);
// Hacky, but we need to set the bounding box to something big, use infinite AAB to always stay visible
Ogre::AxisAlignedBox aabInf;
aabInf.setInfinite();
rect->setBoundingBox(aabInf);
// Attach background to the scene
Ogre::SceneNode* node = smgr->getRootSceneNode()->createChildSceneNode("Background");
node->attachObject(rect);
/// CREATE SIMPLE OGRE SCENE
// add sinbad.mesh
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(resourcePath + "Sinbad.zip", "Zip", "Popular");
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
for(int i=0; i<MAX_MARKERS; i++) {
Ogre::String entityName = "Marker_" + Ogre::StringConverter::toString(i);
Ogre::Entity* ogreEntity = smgr->createEntity(entityName, "Sinbad.mesh");
Ogre::Real offset = ogreEntity->getBoundingBox().getHalfSize().y;
ogreNode[i] = smgr->getRootSceneNode()->createChildSceneNode();
// add entity to a child node to correct position (this way, entity axis is on feet of sinbad)
Ogre::SceneNode *ogreNodeChild = ogreNode[i]->createChildSceneNode();
ogreNodeChild->attachObject(ogreEntity);
// Sinbad is placed along Y axis, we need to rotate to put it along Z axis so it stands up over the marker
// first rotate along X axis, then add offset in Z dir so it is over the marker and not in the middle of it
ogreNodeChild->rotate(Ogre::Vector3(1,0,0), Ogre::Radian(Ogre::Degree(90)));
ogreNodeChild->translate(0,0,offset,Ogre::Node::TS_PARENT);
// mesh is too big, rescale!
const float scale = 0.006675f;
ogreNode[i]->setScale(scale, scale, scale);
// Init animation
ogreEntity->getSkeleton()->setBlendMode(Ogre::ANIMBLEND_CUMULATIVE);
if(i==0)
{
baseAnim[i] = ogreEntity->getAnimationState("HandsClosed");
topAnim[i] = ogreEntity->getAnimationState("HandsRelaxed");
}
else if(i==1)
{
baseAnim[i] = ogreEntity->getAnimationState("Dance");
topAnim[i] = ogreEntity->getAnimationState("Dance");
}
else if(i==2)
{
baseAnim[i] = ogreEntity->getAnimationState("RunBase");
topAnim[i] = ogreEntity->getAnimationState("RunTop");
}
else
{
baseAnim[i] = ogreEntity->getAnimationState("IdleBase");
topAnim[i] = ogreEntity->getAnimationState("IdleTop");
}
baseAnim[i]->setLoop(true);
topAnim[i]->setLoop(true);
baseAnim[i]->setEnabled(true);
topAnim[i]->setEnabled(true);
}
/// KEYBOARD INPUT READING
size_t windowHnd = 0;
window->getCustomAttribute("WINDOW", &windowHnd);
im = OIS::InputManager::createInputSystem(windowHnd);
keyboard = static_cast<OIS::Keyboard*>(im->createInputObject(OIS::OISKeyboard, true));
return 1;
}