Exemplo n.º 1
0
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));
	});
}
Exemplo n.º 2
0
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();
	}
}