PanoramicVideo::PanoramicVideo(ds::ui::SpriteEngine& engine) : ds::ui::Sprite(engine) , mVideoSprite(nullptr) , mInvertX(false) , mInvertY(true) , mXSensitivity(0.15f) , mYSensitivity(0.15f) , mFov(60.0f) , mAutoSync(true) , mPanning(0.0f) , mXRot(0.0f) , mYRot(-90.0f) { mBlobType = _BLOB; setUseShaderTexture(true); setTransparent(true); mSphereVbo = ci::gl::VboMesh::create(ci::geom::Sphere().subdivisions(120).radius(200.0f)); resetCamera(); enable(true); enableMultiTouch(ds::ui::MULTITOUCH_INFO_ONLY); setProcessTouchCallback([this](ds::ui::Sprite*, const ds::ui::TouchInfo& ti){ handleDrag(ci::vec2(ti.mDeltaPoint)); }); }
TreeInspector::TreeInspector(Globals& g) : ds::ui::Sprite(g.mEngine) , mGlobals(g) , mEventClient(g.mEngine.getNotifier(), [this](const ds::Event *m){ if(m) this->onAppEvent(*m); }) , mLayout(nullptr) , mTreeRoot(nullptr) , mHighlighter(nullptr) { setPosition(800.0f, 200.0f); enable(true); enableMultiTouch(ds::ui::MULTITOUCH_CAN_POSITION); }
TreeItem::TreeItem(Globals& g, ds::ui::Sprite* linkedItem) : ds::ui::Sprite(g.mEngine) , mGlobals(g) , mLinkedSprite(linkedItem) , mNameText(nullptr) , mLabelTextTwo(nullptr) { ds::ui::ImageButton* deleteButton = new ds::ui::ImageButton(mEngine, "%APP%/data/images/ui/close_button.png", "%APP%/data/images/ui/close_button.png", 10.0f); deleteButton->setScale(0.25f, 0.25f); deleteButton->getHighImage().setColor(ci::Color(0.7f, 0.2f, 0.2f)); addChildPtr(deleteButton); deleteButton->setClickFn([this]{ callAfterDelay([this]{ mEngine.getNotifier().notify(DeleteSpriteRequest(mLinkedSprite)); }, 0.01f); }); float paddin = 10.0f; mLayoutLPad = paddin / 2.0f; mLayoutRPad = paddin/2.0f; float theWiddy = 0.0f; float theHiddy = 0.0f; mNameText = mGlobals.getText("tree:item").create(mEngine, this); mNameText->setText(mLinkedSprite->getSpriteName()); mNameText->setPosition(deleteButton->getScaleWidth(), paddin / 2.0f); theWiddy += mNameText->getWidth() + paddin / 2.0f + deleteButton->getScaleWidth(); theHiddy = mNameText->getFontSize() + paddin; mLabelTextTwo = mGlobals.getText("tree:item_two").create(mEngine, this); mLabelTextTwo->setText(ds::ui::XmlImporter::getSpriteTypeForSprite(mLinkedSprite)); mLabelTextTwo->setPosition(theWiddy, paddin / 2.0f); theWiddy += mLabelTextTwo->getWidth() + paddin / 2.0f; if(mLabelTextTwo->getFontSize() + paddin > theHiddy){ theHiddy = mLabelTextTwo->getFontSize() + paddin; } setTransparent(false); setColor(ci::Color(0.1f, 0.1f, 0.1f)); setSize(theWiddy, theHiddy); enable(true); enableMultiTouch(ds::ui::MULTITOUCH_CAN_POSITION); setTapCallback([this](ds::ui::Sprite* bs, const ci::Vec3f& pos){ if(mLinkedSprite){ mEngine.getNotifier().notify(InspectSpriteRequest(mLinkedSprite)); } }); }
ScrollBar::ScrollBar(ds::ui::SpriteEngine& engine, const bool vertical, const float uiWidth, const float touchPadding, const bool autoHide) : Sprite(engine) , mVertical(vertical) , mNub(nullptr) , mBackground(nullptr) , mScrollPercent(0.0f) , mPercentVisible(1.0f) , mMinNubSize(uiWidth) , mTouchPadding(touchPadding) , mAutoHide(autoHide) , mAutoHidden(false) { // Set some defaults // You can change these by getting the nub and background sprites and changing them mBackground = new ds::ui::Sprite(mEngine); mBackground->mExportWithXml = false; mBackground->setTransparent(false); mBackground->setColor(ci::Color(0.1f, 0.1f, 0.1f)); mBackground->setCornerRadius(uiWidth/2.0f); mBackground->setOpacity(0.7f); addChildPtr(mBackground); mNub = new ds::ui::Sprite(mEngine); mNub->mExportWithXml = false; mNub->setTransparent(false); mNub->setColor(ci::Color(0.9f, 0.9f, 0.9f)); mNub->setOpacity(0.3f); mNub->setSize(uiWidth, uiWidth); mNub->setCornerRadius(uiWidth/2.0f); addChildPtr(mNub); enable(true); enableMultiTouch(ds::ui::MULTITOUCH_INFO_ONLY); setProcessTouchCallback([this](ds::ui::Sprite* bs, const ds::ui::TouchInfo& ti){ handleScrollTouch(bs, ti); }); setSize(mTouchPadding * 2.0f + uiWidth, mTouchPadding * 2.0f + uiWidth); if(mAutoHide){ doAutoHide(true); hide(); // immediately hide, but also call the function to track the state correctly setOpacity(0.0f); animOpacityStop(); } }