How to connect with input method to obtain Chinese input

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
suibiankan123
Prole
Posts: 1
Joined: Tue Aug 11, 2020 2:10 am

How to connect with input method to obtain Chinese input

Post by suibiankan123 »

I want to make a Chinese input box, but I don't know how to use input method to get Chinese input
love2d如何获取输入法输入的结果
thanks!
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

Re: How to connect with input method to obtain Chinese input

Post by ReFreezed »

To get text input you use love.textedited for text currently being inputted (but not yet committed), and love.textinput for the final/committed text input.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
Alligrater
Prole
Posts: 2
Joined: Wed Aug 19, 2020 4:13 am

Re: How to connect with input method to obtain Chinese input

Post by Alligrater »

没办法直接获取,但是2018年的时候某位仁兄找到了解决方案,通过重编译SDL2可以让输入法备选框显示出来
具体办法是先下载SDL的开发包,然后找到SDL_windowskeyboard.c
修改IME_Init()函数里的videodata->ime_uilesss = UILess_SetupSinks(videodata);
把这段代码注释掉,然后手动编译一份DLL

最后把love目录下的dll替换成编译好的文件。这里我已经准备了一份,可以给11.3用。
如果需要编译其他版本的,可能需要先找到能够适配当时的love的sdl才能重新编译?这一块需要证实。
Attachments
SDL2.zip
(395.53 KiB) Downloaded 236 times
Kunologist
Prole
Posts: 6
Joined: Fri Mar 20, 2020 9:21 am

Re: How to connect with input method to obtain Chinese input

Post by Kunologist »

Thanks for sharing! The

Code: Select all

SDL2.dll
works well.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 1 guest