This might be a special case… I have a chromebook which I installed Linux on (GalliumOS). It does not have a touchscreen (but some do).
My code works fine on Windows (OpenGL) and Android, but fails to run on the chromebook with the following exception:
at (wrapper managed-to-native) Microsoft.Xna.Framework.Input.Touch.TouchPanelCapabilities:GetSystemMetrics (int)
at Microsoft.Xna.Framework.Input.Touch.TouchPanelCapabilities.Initialize () <0x41a720d0 + 0x00027> in :0
at Microsoft.Xna.Framework.Input.Touch.TouchPanelState.GetCapabilities () <0x41a72050 + 0x00023> in :0
at Microsoft.Xna.Framework.Input.Touch.TouchPanel.GetCapabilities () <0x41a72000 + 0x00023> in :0
at MyGame._mouseUpdate (Microsoft.Xna.Framework.GameTime gameTime) <0x41a71950 + 0x00097> in :0
I have Mono 4.4.2 installed.
If I comment out the code which checks for / uses touchscreen, then the game runs fine on the chromebook.
Any suggestions on how I can solve this?
It would be great to support both touch and mouse input on these hybrid platforms, since I suspect there will be a lot more of them in the near future.
What MG binary are you using? The code you reference here is only compiled for WINDOWS, so it shouldn’t be run for a linux machine if you’re using the right MonoGame.Framework.dll. That said, if you check out the TouchPanelCapabilities class, you’ll see
//Touch isn’t implemented in OpenTK, so no linux or mac https://github.com/opentk/opentk/issues/80
isConnected = false;
so this didn’t get fixed after the switch to OpenGL yet and won’t work right now
Thanks for the response. I am using a dev release of MG (can’t remember which specific build)… but it’s from about a month back. I will try a newer build.
I am also a little confused… how should I go about running my game on Linux and OSX? I created an OpenGL game that’s supposed to be usable for Windows, Linux and OSX.
From what I read, I should just be able to install Mono on Linux and OSX and run “mono <mygame.exe>” and it should work as well. Am I missing something?
However, that’s not the results I get… when I try running the same game on Linux or OSX, I get the same exception above (although on OSX it specifically mentions something about user32.dll not being found).
That said… I understand that touch might not be supported on those platforms, however, since isConnected is set to false for them, my code should just be able to run without throwing an exception… since it’s designed to work with either mouse or touch. The code works fine on Windows, and I don’t have any touch panel there either.
@dellis1972 Shouldn’t all DesktopGL projects have the same defines? I know Linux and WindowsGL should be merged so I think they should. But currently WindowsGL defines
Windows and Linux defines
Linux meaning the binaries will differ based on where they are built. Can you confirm this? Seems like the issue here is that Windows specific code is used on Mac/Linux too.