Skip to content

GWT Notes

WingEraser edited this page Feb 20, 2014 · 2 revisions

###Reflection In order to use Reflection in GWT in you’ll need to use Reflection API from libgdx: https://github.com/libgdx/libgdx/wiki/Reflection

If you include too many classes that needs to be reflected, you’ll possibly encounter these errors:

[ERROR] Line 59431: The code of method get(Field, Object) is exceeding the 65535 bytes limit
[ERROR] Errors in 'com/badlogic/gwtref/client/ReflectionCache.java'
	[ERROR] Line 24: Rebind result 'com.badlogic.gwtref.client.IReflectionCacheGenerated' could not be found

This means that the IReflectionCacheGenerated got too big. The way the Reflection API works is it builds a giant class with all the metadata for the reflected classes. Ideal is to avoid using reflection when possible. Here are some tips:

#####Plugin When you add a plugin use this method:

YourPlugin plugin = FlxG.addPlugin(new YourPlugin());

If you want to remove the plugin:

FlxG.removePlugin(plugin);

#####Reset state Only the first state is required by FlxGame and is needs to be included in the reflection. The rest of the states are not needed. However FlxG.resetState() will reset the current state and it uses reflection. This can be avoided by using FlxG.switchState(new State()).

#####Core Classes Some classes from the core are not included in the flixel_html5.gwt.xml, because it’s rarely seen in used with reflection. If you need them in your project, include the classes in your main project’s gwt.xml file.

###Limitations #####Bitmap font There is no support of native libraries. One of them is Freetype font generator.

#####Browsers It runs in Firefox, Safari, Chrome, Opera, mobile browser with WebGL support. Internet Explorer 11 is not supported.