void GUIDemoComponent::update()
{
	//fps output test
	 std::wstringstream wss(std::wstringstream::in|std::wstringstream::out);
	 wss <<  std::fixed << std::setprecision(2) << GameEngine::FPS();
	 wss << L" fps";
	 wstring out = wss.str();
	 GUIEventData::sendToGUI( new GUIEventData(I_LABEL_TEXT,L"label2",(wchar_t*)out.c_str()));

	 count += 1.0f/GameEngine::FPS();
	
	 if (count >= 1.0f) {
		 count_sec++;
		 count = 0.0f;

		 std::wstringstream wss(std::wstringstream::in|std::wstringstream::out);
		 out.clear();

		 wss << L"  running time: " << count_sec << L" s";
		 out = wss.str();
		 GUIEventData::sendToGUI( new GUIEventData(I_LABEL_TEXT,L"frame1",(wchar_t*)out.c_str()));
		 
		 if (!loadedOtherXML)
		 GUIEventData::sendToGUI( new GUIEventData(I_PROGRESSBAR_PROGRESS,L"progressbar1",(float)(count_sec%101)));
	 }
}
	void screenshot(const string& name)
	{
#ifndef WINSTORE_SUPPORT
		CreateDirectoryA("screenshots", 0);
		time_t t = std::time(nullptr);
		struct tm time_info;
		localtime_s(&time_info, &t);
		stringstream ss("");
		if (name.length() <= 0)
			ss << "screenshots/sc_" << std::put_time(&time_info, "%d-%m-%Y %H-%M-%S") << ".png";
		else
			ss << name;
		wstringstream wss(L"");
		wss << ss.str().c_str();
		ID3D11Resource* res = nullptr;
		wiRenderer::renderTargetView->GetResource(&res);
		HRESULT h = SaveWICTextureToFile(wiRenderer::immediateContext, res, GUID_ContainerFormatPng, wss.str().c_str());
		if (FAILED(h))
			wiBackLog::post("Screenshot failed");
		else
		{
			ss << " Saved successfully!";
			wiBackLog::post(ss.str().c_str());
		}
		res->Release();
#endif
	}
	static std::wstring Utf8ToWString(const char *s) {
		auto *ws = (WCHAR*)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", (char *)(s), SDL_strlen(s)+1);
		if(!ws) return L"";
		std::wstring wss(ws);
		SDL_free(ws);
		return wss;
	}
Beispiel #4
0
T FromString (String const & str)
{
	std::wstringstream wss (str);
	T ret;
	wss >> ret;
	return ret;
}
Beispiel #5
0
static void parse_arg( const std::wstring & _str, TVectorPoints & _value )
{
	std::vector<std::wstring> tokens;

	std::wstringstream wss( _str );

	std::wstring buf;
	while( wss >> buf )
	{
		tokens.push_back( buf );
	}

	uint32_t count;
	swscanf( tokens[0].c_str(), L"%u", &count );

	for( uint32_t i = 0; i != count; ++i )
	{
		double value_x;
		swscanf( tokens[1 + i * 2 + 0].c_str(), L"%lf", &value_x );

		double value_y;
		swscanf( tokens[1 + i * 2 + 1].c_str(), L"%lf", &value_y );

		_value.push_back( vec2f( value_x, value_x ) );
	}
}
void WriteState::process(OutputContext& output)
{
	idx state_count=ev3LineTracer.getStateCount();
	WriteSingleState wss(ev3LineTracer,0);

	for(idx i=0;i<state_count;i++)
	{
		wss.setStateIndex(i);
		wss.process(output);
	}
}
			template<> static std::wstring ToString<Frost::Vect3>(const Frost::Vect3& v)
			{
				std::wstringstream wss(L"");
				wss << L"[" << v._x << L", " << v._y << ", " << v._z << "]";
				return wss.str();
			}