Added love.system.openURL (resolves issue #863)

This commit is contained in:
Alex Szpakowski
2014-03-31 16:13:05 -03:00
parent c985b1f2f7
commit 38497d23da
7 changed files with 132 additions and 4 deletions
Regular → Executable
+21
View File
@@ -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
View File
@@ -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.