Fix weird font issue on progress bar

Prevent Forge not being able to reopen if its already running
This commit is contained in:
drdev
2014-05-31 19:26:22 +00:00
parent 26bb62f027
commit 1986ab8769
4 changed files with 12 additions and 8 deletions

View File

@@ -35,6 +35,6 @@ public class Main extends AndroidApplication {
return;
}
initialize(new Forge(getClipboard(), assetsDir), true);
initialize(Forge.getApp(getClipboard(), assetsDir), true);
}
}

View File

@@ -8,6 +8,6 @@ import forge.util.Utils;
public class Main {
public static void main(String[] args) {
new LwjglApplication(new Forge(new LwjglClipboard(), "../forge-gui/"), "Forge", (int)Utils.BASE_WIDTH, (int)Utils.BASE_HEIGHT, true);
new LwjglApplication(Forge.getApp(new LwjglClipboard(), "../forge-gui/"), "Forge", (int)Utils.BASE_WIDTH, (int)Utils.BASE_HEIGHT, true);
}
}

View File

@@ -49,6 +49,7 @@ import forge.util.Utils;
public class Forge implements ApplicationListener {
public static final String CURRENT_VERSION = "1.5.19.005";
private static final ApplicationListener app = new Forge();
private static Clipboard clipboard;
private static int screenWidth;
private static int screenHeight;
@@ -59,13 +60,16 @@ public class Forge implements ApplicationListener {
private static KeyInputAdapter keyInputAdapter;
private static final Stack<FScreen> screens = new Stack<FScreen>();
public Forge(Clipboard clipboard0, String assetDir0) {
if (GuiBase.getInterface() != null) {
throw new RuntimeException("Cannot initialize Forge more than once");
}
public static ApplicationListener getApp(Clipboard clipboard0, String assetDir0) {
if (GuiBase.getInterface() == null) {
clipboard = clipboard0;
GuiBase.setInterface(new GuiMobile(assetDir0));
}
return app;
}
private Forge() {
}
@Override
public void create() {

View File

@@ -151,7 +151,7 @@ public class FProgressBar extends FDisplayObject implements IProgressBar {
else {
g.fillRect(BACK_COLOR, 0, 0, w, h);
float selWidth = w * (float)value / (float)maximum;
float selWidth = Math.round(w * (float)value / (float)maximum);
if (selWidth > 0) {
g.fillRect(SEL_BACK_COLOR, 0, 0, selWidth, h);
selTextRegions.add(Pair.of(0f, selWidth));