MoonStorm's picture

OpenTk is not firing events for all the keys under Android

I've only tried the hardware buttons so far. The menu key is reported as the Win key (!?), plus the back button and the middle select button is not firing at all. The OpenTk Android sample relies on the ESC key being pressed, which I suspect should probably be mapped to the back key, but currently it doesn't work, so you'd have to kill the application. Does anyone knows anything about this problem?


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

The win/menu key issue is a bug that has been fixed in the develop branch.

There is currently no way to exit the application. We need to add support for the SDL_APP_* events first.

Edit: the android and iOS ports are currently in development. Be advised that there will likely be breaking changes before they are released as part of OpenTK 1.2.

While you can use SDL2 on smartphones, I would advise against that. OpenTK already has native android and iOS backends that will be merged in the near future.

MoonStorm's picture

Do you mean the "android" branch, which I'm currently tracking? Or the "develop" branch, which I don't see how I can use for Androids.

So let me get things clear here. Currently there is a Xamarin.OpenTk 1.0 which is not OpenTk. Second we've got this one, currently at version 1.1, which I was under the impression it already works with Android devices with the help of SDL. You're saying it's not advisable to use SDL on smartphones. So what exactly is the recommendation to use at present, if I'm after cross-platform compatibility?

I know there are efforts to integrate the Xamarin-OpenTk branches, but for me personally that is not important. I would definitely not want to be dependent on a company that has a vision of doing everything but lacks in resources, so it's taking as many shortcuts as possible, as I've already experienced first-hand countless times in the past. I'm grateful they've brought a beautiful language on smartphones, but that is the whole extension of my gratitude.

Edit: I just checked the "develop" branch. Project Source/OpenTK/OpenTK.Android.csproj has missing/renamed files.

the Fiddler's picture

The "android" branch contains a WIP implementation of an Android support for OpenTK. There are two Android backends: SDL2 and native. The SDL2 backend is already working well enough for testing. The native backend was implemented by Xamarin and will be merged in the near future.

Once the "android" branch is complete and tested, it will be merged into "develop" and will be part of the next OpenTK release.

You are welcome to test and contribute to the android branch, just keep in mind this is a WIP that is not ready for production yet. Right now, the only stable Android port comes from Xamarin, and can be found in, under the "rodo-consolidate-opentk" branch.

MoonStorm's picture

Thanks for clearing that up.

Will keep an eye on the android branch, test it a bit more and contribute when I find myself knowledgable enough to do so. Keep up the good work.