/**
 * Decreases the quantity of the selected alien to exterminate by "change".
 * @param change How much we want to remove.
 */
void ManageAlienContainmentState::decreaseByValue(int change)
{
	if (change <= 0 || _qtys[_sel] <= 0) return;
	change = std::min(_qtys[_sel], change);
	_qtys[_sel] -= change;
	_aliensSold -= change;
	updateStrings();
}
/**
 * Increases the quantity of the selected alien to exterminate by "change".
 * @param change How much we want to add.
 */
void ManageAlienContainmentState::increaseByValue(int change)
{
	int qty = getQuantity() - _qtys[_sel];
	if (change <= 0 || qty <= 0) return;

	change = std::min(qty, change);
	_qtys[_sel] += change;
	_aliensSold += change;
	updateStrings();
}
Beispiel #3
0
StOutIZ3D::StOutIZ3D(const StHandle<StResourceManager>& theResMgr,
                     const StNativeWin_t                theParentWindow)
: StWindow(theResMgr, theParentWindow),
  mySettings(new StSettings(theResMgr, ST_OUT_PLUGIN_NAME)),
  myFrBuffer(new StGLStereoFrameBuffer()),
  myToCompressMem(myInstancesNb.increment() > 1),
  myIsBroken(false) {
    const StSearchMonitors& aMonitors = StWindow::getMonitors();

    // detect connected displays
    int aSupportLevel = ST_DEVICE_SUPPORT_NONE;
    for(size_t aMonIter = 0; aMonIter < aMonitors.size(); ++aMonIter) {
        const StMonitor& aMon = aMonitors[aMonIter];
        if(isFrontDisplay(aMon.getPnPId())
        || isBackDisplay (aMon.getPnPId())) {
            aSupportLevel = ST_DEVICE_SUPPORT_PREFER; // we sure that iZ3D connected
            break;
        }/* else if(aMon.getPnPId() == IZ3D_MODEL_MATROXTH2GO0
               || aMon.getPnPId() == IZ3D_MODEL_MATROXTH2GO1) {
            aSupportLevel = ST_DEVICE_SUPPORT_FULL; // is it possible
        }*/
    }

    // devices list
    StHandle<StOutDevice> aDevice = new StOutDevice();
    aDevice->PluginId = ST_OUT_PLUGIN_NAME;
    aDevice->DeviceId = stCString("iZ3D");
    aDevice->Priority = aSupportLevel;
    aDevice->Name     = stCString("IZ3D Display");
    myDevices.add(aDevice);

    // shader switch option
    params.Glasses = new StEnumParam(myShaders.getMode(), stCString("tableId"), stCString("tableId"));
    params.Glasses->signals.onChanged.connect(&myShaders, &StOutIZ3DShaders::doSetMode);

    // load window position
    if(isMovable()) {
        StRect<int32_t> aRect;
        if(!mySettings->loadInt32Rect(ST_SETTING_WINDOWPOS, aRect)) {
            aRect = defaultRect();
        }
        StWindow::setPlacement(aRect, true);
    }
    updateStrings();
    StWindow::setTitle("sView - iZ3D Renderer");

    // load parameters
    mySettings->loadParam(params.Glasses);

    // request slave window
    StWindow::setAttribute(StWinAttr_SlaveCfg, StWinSlave_slaveSync);
}
void HodginDidItApp::update()
{
	int cTime = getElapsedFrames();
	if(cTime < S_HELLO_START)
		mStage = 0;
	else if(cTime>=S_HELLO_START&&cTime<S_ASK_START)
		mStage = 1;
	else if(cTime>=S_ASK_START&&cTime<S_BL_2_SEG)
		mStage = 2;
	else if(cTime>=S_BL_2_SEG&&cTime<S_SEG_2_BW)
		mStage = 3;
	else if(cTime>=S_SEG_2_BW&&cTime<S_BW_2_RGB)
		mStage = 4;
	else if(cTime>=S_BW_2_RGB&&cTime<S_VEIL_START)
		mStage = 5;
	else if(cTime>=S_VEIL_START)
		mStage = 6;
		
	if(mStage>=3)
	{
		if(mPXC.AcquireFrame(true))
		{
			updateCamera();
			mPXC.ReleaseFrame();
		}
	}

	switch(mStage)
	{
		case 1:
		case 2:
		{
			updateStrings();
			break;
		}
		case 3:
		case 4:
		case 5:
		{
			updateBlend();
			break;
		}
		case 6:
		{
			updateVeil();
			break;
		}
	}
}
Beispiel #5
0
void
Hub::StringsUpdate::updateHub (Hub& hub)
{
    QMutexLocker _(&hub.impl->stringsValuesMutex);

    strings = hub.impl->stringsValues[name];

    _.unlock();

    updateStrings(strings);

    _.relock();

    hub.impl->stringsValues[name] = strings;
}
Beispiel #6
0
/**
	Performs Remove_dot_segments algorithm as specifed in section 5.2.4 of RFC3986.
	
	@param aUriInputPath It is an in-out parameter. aUriInputPath is a pointer to the 
	path descriptor to be normalised for extraneous dot_segments and returns with 
	normalised dot_segments.
	@leave KErrNoMemory
*/
void RemoveExtraneousDotSegmentsL(HBufC8* aUriInputPath)
	{
	TPtr8 uriPathBuf(aUriInputPath->Des());
	TInt length = uriPathBuf.Length();	
	HBufC8* path = HBufC8::NewLC(length);
	TPtr8 transitionalBuf(path->Des());

	while(length > 0)	
		{
		//step a of section 5.2.4 of RFC 3986
		if(length >= KDotDotSlashLength && 
			KDotDotSlash().Compare(uriPathBuf.Mid(0, KDotDotSlashLength)) == 0 )
			{
			uriPathBuf.Delete(0,KDotDotSlashLength);
			}
		//step a of section 5.2.4 of RFC 3986
		else if(length >= KDotDotLength && 
				KDotSlash().Compare(uriPathBuf.Mid(0, KDotDotLength)) == 0)
			{
			uriPathBuf.Delete(0,KDotDotLength);	
			}
		//step b of section 5.2.4 of RFC 3986
		else if(length >= KDotDotSlashLength && 
				KSlashDotSlash().Compare(uriPathBuf.Mid(0, KDotDotSlashLength)) == 0)
			{
			uriPathBuf.Replace(0, KDotDotSlashLength, KSlash);
			}
		//step c of section 5.2.4 of RFC 3986
		else if(length >= KSlashDotDotSlashLength && 
				KSlashDotDotSlash().Compare(uriPathBuf.Mid(0, KSlashDotDotSlashLength)) == 0)
			{
			updateStrings(uriPathBuf, transitionalBuf, KSlashDotDotSlashLength);
			}
		//step c of section 5.2.4 of RFC 3986 --complete path segment
		else if(length == KDotDotSlashLength && 
				KSlashDotDot().Compare(uriPathBuf.Mid(0, KDotDotSlashLength)) == 0)
			{
			updateStrings(uriPathBuf, transitionalBuf, KDotDotSlashLength);
			}
		//step b of section 5.2.4 of RFC 3986--complete path segment
		else if(length == KDotDotLength && 
				KSlashDot().Compare(uriPathBuf.Mid(0, KDotDotLength)) == 0)
			{
			uriPathBuf.Replace(0, KDotDotLength, KSlash);
			}
		//step d of section 5.2.4 of RFC 3986
		else if(length == KDotDotLength && 
				KDotDot().Compare(uriPathBuf.Mid(0)) == 0)
			{
			uriPathBuf.Delete(0,KDotDotLength);	
			}
		//step d of section 5.2.4 of RFC 3986
		else if(length == KDotLength && 
				KDot().Compare(uriPathBuf.Mid(0)) == 0)
			{
			uriPathBuf.Delete(0,KDotLength);	
			}
		//step e of section 5.2.4 of RFC 3986
		else 
			{
			//get the first path segment including initial / (if any)from uriPathBuf
			// till next slash (but not including next slash)..append it to the output Buf	
			TInt substrLength;
			TInt nextSlashPos = uriPathBuf.Find(KSlash);
			if(nextSlashPos == 0 && length > KDotLength)
				//replace with locate next
				{
				nextSlashPos = uriPathBuf.Mid(1).Find(KSlash);
				if(nextSlashPos != KErrNotFound)
					{
					++nextSlashPos;
					}
				}
			if(length == KDotLength)
				//only '/' is exist
				{
				substrLength = length;	
				}
			else
				{
				substrLength = nextSlashPos == KErrNotFound ? length : nextSlashPos ;	
				}
			transitionalBuf.Append(uriPathBuf.Mid(0,substrLength));
			uriPathBuf.Delete(0,substrLength);	
			}
		length = uriPathBuf.Length();
		}
	uriPathBuf.Copy(transitionalBuf);
	CleanupStack::PopAndDestroy(path);
	}