Artenuvielle / GW2-SCT

A scrolling combat text addon for GW2 using ArcDPS API
MIT License
61 stars 10 forks source link

Input character bug #24

Closed jiangyi0923 closed 2 years ago

jiangyi0923 commented 3 years ago

Hello, I found a character input bug, No response when entering Chinese, Here's my solution:

#include "imgui/imgui_impl_win32.h"
HWND hwnd = nullptr;
    void* get_init_addr(char* arcversionstr, void* imguicontext, IDirect3DDevice9* id3dd9)
    {
        ImGui::SetCurrentContext((ImGuiContext*)imguicontext);
        ImGui_ImplWin32_Init(hwnd);
    }
    uintptr_t mod_wnd(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
    {
        hwnd = hWnd;
                 ....
                case WM_CHAR:
        if (wParam > 0 && wParam < 0x10000)
            io->AddInputCharacter((unsigned short)wParam);
        return 0;
Artenuvielle commented 3 years ago

Can you provide an example of how to input chinese symbols for me to reproduce this issue? Also when testing your suggested code all normal characters are registered twice by imgui's io.

jiangyi0923 commented 3 years ago

Sorry, should use io->AddInputCharacterUTF16((unsigned short)wParam); I just found out about this bug a few days ago, You can check out the plug-in code I wrote at https://github.com/jiangyi0923/d3d9_arcdps_sytool d3d9_arcdps_sytool/pch.cpp If you compile this plugin directly, it will be a Chinese version. You will need to put a Chinese font file in the addons/arcdps folder called arcdps_font.ttf

jiangyi0923 commented 3 years ago

You can copy and paste "草" this Chinese character to try

Artenuvielle commented 2 years ago

Issue should be resolved after switching to the custom font renderer.