diff --git a/core/src/cz/nic/tablexia/Tablexia.java b/core/src/cz/nic/tablexia/Tablexia.java index bf853f5bde02650d7b6117f28158bb074520b9d2..2390005081d0822f7b48be32cedc4ceaf18f1a7d 100644 --- a/core/src/cz/nic/tablexia/Tablexia.java +++ b/core/src/cz/nic/tablexia/Tablexia.java @@ -133,11 +133,13 @@ public class Tablexia extends TablexiaApplication { } private void startLoading(Locale locale) { + // Prepare fonts (Fonts need to be loaded before any screen is active) + ApplicationFontManager.getInstance().load(); + // sync loaded screen with loader image setScreen(Utility.getScreenForScreenClass(TablexiaSettings.LOADER_SCREEN, null)); // async internal assets loading - ApplicationFontManager.getInstance().load(); ApplicationTextManager.getInstance().load(locale); ApplicationInternalSoundManager.getInstance().load(); ApplicationInternalTextureManager.getInstance().load(); diff --git a/core/src/cz/nic/tablexia/loader/IApplicationLoader.java b/core/src/cz/nic/tablexia/loader/IApplicationLoader.java index bdb2faa1f27253e02c6e1c04611652e5364cc89a..796809a9390d7256f1288eb8577382c545d28168 100644 --- a/core/src/cz/nic/tablexia/loader/IApplicationLoader.java +++ b/core/src/cz/nic/tablexia/loader/IApplicationLoader.java @@ -2,6 +2,7 @@ package cz.nic.tablexia.loader; public interface IApplicationLoader { - public boolean update(); + boolean update(); + void dispose(); } diff --git a/core/src/cz/nic/tablexia/loader/application/ApplicationFontManager.java b/core/src/cz/nic/tablexia/loader/application/ApplicationFontManager.java index c26bb00b0403a68334672c602c5f22d6351298fb..50372d530ffe97c93b62763bccc6b3ffef0f0b87 100644 --- a/core/src/cz/nic/tablexia/loader/application/ApplicationFontManager.java +++ b/core/src/cz/nic/tablexia/loader/application/ApplicationFontManager.java @@ -1,7 +1,6 @@ package cz.nic.tablexia.loader.application; import com.badlogic.gdx.Gdx; -import com.badlogic.gdx.assets.AssetManager; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.DistanceFieldFont; import com.badlogic.gdx.graphics.g2d.TextureRegion; @@ -15,7 +14,8 @@ import cz.nic.tablexia.loader.IApplicationLoader; * @author Matyáš Latner * */ -public class ApplicationFontManager extends AssetManager implements IApplicationLoader { +public class ApplicationFontManager implements IApplicationLoader { + public enum FontType_NEW { REGULAR_10 (10, false), REGULAR_12 (12, false), @@ -103,14 +103,16 @@ public class ApplicationFontManager extends AssetManager implements IApplication } return instance; } - - @Override - public synchronized void dispose() { - super.dispose(); - instance = null; + + public ShaderProgram getDistanceFieldShader() { + return distanceFieldShader; } - private void loadSDFFont() { + public DistanceFieldFont getDistanceFieldFont(FontType_NEW fontType) { + return fontType.isBold() ? robotoBoldFont : robotoRegularFont; + } + + public void load() { Texture robotoRegular = new Texture(Gdx.files.internal(ROBOTO_REGULAR_FONT_FILE + FONT_BITMAP_EXTENSION), true); robotoRegular.setFilter(Texture.TextureFilter.MipMapLinearNearest, Texture.TextureFilter.MipMapLinearNearest); robotoRegularFont = new DistanceFieldFont(Gdx.files.internal(ROBOTO_REGULAR_FONT_FILE + FONT_FILE_EXTENSION), new TextureRegion(robotoRegular)); @@ -130,15 +132,16 @@ public class ApplicationFontManager extends AssetManager implements IApplication // distanceFieldShader.pedantic = false; } - public ShaderProgram getDistanceFieldShader() { - return distanceFieldShader; - } - public DistanceFieldFont getDistanceFieldFont(FontType_NEW fontType) { - return fontType.isBold() ? robotoBoldFont : robotoRegularFont; +//////////////////////////// IApplicationLoader + + @Override + public boolean update() { + return true; } - - public void load() { - loadSDFFont(); + + @Override + public synchronized void dispose() { + instance = null; } } \ No newline at end of file diff --git a/ios/src/cz/nic/tablexia/IOSLauncher.java b/ios/src/cz/nic/tablexia/IOSLauncher.java index 70fd0dd40d729cd74469e3db5020986fa5fa3eba..145799b120e8836ca3d08100a96836dab3e4fcd8 100644 --- a/ios/src/cz/nic/tablexia/IOSLauncher.java +++ b/ios/src/cz/nic/tablexia/IOSLauncher.java @@ -72,7 +72,13 @@ public class IOSLauncher extends IOSApplication.Delegate { private static class IOSConnectionManager implements IConnectionManager { @Override public boolean isUsingMobileData() { - SCNetworkReachabilityFlags flags = SCNetworkReachability.create(new InetSocketAddress(CONNECTION_CHECK_HOST, CONNECTION_CHECK_PORT)).getFlags(); + InetSocketAddress socketAddress = new InetSocketAddress(CONNECTION_CHECK_HOST, CONNECTION_CHECK_PORT); + // RoboVM tries to retrive IP address using network connection. If we don't have it InetSocketAddress.getAddress() returns null + // in that case SCNetworkReachability.create(socketAddress) throws IllegalArgumentException + if (socketAddress.getAddress() == null) { + return false; + } + SCNetworkReachabilityFlags flags = SCNetworkReachability.create(socketAddress).getFlags(); return flags.compareTo(SCNetworkReachabilityFlags.IsWWAN) == 1; } }