subsoap / defos

Extra native OS functions for games written using the Defold game engine
Creative Commons Zero v1.0 Universal
112 stars 16 forks source link

Changing the window title #126

Open e1e5en-gd opened 2 years ago

e1e5en-gd commented 2 years ago

When changing the window title (function defos.set_window_title) using Cyrillic, as a result, we get incorrect characters. Sample project: title_window_issue.zip Screenshot: image

An example fix in the Defold engine: link.

britzl commented 2 years ago

Strange, I would have thought that CA2W which is used in DefOS would work out of the box:

https://github.com/subsoap/defos/blob/master/defos/src/defos_win.cpp#L251

What you can try is like you suggested and instead use MultiByteToWideChar, like we do in Defold.

subsoap commented 2 years ago

As discussed on #127 and in Discord there is still a problem somehow so reopening.

e1e5en-gd commented 2 years ago

I'll add a message from Discord: If you do not pay attention to character transformations, then the task of the value in the window title occurs with errors:

    SetWindowTextW(dmGraphics::GetNativeWindowsHWND(), (LPCWSTR)L"我使用 - Defos - Привет, мир!");
    MessageBoxW(
        dmGraphics::GetNativeWindowsHWND(),
        (LPCWSTR)L"我使用 - Defos - Привет, мир!",
        (LPCWSTR)L"出去 - Out - Вывод",
        MB_ICONINFORMATION | MB_OK | MB_DEFBUTTON1
    );

image