I'm pretty comfortable with LibGDX aimed at a desktop deployment and I'm trying to extend into the HTML5 cross-compilation deployments that it makes possible.
Is there any way I can pass data from a HTML form or Javascript running on the same page into the LibGDX app when deployed to HTML5? I want to have a form sat next to the canvas, which on submission passes data into the app. Or any other method of using the HTML page as a UI to pass data in?
I personally don't know much about the topic myself but the question is quite interesting and I think I managed to get somewhere with some digging around. What I'm suggesting might not be the best way to do it so take it with a pinch of salt.
From what I've read, I think the best way forward is to use the GWT JNSI to put native javascript within your HtmlLauncher.java
file which should be found somewhere in your html/src
sub-directory.
Examples of how to structure the native functions include the libGDX
backends themselves and another link I found online:
The second example is an actual game which defines javascript to be called on the HTML5 platform when necessary. By following these examples it shouldn't be too hard to make a function like getData
which queries the DOM for your data and returns it to the game. Hopefully this helps somewhat.