31 System.loadLibrary("SDL_net"); |
31 System.loadLibrary("SDL_net"); |
32 System.setProperty("jna.encoding", "UTF8"); // Ugly global setting, but it seems JNA doesn't allow setting this per-library... |
32 System.setProperty("jna.encoding", "UTF8"); // Ugly global setting, but it seems JNA doesn't allow setting this per-library... |
33 } |
33 } |
34 public static final Frontlib INSTANCE = (Frontlib)Native.loadLibrary("frontlib", Frontlib.class, Collections.singletonMap(Library.OPTION_TYPE_MAPPER, AndroidTypeMapper.INSTANCE)); |
34 public static final Frontlib INSTANCE = (Frontlib)Native.loadLibrary("frontlib", Frontlib.class, Collections.singletonMap(Library.OPTION_TYPE_MAPPER, AndroidTypeMapper.INSTANCE)); |
35 |
35 |
|
36 static { |
|
37 // We'll just do it here and never quit it again... |
|
38 if(Flib.INSTANCE.flib_init() != 0) { |
|
39 throw new RuntimeException("Unable to initialize frontlib"); |
|
40 } |
|
41 } |
|
42 |
36 // Hook frontlib logging into Android logging |
43 // Hook frontlib logging into Android logging |
37 private static final Frontlib.LogCallback logCb = new Frontlib.LogCallback() { |
44 private static final Frontlib.LogCallback logCb = new Frontlib.LogCallback() { |
38 public void callback(int level, String message) { |
45 public void callback(int level, String message) { |
39 if(level >= Frontlib.FLIB_LOGLEVEL_ERROR) { |
46 if(level >= Frontlib.FLIB_LOGLEVEL_ERROR) { |
40 Log.e("Frontlib", message); |
47 Log.e("Frontlib", message); |