feat(new_editor): wire project, inspector, and viewport runtime
This commit is contained in:
@@ -7,6 +7,38 @@
|
||||
|
||||
namespace XCEngine::UI::Editor::App::Internal {
|
||||
|
||||
inline std::wstring Utf8ToWide(std::string_view text) {
|
||||
if (text.empty()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const int requiredChars = MultiByteToWideChar(
|
||||
CP_UTF8,
|
||||
0,
|
||||
text.data(),
|
||||
static_cast<int>(text.size()),
|
||||
nullptr,
|
||||
0);
|
||||
if (requiredChars <= 0) {
|
||||
return {};
|
||||
}
|
||||
|
||||
std::wstring wide(static_cast<std::size_t>(requiredChars), L'\0');
|
||||
const int convertedChars = MultiByteToWideChar(
|
||||
CP_UTF8,
|
||||
0,
|
||||
text.data(),
|
||||
static_cast<int>(text.size()),
|
||||
wide.data(),
|
||||
requiredChars);
|
||||
if (convertedChars <= 0) {
|
||||
return {};
|
||||
}
|
||||
|
||||
wide.resize(static_cast<std::size_t>(convertedChars));
|
||||
return wide;
|
||||
}
|
||||
|
||||
inline std::string WideToUtf8(std::wstring_view text) {
|
||||
if (text.empty()) {
|
||||
return {};
|
||||
|
||||
Reference in New Issue
Block a user