예제 #1
0
파일: misc.cpp 프로젝트: AzyxWare/ryzom
std::string getStringCategoryIfAny(const ucstring &src, ucstring &dest)
{
	std::string colorCode = "";
	if (src.size() >= 3)
	{
		uint startPos = 0;

		// Skip <NEW> or <CHG> if present at beginning
		ucstring preTag;
		const uint PreTagSize = 5;
		const ucstring newTag("<NEW>");
		if ( (src.size() >= PreTagSize) && (src.substr( 0, PreTagSize ) == newTag) )
		{
			startPos = PreTagSize;
			preTag = newTag;
		}
		const ucstring chgTag("<CHG>");
		if ( (src.size() >= PreTagSize) && (src.substr( 0, PreTagSize ) == chgTag) )
		{
			startPos = PreTagSize;
			preTag = chgTag;
		}

		if (src[startPos] == (ucchar) '&')
		{
			ucstring::size_type nextPos = src.find((ucchar) '&', startPos+1);
			if (nextPos != ucstring::npos)
			{
				uint codeSize = (uint)nextPos - startPos - 1;
				colorCode.resize( codeSize );
				for(uint k = 0; k < codeSize; ++k)
				{
					colorCode[k] = tolower((char) src[k + startPos + 1]);
				}
				ucstring destTmp;
				if ( startPos != 0 )
					destTmp = preTag; // leave <NEW> or <CHG> in the dest string
				destTmp += src.substr(nextPos + 1);
				dest = destTmp;
			}
			else
			{
				dest = src;
			}
		}
		else
		{
			dest = src;
		}
	}
	else
	{
		dest = src;
	}
	return colorCode;
}
예제 #2
0
파일: algo.cpp 프로젝트: CCChaos/RyzomCore
// ***************************************************************************
void		splitUCString(const ucstring &ucstr, const ucstring &separator, std::vector<ucstring> &retList)
{
	ucstring::size_type pos=0;
	ucstring::size_type newPos=0;
	retList.clear();
	while( (newPos= ucstr.find(separator,pos)) != ucstring::npos)
	{
		// if not empty sub str. (skip repetition of separator )
		if(newPos-pos>0)
			retList.push_back(ucstr.substr(pos, newPos-pos));
		// skip token
		pos= newPos+separator.size();
	}
	// copy the last substr
	if( pos<ucstr.size() )
		retList.push_back(ucstr.substr(pos, ucstr.size()-pos));
}
예제 #3
0
파일: misc.cpp 프로젝트: AzyxWare/ryzom
NLMISC::CRGBA interpClientCfgColor(const ucstring &src, ucstring &dest)
{
	CRGBA color = CRGBA::White;
	if (src.size() >= 3)
	{
		if (src[0] == (ucchar) '&')
		{
			ucstring::size_type nextPos = src.find((ucchar) '&', 1);
			if (nextPos != ucstring::npos)
			{
				std::string colorCode;
				colorCode.resize(nextPos - 1);
				for(uint k = 0; k < nextPos - 1; ++k)
				{
					colorCode[k] = tolower((char) src[k + 1]);
				}
				std::map<std::string, CClientConfig::SSysInfoParam>::const_iterator it = ClientCfg.SystemInfoParams.find(colorCode);
				if (it != ClientCfg.SystemInfoParams.end())
				{
					color = it->second.Color;
				}
				dest = src.substr(nextPos + 1);
			}
			else
			{
				dest = src;
			}
		}
		else
		{
			dest = src;
		}
	}
	else
	{
		dest = src;
	}
	return color;
}
예제 #4
0
//-----------------------------------------------
//	getString
//
//-----------------------------------------------
bool CClientChatManager::getString( ucstring &result, std::vector<uint64>& args, const ucstring &ucstrbase )
{
	result = ucstrbase;

	bool finalString = true;

	// deal with parameters
	uint32 dynParamIdx = 0;
	bool dynParamSearch = true;
	char chTmp[1024];
	while( dynParamSearch )
	{
		// search if a parameter exists in the string
		sprintf(chTmp,"$%d",dynParamIdx);
		ucstring ucstrTmp( chTmp );
		ucstring::size_type idx = result.find(ucstrTmp);

		// if there's a parameter in the string
		if( idx != ucstring::npos )
		{
			ucstring rep;
			rep = "???";
			if (dynParamIdx >= args.size())
			{
				nlwarning ("Missing args for string '%s', only %d args, need arg %d", ucstrbase.toString().c_str(), args.size(), dynParamIdx);
			}
			else
			{
				char c = (char)result[idx+ucstrTmp.size()];
				switch( c )
				{
					// parameter is an entry in the dynamic database
					case 'e':
					{
//							#ifdef OLD_STRING_SYSTEM
//								CDynamicStringInfos *res = _DynamicDB.getDynamicStringInfos ((uint32)args[dynParamIdx]);
//								if (!res->Associated)
//							#endif
							finalString = false;
//							#ifdef OLD_STRING_SYSTEM
//								rep = res->Str;
//							#endif
					}
					break;

					// parameter is a string
					case 's':
					{
						nlwarning ("string param not implemented in the vector<uint64> decoding");
					}
					break;

					// parameter is an unsigned integer
					case 'u':
					{
						uint32 nb = (uint32) args[dynParamIdx];
						rep = toString(nb);
					}
					break;

					// parameter is a signed integer
					case 'i':
					{
						sint32 nb = (sint32) args[dynParamIdx];
						rep = toString(nb);
					}
					break;

					// parameter is a float
					case 'f':
					{
						float nb = *(float *) &(args[dynParamIdx]);
						rep = toString(nb);
					}
					break;

					// parameter type is unknown
					default :
					{
						nlwarning("<CClientChatManager::getString> The dynamic type %c is unknown",c);
					}
					break;
				}
			}
			result.replace( idx, ucstrTmp.size()+1, rep );

			dynParamIdx++;
		}
		else
		{
			dynParamSearch = false;
		}
	};

	return finalString;

} // getString //
예제 #5
0
//-----------------------------------------------
//	getString
//
//-----------------------------------------------
ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr )
{

	// deal with parameters
	uint32 dynParamIdx = 0;
	bool dynParamSearch = true;
	char chTmp[1024];
	while( dynParamSearch )
	{
		// search if a parameter exists in the string
		sprintf(chTmp,"$%d",dynParamIdx);
		ucstring ucstrTmp( chTmp );
		ucstring::size_type idx = ucstr.find(ucstrTmp);

		// if there's a parameter in the string
		if( idx != ucstring::npos )
		{
			char c = (char)ucstr[idx+ucstrTmp.size()];
			switch( c )
			{
				// parameter is an entry in the dynamic database
				case 'e':
				{
					bool huff;
					bms.serialBit(huff);
					const ucstring dynStr("???");
					if( huff )
					{
						nldebug("<CClientChatManager::getString> receiving huffman dynamic parameter in static string");
//						#ifdef OLD_STRING_SYSTEM
//							_DynamicDB.decodeString( dynStr, bms );
//						#endif
					}
					else
					{
						//if( (sint32)bms.length()*8 - bms.getPosInBit() >= 32 )
						{
							uint32 nameIndex;
							bms.serial(nameIndex);
//							#ifdef OLD_STRING_SYSTEM
//								dynStr = _DynamicDB.getDynamicStringInfos(nameIndex)->Str;
//							#endif
						}
					}
					ucstr.replace( idx, ucstrTmp.size()+1, dynStr );
				}
				break;

				// parameter is a string
				case 's':
				{
					string dynStr;
					bms.serial( dynStr );
					ucstring ucDynStr(dynStr);
					ucstr.replace( idx, ucstrTmp.size()+1, ucDynStr );
				}
				break;

				// parameter is an unsigned integer
				case 'u':
				{
					uint32 nb;
					bms.serial( nb );
					ucstr.replace( idx, ucstrTmp.size()+1, ucstring(toString(nb)) );
				}
				break;
				/*
				case 'u':
				{
					uint i = idx + strTmp.size() + 1;
					string bitCountStr;
					while( isdigit(str[i]) )
					{
						bitCountStr += str[i];
						i++;
					}
					nlassert( !bitCountStr.empty() );
					uint32 bitCount;
					fromString(bitCountStr, bitCount);
					nlassert( bitCount <= 64 );
					uint64 nb;
					bms.serial( nb, bitCount );
					str.replace( idx, strTmp.size() + 1 + bitCountStr.size(), toString(nb) );
				}
				break;
				*/
				// parameter is a signed integer
				case 'i':
				{
					sint32 nb;
					bms.serial( nb );
					ucstr.replace( idx, ucstrTmp.size()+1, ucstring(toString(nb)) );
				}
				break;
				/*
				case 'i':
				{
					uint i = idx + strTmp.size() + 1;
					string bitCountStr;
					while( isdigit(str[i]) )
					{
						bitCountStr += str[i];
						i++;
					}
					nlassert( !bitCountStr.empty() );
					uint32 bitCount;
					fromString(bitCountStr, bitCount);
					nlassert( bitCount <= 64 );
					uint64 nb;
					bms.serial( nb, bitCount );
					str.replace( idx, strTmp.size() + 1 + bitCountStr.size(), toString(nb) );
				}
				break;
				*/

				// parameter is a float
				case 'f':
				{
					float nb;
					bms.serial( nb );
					ucstr.replace( idx, ucstrTmp.size()+1, ucstring(toString(nb)) );
				}
				break;

				// parameter type is unknown
				default :
				{
					nlwarning("<CClientChatManager::getString> The dynamic type %c is unknown",c);
				}
			}
			dynParamIdx++;
		}
		else
		{
			dynParamSearch = false;
		}
	};

	return ucstr;

} // getString //
예제 #6
0
파일: progress.cpp 프로젝트: mixxit/solinia
void CProgress::internalProgress (float value)
{
	//CustomMouse.updateCursor();
	// Get croped value
	value = getCropedValue (value);

	// can't do anything if no driver
	if (Driver == NULL)
		return;

	if (Driver->AsyncListener.isKeyPushed (KeyDOWN))
		selectTipsOfTheDay (TipsOfTheDayIndex-1);
	if (Driver->AsyncListener.isKeyPushed (KeyUP))
		selectTipsOfTheDay (TipsOfTheDayIndex+1);

	// Font factor
	float fontFactor = 1;
	if (Driver->getWindowHeight() > 0)
		fontFactor = (float)Driver->getWindowHeight() / 600.f;
	fontFactor *= _FontFactor;
	// Set 2d view.
	Driver->setMatrixMode2D11();
	Driver->clearBuffers (CRGBA(0,0,0,0));

	// Display the loading background.
	drawLoadingBitmap (value);

	// temporary values for conversions
	float x, y, width, height;

	for(uint i = 0; i < ClientCfg.Logos.size(); i++)
	{
		std::vector<string> res;
		explode(ClientCfg.Logos[i], std::string(":"), res);
		if(res.size()==9 && i<LogoBitmaps.size() && LogoBitmaps[i]!=NULL)
		{
			fromString(res[1], x);
			fromString(res[2], y);
			fromString(res[3], width);
			fromString(res[4], height);
			Driver->drawBitmap(x/(float)ClientCfg.Width, y/(float)ClientCfg.Height, width/(float)ClientCfg.Width, height/(float)ClientCfg.Height, *LogoBitmaps[i]);
		}
	}

	if (TextContext != NULL)
	{
		// Init the Pen.
		TextContext->setKeep800x600Ratio(false);
		TextContext->setColor(CRGBA(255,255,255));
		TextContext->setFontSize((uint)(12.f * fontFactor));
		TextContext->setHotSpot(UTextContext::TopRight);

#if !FINAL_VERSION
		// Display the Text.
		TextContext->printAt(1, 0.98f, _ProgressMessage);
#else
		if( ClientCfg.LoadingStringCount > 0 )
		{
			TextContext->printAt(1, 0.98f, _ProgressMessage);
		}
#endif // FINAL_VERSION

		// Display the build version.
		TextContext->setFontSize((uint)(12.f * fontFactor));
		TextContext->setHotSpot(UTextContext::TopRight);
		string str;
#if FINAL_VERSION
		str = "FV ";
#else
		str = "DEV ";
#endif
		str += RYZOM_VERSION;
		TextContext->printfAt(1.0f,1.0f, str.c_str());

		// Display the tips of the day.
		TextContext->setFontSize((uint)(16.f * fontFactor));
		TextContext->setHotSpot(UTextContext::MiddleTop);
		ucstring::size_type index = 0;
		ucstring::size_type end = TipsOfTheDay.find((ucchar)'\n');
		if (end == string::npos)
			end = TipsOfTheDay.size();
		float fY = ClientCfg.TipsY;
		if (!TipsOfTheDay.empty())
		{
			while (index < end)
			{
				// Get the line
				ucstring line = TipsOfTheDay.substr (index, end-index);

				// Draw the line
				TextContext->printAt(0.5f, fY, line);
				fY = nextLine (TextContext->getFontSize(), Driver->getWindowHeight(), fY);

				index=end+1;
				end = TipsOfTheDay.find((ucchar)'\n', index);
				if (end == ucstring::npos)
					end = TipsOfTheDay.size();
			}

			// More help
			TextContext->setFontSize((uint)(12.f * fontFactor));
			/* todo tips of the day uncomment
			ucstring ucstr = CI18N::get ("uiTipsEnd");
			TextContext->printAt(0.5f, fY, ucstr); */
			fY = nextLine (TextContext->getFontSize(), Driver->getWindowHeight(), fY);
			fY = nextLine (TextContext->getFontSize(), Driver->getWindowHeight(), fY);
		}



		if (!_TPReason.empty())
		{
			TextContext->setHotSpot(UTextContext::MiddleMiddle);
			TextContext->setFontSize((uint)(14.f * fontFactor));
			TextContext->printAt(0.5f, 0.5f, _TPReason);
			TextContext->setHotSpot(UTextContext::BottomLeft);
			TextContext->setColor(NLMISC::CRGBA::White);
		}



		if (!_TPCancelText.empty())
		{
			if (ClientCfg.Width != 0 && ClientCfg.Height != 0)
			{
				TextContext->setFontSize((uint)(15.f * fontFactor));
				TextContext->setHotSpot(UTextContext::BottomLeft);

				ucstring uc = CI18N::get("uiR2EDTPEscapeToInteruptLoading") + " (" + _TPCancelText + ") - " + CI18N::get("uiDelayedTPCancel");
				UTextContext::CStringInfo info = TextContext->getStringInfo(uc);
				float stringX = 0.5f - info.StringWidth/(ClientCfg.Width*2);
				TextContext->printAt(stringX, 7.f / ClientCfg.Height, uc);
			}
		}


		// Teleport help
		fY = ClientCfg.TeleportInfoY;
		if (LoadingContinent && !LoadingContinent->Indoor)
		{
			TextContext->setFontSize((uint)(16.f * fontFactor));

			// Print some more info
			uint32 day = RT.getRyzomDay();
			str = toString (CI18N::get ("uiTipsTeleport").toUtf8().c_str(),
				CI18N::get (LoadingContinent->LocalizedName).toUtf8().c_str(),
				day,
				(uint)RT.getRyzomTime(),
				CI18N::get ("uiSeason"+toStringEnum(CRyzomTime::getSeasonByDay(day))).toUtf8().c_str(),
				CI18N::get (WeatherManager.getCurrWeatherState().LocalizedName).toUtf8().c_str());
			ucstring ucstr;
			ucstr.fromUtf8 (str);
		}

		// apply text commands
		if( ApplyTextCommands )
		{
			std::vector<CClientConfig::SPrintfCommand> printfCommands = ClientCfg.PrintfCommands;
			if(FreeTrial) printfCommands = ClientCfg.PrintfCommandsFreeTrial;

			if( !printfCommands.empty() )
			{
				TextContext->setHotSpot(UTextContext::BottomLeft);

				vector<CClientConfig::SPrintfCommand>::iterator itpc;
				for( itpc = printfCommands.begin(); itpc != printfCommands.end(); ++itpc )
				{
					// Yoyo: the coordinates entered are though for 1024
					float x = ((*itpc).X / 1024.f);
					float y = ((*itpc).Y / 768.f);
					TextContext->setColor( (*itpc).Color );
					TextContext->setFontSize( (*itpc).FontSize );

					// build the ucstr(s)
					ucstring ucstr = CI18N::get((*itpc).Text);
					vector<ucstring> vucstr;
					ucstring sep("\n");
					splitUCString(ucstr,sep,vucstr);

					// Letter size
					UTextContext::CStringInfo si = TextContext->getStringInfo(ucstring("|"));
					uint fontHeight = (uint) si.StringHeight + 2; // we add 2 pixels for the gap

					uint i;
					float newy = y;
					for( i=0; i<vucstr.size(); ++i )
					{
						TextContext->printAt(x,newy, vucstr[i]);
						newy = nextLine(fontHeight, Driver->getWindowHeight(), newy);
					}
				}
			}
		}
	}

	// Clamp
	clamp (value, 0.f, 1.f);

	// Set matrix
	Driver->setMatrixMode2D11 ();

	// want to receive the 'mouse down' event to deal with the 'cancel tp button'
	Driver->EventServer.addListener(EventMouseDownId,	this);

	// Update messages
	CInputHandlerManager::getInstance()->pumpEventsNoIM();

	Driver->EventServer.removeListener(EventMouseDownId,	this);

	// Exit ?
	bool activeDriver =  Driver->isActive();
	if ((UseEscapeDuringLoading && Driver->AsyncListener.isKeyPushed (KeyESCAPE)) || !activeDriver)
	{
		// Release the application
		releaseMainLoop(true);
		release();
		// Leave the application
		extern void quitCrashReport ();
		quitCrashReport ();
		exit(EXIT_SUCCESS);
	}

	if(!_TPCancelText.empty() &&  Driver->AsyncListener.isKeyPushed(KeySHIFT) && Driver->AsyncListener.isKeyPushed(KeyESCAPE))
	{
		_TPCancelFlag = true;
	}


	CBGDownloaderAccess::getInstance().update();
	// Display to screen.
	Driver->swapBuffers();

	// \todo GUIGUI : Remove this when possible.
	NetMngr.update();
	CCDBNodeBranch::flushObserversCalls();
	//CustomMouse.updateCursor();

#ifdef TASKBAR_PROGRESS
	// update the taskbar progress
	if (pTaskbarList) pTaskbarList->SetProgressValue((HWND)Driver->getDisplay(), ULONGLONG(value * 1000), 1000);
#endif // TASKBAR_PROGRESS
}
예제 #7
0
void CProgress::internalProgress (float value)
{
	// Get croped value
	value = getCropedValue (value);

	// can't do anything if no driver
	if (Driver == NULL)
		return;

	if (Driver->AsyncListener.isKeyPushed (KeyDOWN))
		selectTipsOfTheDay (TipsOfTheDayIndex-1);
	if (Driver->AsyncListener.isKeyPushed (KeyUP))
		selectTipsOfTheDay (TipsOfTheDayIndex+1);

	// Create camera for stereo mode
	bool stereoHMD = StereoHMD && !MainCam.empty() && (MainCam.getTransformMode() == UCamera::RotQuat);
	CVector oldPos;
	CQuat oldQuat;
	if (stereoHMD)
	{
		MainCam.getPos(oldPos);
		MainCam.getRotQuat(oldQuat);
		StereoHMD->setInterfaceMatrix(CMatrix()); // identity
		NLMISC::CQuat hmdOrient = StereoHMD->getOrientation();
		NLMISC::CMatrix camMatrix;
		camMatrix.identity();
		NLMISC::CMatrix hmdMatrix;
		hmdMatrix.setRot(hmdOrient);
		NLMISC::CMatrix posMatrix; // minimal head modeling, will be changed in the future
		posMatrix.translate(StereoHMD->getEyePosition());
		NLMISC::CMatrix mat = ((camMatrix * hmdMatrix) * posMatrix);
		MainCam.setPos(mat.getPos());
		MainCam.setRotQuat(mat.getRot());
		StereoDisplay->updateCamera(0, &MainCam);
	}
	uint i = 0;
	while ((!stereoHMD && i == 0) || (stereoHMD && StereoDisplay->nextPass()))
	{
		++i;
		if (stereoHMD)
		{
			// modify cameras for stereo display
			const CViewport &vp = StereoDisplay->getCurrentViewport();
			Driver->setViewport(vp);
			StereoDisplay->getCurrentMatrix(0, &MainCam);
			StereoDisplay->getCurrentFrustum(0, &MainCam);

			// begin current pass
			StereoDisplay->beginRenderTarget();

			nldebug("Cam pos: %f, %f, %f", MainCam.getPos().x, MainCam.getPos().y, MainCam.getPos().z);
		}

		if (!stereoHMD || StereoDisplay->wantClear())
		{
			Driver->clearBuffers(CRGBA(0, 0, 0, 0));
		}

		if (stereoHMD && StereoDisplay->wantScene())
		{
			Driver->setMatrixMode3D(MainCam);
		}

		if (!stereoHMD || StereoDisplay->wantInterface2D())
		{
			// nldebug("Draw progress 2D");

			// Font factor
			float fontFactor = 1;
			if (Driver->getWindowHeight() > 0)
				fontFactor = (float)Driver->getWindowHeight() / 600.f;
			fontFactor *= _FontFactor;

			// Set 2d view.
			Driver->setMatrixMode2D11();

			// Display the loading background.
			drawLoadingBitmap(value);

			// temporary values for conversions
			float x, y, width, height;

			for(uint i = 0; i < ClientCfg.Logos.size(); i++)
			{
				std::vector<string> res;
				explode(ClientCfg.Logos[i], std::string(":"), res);
				if(res.size()==9 && i<LogoBitmaps.size() && LogoBitmaps[i]!=NULL)
				{
					fromString(res[1], x);
					fromString(res[2], y);
					fromString(res[3], width);
					fromString(res[4], height);
					Driver->drawBitmap(x/(float)ClientCfg.Width, y/(float)ClientCfg.Height, width/(float)ClientCfg.Width, height/(float)ClientCfg.Height, *LogoBitmaps[i]);
				}
			}

			if (TextContext != NULL)
			{
				// Init the Pen.
				TextContext->setKeep800x600Ratio(false);
				TextContext->setColor(CRGBA(255,255,255));
				TextContext->setFontSize((uint)(12.f * fontFactor));
				TextContext->setHotSpot(UTextContext::TopRight);

#if !FINAL_VERSION
				// Display the Text.
				TextContext->printAt(1, 0.98f, _ProgressMessage);
#else
				if( ClientCfg.LoadingStringCount > 0 )
				{
					TextContext->printAt(1, 0.98f, _ProgressMessage);
				}
#endif // FINAL_VERSION

				// Display the build version.
				TextContext->setFontSize((uint)(12.f * fontFactor));
				TextContext->setHotSpot(UTextContext::TopRight);
				string str;
#if FINAL_VERSION
				str = "FV ";
#else
				str = "DEV ";
#endif
				str += RYZOM_VERSION;
				TextContext->printfAt(1.0f,1.0f, str.c_str());

				// Display the tips of the day.
				TextContext->setFontSize((uint)(16.f * fontFactor));
				TextContext->setHotSpot(UTextContext::MiddleTop);
				ucstring::size_type index = 0;
				ucstring::size_type end = TipsOfTheDay.find((ucchar)'\n');
				if (end == string::npos)
					end = TipsOfTheDay.size();
				float fY = ClientCfg.TipsY;
				if (!TipsOfTheDay.empty())
				{
					while (index < end)
					{
						// Get the line
						ucstring line = TipsOfTheDay.substr (index, end-index);

						// Draw the line
						TextContext->printAt(0.5f, fY, line);
						fY = nextLine (TextContext->getFontSize(), Driver->getWindowHeight(), fY);

						index=end+1;
						end = TipsOfTheDay.find((ucchar)'\n', index);
						if (end == ucstring::npos)
							end = TipsOfTheDay.size();
					}

					// More help
					TextContext->setFontSize((uint)(12.f * fontFactor));
					/* todo tips of the day uncomment
					ucstring ucstr = CI18N::get ("uiTipsEnd");
					TextContext->printAt(0.5f, fY, ucstr); */
					fY = nextLine (TextContext->getFontSize(), Driver->getWindowHeight(), fY);
					fY = nextLine (TextContext->getFontSize(), Driver->getWindowHeight(), fY);
				}



				if (!_TPReason.empty())
				{
					TextContext->setHotSpot(UTextContext::MiddleMiddle);
					TextContext->setFontSize((uint)(14.f * fontFactor));
					TextContext->printAt(0.5f, 0.5f, _TPReason);
					TextContext->setHotSpot(UTextContext::BottomLeft);
					TextContext->setColor(NLMISC::CRGBA::White);
				}



				if (!_TPCancelText.empty())
				{
					if (ClientCfg.Width != 0 && ClientCfg.Height != 0)
					{
						TextContext->setFontSize((uint)(15.f * fontFactor));
						TextContext->setHotSpot(UTextContext::BottomLeft);

						ucstring uc = CI18N::get("uiR2EDTPEscapeToInteruptLoading") + " (" + _TPCancelText + ") - " + CI18N::get("uiDelayedTPCancel");
						UTextContext::CStringInfo info = TextContext->getStringInfo(uc);
						float stringX = 0.5f - info.StringWidth/(ClientCfg.Width*2);
						TextContext->printAt(stringX, 7.f / ClientCfg.Height, uc);
					}
				}


				// Teleport help
				//fY = ClientCfg.TeleportInfoY;
				if (!ApplyTextCommands && LoadingContinent && !LoadingContinent->Indoor)
				{
					TextContext->setFontSize((uint)(13.f * fontFactor));

					// Print some more info
					uint32 day = RT.getRyzomDay();
					str = toString (CI18N::get ("uiTipsTeleport").toUtf8().c_str(),
						CI18N::get (LoadingContinent->LocalizedName).toUtf8().c_str(),
						day,
						(uint)RT.getRyzomTime(),
						CI18N::get ("uiSeason"+toStringEnum(CRyzomTime::getSeasonByDay(day))).toUtf8().c_str(),
						CI18N::get (WeatherManager.getCurrWeatherState().LocalizedName).toUtf8().c_str());
					ucstring ucstr;
					ucstr.fromUtf8 (str);
					TextContext->setHotSpot(UTextContext::MiddleBottom);
					TextContext->setColor(CRGBA(186, 179, 163, 255));
					TextContext->printAt(0.5f, 25/768.f, ucstr);
				}

				// apply text commands
				if( ApplyTextCommands )
				{
					std::vector<CClientConfig::SPrintfCommand> printfCommands = ClientCfg.PrintfCommands;
					if(FreeTrial) printfCommands = ClientCfg.PrintfCommandsFreeTrial;

					if( !printfCommands.empty() )
					{
						TextContext->setHotSpot(UTextContext::MiddleBottom);

						vector<CClientConfig::SPrintfCommand>::iterator itpc;
						for( itpc = printfCommands.begin(); itpc != printfCommands.end(); ++itpc )
						{
							float x = 0.5f;//((*itpc).X / 1024.f);
							float y = ((*itpc).Y / 768.f);
							TextContext->setColor( (*itpc).Color );
							TextContext->setFontSize( (uint)(16.f * fontFactor));

							// build the ucstr(s)
							ucstring ucstr = CI18N::get((*itpc).Text);
							vector<ucstring> vucstr;
							ucstring sep("\n");
							splitUCString(ucstr,sep,vucstr);

							// Letter size
							UTextContext::CStringInfo si = TextContext->getStringInfo(ucstring("|"));
							uint fontHeight = (uint) si.StringHeight + 2; // we add 2 pixels for the gap

							uint i;
							float newy = y;
							for( i=0; i<vucstr.size(); ++i )
							{
								TextContext->printAt(x,newy, vucstr[i]);
								newy = nextLine(fontHeight, Driver->getWindowHeight(), newy);
							}
						}
					}
				}
			}
		}

		if (stereoHMD)
		{
			StereoDisplay->endRenderTarget();
		}
	} /* stereo loop */

	if (stereoHMD)
	{
		MainCam.setPos(oldPos);
		MainCam.setRotQuat(oldQuat);
	}

	// Clamp
	clamp (value, 0.f, 1.f);

	// Set matrix
	Driver->setMatrixMode2D11 ();

	// want to receive the 'mouse down' event to deal with the 'cancel tp button'
	Driver->EventServer.addListener(EventMouseDownId,	this);

	// Update messages
	CInputHandlerManager::getInstance()->pumpEventsNoIM();

	Driver->EventServer.removeListener(EventMouseDownId,	this);

	// Exit ?
	bool activeDriver =  Driver->isActive();
	if ((UseEscapeDuringLoading && Driver->AsyncListener.isKeyPushed (KeyESCAPE)) || !activeDriver)
	{
		// Release the application
		releaseMainLoop(true);
		release();
		// Leave the application
		extern void quitCrashReport ();
		quitCrashReport ();
		exit(EXIT_SUCCESS);
	}

	if(!_TPCancelText.empty() &&  Driver->AsyncListener.isKeyPushed(KeySHIFT) && Driver->AsyncListener.isKeyPushed(KeyESCAPE))
	{
		_TPCancelFlag = true;
	}


	CBGDownloaderAccess::getInstance().update();
	// Display to screen.
	Driver->swapBuffers();

	// \todo GUIGUI : Remove this when possible.
	NetMngr.update();
	IngameDbMngr.flushObserverCalls();
	NLGUI::CDBManager::getInstance()->flushObserverCalls();

	// update system dependent progress bar
	static uint previousValue = 0;
	uint currentValue = (uint)(value*100.0f);

	if (currentValue != previousValue)
	{
		CSystemUtils::updateProgressBar(currentValue, 100);
		previousValue = currentValue;
	}
}