Exemple #1
0
void ResourceLoader::Queue(ResourceType type, const std::wstring& filename, const std::string& name, U32 subType)
{
	// TEMP 
	// Will do the real multithreaded thing once shit actually works 
	
	static AssetLocator assLocator;

	switch (type)
	{
	case FONT:
	{
		static std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> converterWtoA;
		auto filenameA = converterWtoA.to_bytes(filename);

		Font font;
		font.LoadFromFile((assLocator.GetAssetDirectoryA(AssetType::FONTS) + filenameA).c_str());
		m_pResourceRegistry->AddResource(name, dynamic_cast<Renderer*>(m_pRenderer)->CacheFont(font));
		break;
	}
	case SHADER:
	{
		m_pResourceRegistry->AddResource(name, m_pRenderer->CacheShader(static_cast<ShaderType>(subType), assLocator.GetAssetDirectory(AssetType::SHADERS) + filename));
		break;
	}
	}
}
Exemple #2
0
void proc_cohort(int& pos,
		 bool& first_err,
		 const Cohort& c,
		 std::ostringstream& text,
		 std::ostream& os,
		 const hfst::HfstTransducer& t,
		 const msgmap& msgs,
		 std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>& utf16conv)
{
	if(cohort_empty(c)) {
		return;
	}
	std::string wfs = utf16conv.to_bytes(c.form);
	if(!c.err.empty()) {
		if(!first_err) {
			os << ",";
		}
		first_err = false;
		os << cohort_errs_json(c, pos, t, msgs);
	}
	pos += c.form.size();
	text << wfs;
	// TODO: wrapper for pos-increasing and text-adding, since they should always happen together
}
Exemple #3
0
void pal::to_stdstring(const pal::char_t* str, std::string* out)
{
    out->assign(g_converter.to_bytes(str));
}
Exemple #4
0
std::string pal::to_stdstring(const string_t& str)
{
    return g_converter.to_bytes(str);
}
Exemple #5
0
std::string Narrow( const std::wstring& wstr )
{
	static std::wstring_convert< std::codecvt_utf8< wchar_t >, wchar_t > converter;
	return converter.to_bytes( wstr );
}