Open mardy opened 9 months ago
I've been quiet on this, because even before starting working on the implemenation, it occurred to me that there are some quite fundamental issues which I hadn't thought about. While the above suggestion would probably work well on the graphics part, the audio and input parts are yet to be solved.
In the above proposal, the VK would work as a plugin of the main application, which would continue iterating its event loop. This means it would also continue to get input events such as from joysticks and mouse, which would either disrupt the VK functionality, or the app's. We need to figure out a way to make it so that while the VK is active, it should get exclusive input access.
The other issue is about sound, should we want the VK to emit sounds when it's operated: if the application has an audio stream open, we cannot just dump our audio data into it (assuming that it's even possible). Since libaesnd (used by our SDL backend) supports up to 32 sound stream, we should probably use another one, and then the problem arises, on whether we should use the libaesnd API directly, or somehow use the SDL API again (we could expose more sound channels as additional devices, and have the VK use the first available one). It would be nicer if we used the SDL API, because then our VK could be made usable in other applications, not specific to the Wii.
I'm still studying how to overcome these issues.
The WIi and GameCube port of SDL 2 does not offer a virtual keyboard.
I'm opening this issue to propose a solution and reach at least some vague consensus before rushing to implementing something that might not get accepted.
In bullet points:
In light of the above, I would suggest this solution:
OgcVkFunctions
for the time being.In the SDL OGC video module, we implement the SDL VK internal APIs by simply checking if the application registered a VK backend: if it does, we call the corresponding function. Something like:
const OgcVkFunctions *ogc_sdl_get_vk_functions()
that returns a pointer to the OgcVkFunctions structure.somewhere in its initialization code (or even later).
This solution has the benefit that applications who don't need a virtual keyboard will basically not have to pay for it, in term of resources. Applications who just need a basic keyboard can have it by just adding a line of code (which can easily be
#ifdef
'd out when building for other platforms), and applications who need more advanced or customized keyboards can pass their ownOgcVkFunctions
structure and have full control over the VK keyboard.