Fix so UI updated immediately when match started remotely

This commit is contained in:
drdev
2015-06-13 18:43:18 +00:00
parent cbba19935a
commit 9198fb6b29
4 changed files with 16 additions and 4 deletions

View File

@@ -67,6 +67,11 @@ public class GuiDesktop implements IGuiBase {
"../forge-gui/" : "";
}
@Override
public void invokeInEdtNow(final Runnable proc) {
proc.run();
}
@Override
public void invokeInEdtLater(final Runnable proc) {
SwingUtilities.invokeLater(proc);

View File

@@ -64,6 +64,12 @@ public class GuiMobile implements IGuiBase {
return assetsDir;
}
@Override
public void invokeInEdtNow(final Runnable proc) {
proc.run();
Gdx.graphics.requestRendering(); //must request rendering in case this procedure wasn't triggered by a local event
}
@Override
public void invokeInEdtLater(final Runnable proc) {
Gdx.app.postRunnable(proc);

View File

@@ -21,16 +21,16 @@ public class FThreads {
}
}
public static void invokeInEdtLater(final Runnable runnable) {
GuiBase.getInterface().invokeInEdtLater(runnable);
public static void invokeInEdtLater(final Runnable proc) {
GuiBase.getInterface().invokeInEdtLater(proc);
}
public static void invokeInEdtNowOrLater(final Runnable proc) {
if (isGuiThread()) {
proc.run();
GuiBase.getInterface().invokeInEdtNow(proc);
}
else {
invokeInEdtLater(proc);
GuiBase.getInterface().invokeInEdtLater(proc);
}
}

View File

@@ -21,6 +21,7 @@ public interface IGuiBase {
boolean isRunningOnDesktop();
String getCurrentVersion();
String getAssetsDir();
void invokeInEdtNow(Runnable runnable);
void invokeInEdtLater(Runnable runnable);
void invokeInEdtAndWait(Runnable proc);
boolean isGuiThread();