Skip to content
Snippets Groups Projects
Commit c04f392e authored by Matyáš Latner's avatar Matyáš Latner
Browse files

Merge branch 'fix-3.0.1' into devel

parents 7adc7d3b 1ad52357
Branches
Tags
No related merge requests found
......@@ -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();
......
......@@ -2,6 +2,7 @@ package cz.nic.tablexia.loader;
public interface IApplicationLoader {
public boolean update();
boolean update();
void dispose();
}
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
......@@ -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;
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment