mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Added love.system.openURL (resolves issue #863)
This commit is contained in:
Regular → Executable
+21
@@ -45,6 +45,27 @@ std::string to_utf8(LPCWSTR wstr)
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::wstring to_widestr(const std::string &str)
|
||||
{
|
||||
if (str.empty())
|
||||
return std::wstring();
|
||||
|
||||
int wide_size = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), (int) str.length(), nullptr, 0);
|
||||
|
||||
if (wide_size == 0)
|
||||
return std::wstring();
|
||||
|
||||
std::wstring widestr;
|
||||
widestr.resize(wide_size);
|
||||
|
||||
int ok = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), (int) str.length(), &widestr[0], widestr.length());
|
||||
|
||||
if (!ok)
|
||||
return std::wstring();
|
||||
|
||||
return widestr;
|
||||
}
|
||||
|
||||
void replace_char(std::string &str, char find, char replace)
|
||||
{
|
||||
int length = str.length();
|
||||
|
||||
Regular → Executable
+7
@@ -35,6 +35,13 @@ namespace love
|
||||
**/
|
||||
std::string to_utf8(LPCWSTR wstr);
|
||||
|
||||
/**
|
||||
* Convert a UTF-8 encoded string to a wide string.
|
||||
* @param str The UTF-8 string.
|
||||
* @return A wide string.
|
||||
**/
|
||||
std::wstring to_widestr(const std::string &str);
|
||||
|
||||
/**
|
||||
* Replace all occurences of 'find' with 'replace' in a string.
|
||||
* @param str The string to modify.
|
||||
|
||||
Reference in New Issue
Block a user