how ogre3d engine integrate qlabel qbutton and qLabel ?
Unsolved
General and Desktop
-
how ogre3d engine integrate qlabel qbutton and qLabel ?
as in ogre3d engine integrate add a qlabel library, qbutton library and qLabel library.
I am trying to run libRocket and mygui this all shit and no go in me ;_;
ImGuiDemo.h
#pragma once #include "SdkSample.h" #include "OgreImGuiOverlay.h" #include <OgreImGuiInputListener.h> using namespace Ogre; using namespace OgreBites; class _OgreSampleClassExport Sample_ImGui : public SdkSample, public RenderTargetListener { std::unique_ptr<ImGuiInputListener> mImguiListener; InputListenerChain mListenerChain; public: // Basic constructor Sample_ImGui() { mInfo["Title"] = "Dear ImGui integration"; mInfo["Description"] = "Overlay ImGui interactions"; mInfo["Category"] = "Unsorted"; mInfo["Thumbnail"] = "thumb_imgui.png"; } void preViewportUpdate(const RenderTargetViewportEvent& evt) { if(!evt.source->getOverlaysEnabled()) return; if(!mTrayMgr->getTraysLayer()->isVisible()) return; ImGuiOverlay::NewFrame(); ImGui::ShowDemoWindow(); } bool keyPressed(const KeyboardEvent& evt) { return mListenerChain.keyPressed(evt); } bool keyReleased(const KeyboardEvent& evt) { return mListenerChain.keyReleased(evt); } bool mouseMoved(const MouseMotionEvent& evt) { return mListenerChain.mouseMoved(evt); } bool mouseWheelRolled(const MouseWheelEvent& evt) { return mListenerChain.mouseWheelRolled(evt); } bool mousePressed(const MouseButtonEvent& evt) { return mListenerChain.mousePressed(evt); } bool mouseReleased(const MouseButtonEvent& evt) { return mListenerChain.mouseReleased(evt); } bool textInput (const TextInputEvent& evt) { return mListenerChain.textInput (evt); } void setupContent(void) { auto imguiOverlay = new ImGuiOverlay(); imguiOverlay->setZOrder(300); imguiOverlay->show(); OverlayManager::getSingleton().addOverlay(imguiOverlay); // now owned by overlaymgr /* NOTE: Custom apps will ASSERT on ImGuiOverlay::NewFrame() and not display any UI if they have not registered the overlay system by calling mSceneMgr->addRenderQueueListener(mOverlaySystem). OgreBites::SampleBrowser does this on behalf of the ImGuiDemo but custom applications will need to call this themselves. See ApplicationContextBase::createDummyScene(). */ mWindow->addListener(this); mImguiListener.reset(new ImGuiInputListener()); mListenerChain = InputListenerChain({mTrayMgr.get(), mImguiListener.get(), mCameraMan.get()}); mTrayMgr->showCursor(); mCameraMan->setStyle(OgreBites::CS_ORBIT); mCameraMan->setYawPitchDist(Degree(0), Degree(0), 15); SceneNode* lightNode = mSceneMgr->getRootSceneNode()->createChildSceneNode(); lightNode->setPosition(0, 10, 15); lightNode->attachObject(mSceneMgr->createLight("MainLight")); Entity* ent = mSceneMgr->createEntity("Sinbad.mesh"); SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode(); node->attachObject(ent); } void cleanupContent() { OverlayManager::getSingleton().destroy("ImGuiOverlay"); mWindow->removeListener(this); } };
Bootstrap.cpp
// This file is part of the OGRE project. // It is subject to the license terms in the LICENSE file found in the top-level directory // of this distribution and at https://www.ogre3d.org/licensing. // SPDX-License-Identifier: MIT #include "Ogre.h" #include "OgreApplicationContext.h" #include "MyGUI.h" #include "imgui.h" #include "ImGuiDemo.h" class MyTestApp : public OgreBites::ApplicationContext, public OgreBites::InputListener { public: MyTestApp(); void setup(); bool keyPressed(const OgreBites::KeyboardEvent& evt); private: void increaseFontHeight(MyGUI::Widget* _sender); void decreaseFontHeight(MyGUI::Widget* _sender); private: std::array<MyGUI::EditBox*, 5> mEditBoxes; }; //! [constructor] MyTestApp::MyTestApp() : OgreBites::ApplicationContext("OgreTutorialApp") { } //! [constructor] //! [key_handler] bool MyTestApp::keyPressed(const OgreBites::KeyboardEvent& evt) { if (evt.keysym.sym == OgreBites::SDLK_ESCAPE) { getRoot()->queueEndRendering(); } return true; } //! [key_handler] //! [setup] void MyTestApp::setup(void) { // do not forget to call the base first OgreBites::ApplicationContext::setup(); // register for input events addInputListener(this); // get a pointer to the already created root Ogre::Root* root = getRoot(); Ogre::SceneManager* scnMgr = root->createSceneManager(); // register our scene with the RTSS Ogre::RTShader::ShaderGenerator* shadergen = Ogre::RTShader::ShaderGenerator::getSingletonPtr(); shadergen->addSceneManager(scnMgr); // TextRenderer * TextR = new TextRenderer(); // without light we would just get a black screen Ogre::Light* light = scnMgr->createLight("MainLight"); Ogre::SceneNode* lightNode = scnMgr->getRootSceneNode()->createChildSceneNode(); lightNode->setPosition(0, 10, 15); lightNode->attachObject(light); // also need to tell where we are Ogre::SceneNode* camNode = scnMgr->getRootSceneNode()->createChildSceneNode(); camNode->setPosition(0, 0, 15); camNode->lookAt(Ogre::Vector3(0, 0, -1), Ogre::Node::TS_PARENT); // create the camera Ogre::Camera* cam = scnMgr->createCamera("myCam"); cam->setNearClipDistance(5); // specific to this sample cam->setAutoAspectRatio(true); camNode->attachObject(cam); // and tell it to render into the main window getRenderWindow()->addViewport(cam); // finally something to render Ogre::Entity* ent = scnMgr->createEntity("Sinbad.mesh"); Ogre::SceneNode* node = scnMgr->getRootSceneNode()->createChildSceneNode(); // Ogre::SceneNode * node = scnMgr->createSceneNode("Nodel"); // scnMgr->getRootSceneNode()->addChild(node); node->attachObject(ent); //! [entity4] Ogre::Entity* ogreEntity4 = scnMgr->createEntity("Sinbad.mesh"); Ogre::SceneNode* ogreNode4 = scnMgr->getRootSceneNode()->createChildSceneNode(); ogreNode4->setPosition(-7, 0, 0); ogreNode4->roll(Ogre::Degree(-90)); ogreNode4->attachObject(ogreEntity4); //! [entity4] //! [entity4] Ogre::Entity* ogreEntity5 = scnMgr->createEntity("Sinbad.mesh"); Ogre::SceneNode* ogreNode5 = scnMgr->getRootSceneNode()->createChildSceneNode(); ogreNode5->setPosition(7, 0, 0); ogreNode5->roll(Ogre::Degree(-270)); ogreNode5->attachObject(ogreEntity5); //! [entity4] // ImGui::Button("Save"); // ImGui::InputText("string", buf, IM_ARRAYSIZE(buf)); // ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // MyGUI::Button* button1 = MyGUI::Gui::getInstance().createWidget<MyGUI::Button>("Button", MyGUI::IntCoord(110, 10, 200, 50), MyGUI::Align::Default, "Main"); // button1->eventMouseButtonClick += MyGUI::newDelegate(this, &MyTestApp::increaseFontHeight); // button1->setCaption("Increase font height"); // MyGUI::Button* button2 = MyGUI::Gui::getInstance().createWidget<MyGUI::Button>("Button", MyGUI::IntCoord(320, 10, 200, 50), MyGUI::Align::Default, "Main"); // button2->eventMouseButtonClick += MyGUI::newDelegate(this, &MyTestApp::decreaseFontHeight); // button2->setCaption("Decrease font height"); // Ogre::TextRenderer::getSingleton().addTextBox("text", "Last FPS:", 10, 10, 100, 20, Ogre::ColourValue(redValue, greenValue, blueValue, alphaValue); } //! [setup] ////! [main] //int main(int argc, char *argv[]) //{ // MyTestApp app; // app.initApp(); // app.getRoot()->startRendering(); // app.closeApp(); // return 0; //} ////! [main] //! [main] int main(int argc, char *argv[]) { Sample_ImGui app; app.setupContent(); app.cleanupContent(); return 0; } //! [main]
errors
/home/dima/dima_project/ogre_example8/ImGuiDemo.h:10: ошибка: expected initializer before ‘:’ token class _OgreSampleClassExport Sample_ImGui : public SdkSample, public RenderTargetListener ^
I still haven 't figured out how to fix this error . ж_ж