void DemoKeeper::createScene() { base::BaseDemoManager::createScene(); MyGUI::ResourceManager::getInstance().load("SplineSkin.xml"); const MyGUI::VectorWidgetPtr& root = MyGUI::LayoutManager::getInstance().loadLayout("HelpPanel.layout"); root.at(0)->findWidget("Text")->castType<MyGUI::TextBox>()->setCaption("PolygonalSkin usage. Drag white rectangles to move points for bezier curve."); MyGUI::VectorWidgetPtr widgets = MyGUI::LayoutManager::getInstance().loadLayout("SplineWindow.layout"); mQualityText = widgets.at(0)->findWidget("SplineText")->castType<MyGUI::TextBox>(); MyGUI::ScrollBar* qualityScroll = widgets.at(0)->findWidget("SplineQuality")->castType<MyGUI::ScrollBar>(); qualityScroll->eventScrollChangePosition += MyGUI::newDelegate(this, &DemoKeeper::notifyChangeQuality); mClient = widgets.at(0)->findWidget("SplineClient"); // create widget with skin that contain specific sub skin - PolygonalSkin MyGUI::Widget* widget = mClient->createWidget<MyGUI::Widget>("PolygonalSkin", MyGUI::IntCoord(MyGUI::IntPoint(), mClient->getSize()), MyGUI::Align::Stretch); widget->setColour(MyGUI::Colour::Red); // get main subskin MyGUI::ISubWidget* main = widget->getSubWidgetMain(); mPolygonalSkin = main->castType<MyGUI::PolygonalSkin>(); // set PolygonalSkin properties and points mPolygonalSkin->setWidth(8.0f); for (int i = 0; i < PointsCount; ++i) { point[i] = mClient->createWidget<MyGUI::Button>("Button", MyGUI::IntCoord(10 + (i + i % 2 * 3) * 40, 10 + (i + i / 2 * 3) * 40, 16, 16), MyGUI::Align::Default); point[i]->eventMouseDrag += newDelegate(this, &DemoKeeper::notifyPointMove); point[i]->eventMouseButtonPressed += newDelegate(this, &DemoKeeper::notifyPointPressed); } notifyChangeQuality(qualityScroll, 12); updateSpline(); }
CameraPanel::CameraPanel(Ogre::Camera *cam) :mCamera(cam), mCamMode(1) { // MyGUI::LayoutManager::getInstance().loadLayout("ControlPanel.layout"); MyGUI::VectorWidgetPtr mWidgets = MyGUI::LayoutManager::getInstance().loadLayout("CameModeLayout.layout"); mWidgets.at(0)->setAlign(MyGUI::Align::Top); mBtnFixed = (MyGUI::Button*)mWidgets.at(0)->findWidget("RBCamFixed"); mBtnManipulable = (MyGUI::Button*)mWidgets.at(0)->findWidget("RBCamManipulable"); mBtnTracking = (MyGUI::Button*)mWidgets.at(0)->findWidget("RBCamTracking"); mBtnFixed->setStateSelected(true); mBtnFixed->eventMouseButtonClick += MyGUI::newDelegate(this, &CameraPanel::notifyMouseButtonClick); mBtnManipulable->eventMouseButtonClick += MyGUI::newDelegate(this, &CameraPanel::notifyMouseButtonClick); mBtnTracking->eventMouseButtonClick += MyGUI::newDelegate(this, &CameraPanel::notifyMouseButtonClick); }