| 2387 | } |
| 2388 | |
| 2389 | void DrawGameOptionsMenu() |
| 2390 | { |
| 2391 | ImGui::Spacing(); |
| 2392 | |
| 2393 | ImGuiInputTextFlags flags = ImGuiInputTextFlags_CallbackEdit | ImGuiInputTextFlags_CallbackCharFilter; |
| 2394 | if ( ImGui::InputText( "Player Name", playerNameBuf, sizeof(playerNameBuf), flags, PlayerNameInputTextCallback ) |
| 2395 | && playerNameBuf[0] != '\0' ) |
| 2396 | { |
| 2397 | char playerNameIso[128] = {}; |
| 2398 | if ( D3_UTF8toISO8859_1( playerNameBuf, playerNameIso, sizeof(playerNameIso), '!' ) != NULL ) { |
| 2399 | playerNameIso[40] = '\0'; // limit to 40 chars, like the original menu |
| 2400 | ui_nameVar->SetString( playerNameIso ); |
| 2401 | // update the playerNameBuf to reflect the name as it is now: limited to 40 chars |
| 2402 | // and possibly containing '!' from non-translatable unicode chars |
| 2403 | D3_ISO8859_1toUTF8( ui_nameVar->GetString(), playerNameBuf, sizeof(playerNameBuf) ); |
| 2404 | } else { |
| 2405 | D3::ImGuiHooks::ShowWarningOverlay( "Player Name way too long (max 40 chars) or contains invalid UTF-8 encoding!" ); |
| 2406 | playerNameBuf[0] = '\0'; |
| 2407 | } |
| 2408 | } |
| 2409 | AddTooltip( "ui_name" ); |
| 2410 | |
| 2411 | DrawOptions( gameOptions, IM_ARRAYSIZE(gameOptions) ); |
| 2412 | } |
| 2413 | |
| 2414 | |
| 2415 | static bool showStyleEditor = false; |
no test coverage detected