diff --git a/assets/plugins/plugin-performance-0.1.5.jar b/assets/plugins/plugin-performance-0.1.5.jar index ee3725be..c5a35dff 100644 Binary files a/assets/plugins/plugin-performance-0.1.5.jar and b/assets/plugins/plugin-performance-0.1.5.jar differ diff --git a/hyperlap2d-runtime-libgdx b/hyperlap2d-runtime-libgdx index 8457a75a..e0312067 160000 --- a/hyperlap2d-runtime-libgdx +++ b/hyperlap2d-runtime-libgdx @@ -1 +1 @@ -Subproject commit 8457a75aab0f574b2ea9a62bcdd871c71b81671a +Subproject commit e0312067e90acf99fb8cbae519aabd0f86fd3234 diff --git a/src/main/java/com/badlogic/gdx/utils/Pools.java b/src/main/java/com/badlogic/gdx/utils/Pools.java deleted file mode 100644 index 28af8944..00000000 --- a/src/main/java/com/badlogic/gdx/utils/Pools.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.badlogic.gdx.utils; - -public class Pools { - static private final ThreadLocal> typePools = new ThreadLocal>() { - protected ObjectMap initialValue () { - return new ObjectMap(); - }; - }; - - /** Returns a new or existing pool for the specified type, stored in a Class to {@link Pool} map. Note the max size is ignored - * if this is not the first time this pool has been requested. */ - static public Pool get (Class type, int max) { - Pool pool = typePools.get().get(type); - if (pool == null) { - pool = new ReflectionPool(type, 4, max); - typePools.get().put(type, pool); - } - return pool; - } - - /** Returns a new or existing pool for the specified type, stored in a Class to {@link Pool} map. The max size of the pool used - * is 100. */ - static public Pool get (Class type) { - return get(type, 100); - } - - /** Sets an existing pool for the specified type, stored in a Class to {@link Pool} map. */ - static public void set (Class type, Pool pool) { - typePools.get().put(type, pool); - } - - /** Obtains an object from the {@link #get(Class) pool}. */ - static public T obtain (Class type) { - return get(type).obtain(); - } - - /** Frees an object from the {@link #get(Class) pool}. */ - static public void free (Object object) { - if (object == null) throw new IllegalArgumentException("object cannot be null."); - Pool pool = typePools.get().get(object.getClass()); - if (pool == null) return; // Ignore freeing an object that was never retained. - pool.free(object); - } - - /** Frees the specified objects from the {@link #get(Class) pool}. Null objects within the array are silently ignored. Objects - * don't need to be from the same pool. */ - static public void freeAll (Array objects) { - freeAll(objects, false); - } - - /** Frees the specified objects from the {@link #get(Class) pool}. Null objects within the array are silently ignored. - * @param samePool If true, objects don't need to be from the same pool but the pool must be looked up for each object. */ - static public void freeAll (Array objects, boolean samePool) { - if (objects == null) throw new IllegalArgumentException("objects cannot be null."); - Pool pool = null; - for (int i = 0, n = objects.size; i < n; i++) { - Object object = objects.get(i); - if (object == null) continue; - if (pool == null) { - pool = typePools.get().get(object.getClass()); - if (pool == null) continue; // Ignore freeing an object that was never retained. - } - pool.free(object); - if (!samePool) pool = null; - } - } - - public static String name() { - return "ThreadSafe Pools"; - } - - private Pools () { - } -} diff --git a/src/main/java/games/rednblack/editor/controller/BootstrapInfoCommand.java b/src/main/java/games/rednblack/editor/controller/BootstrapInfoCommand.java index bcb308e7..24fe49e7 100644 --- a/src/main/java/games/rednblack/editor/controller/BootstrapInfoCommand.java +++ b/src/main/java/games/rednblack/editor/controller/BootstrapInfoCommand.java @@ -2,7 +2,6 @@ package games.rednblack.editor.controller; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.GL20; -import com.badlogic.gdx.utils.Pools; import games.rednblack.editor.utils.AppConfig; import games.rednblack.h2d.common.HyperLog; import games.rednblack.puremvc.commands.SimpleCommand; @@ -22,7 +21,5 @@ public class BootstrapInfoCommand extends SimpleCommand { HyperLog.info("Shaders version " + gl20.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION)); HyperLog.info("JVM Version: " + System.getProperty("java.version") + " (" + System.getProperty("java.vendor") + ")"); - - HyperLog.info(Pools.name()); } } diff --git a/src/main/java/games/rednblack/editor/proxy/ProjectManager.java b/src/main/java/games/rednblack/editor/proxy/ProjectManager.java index 798f80a7..5fc1a82f 100755 --- a/src/main/java/games/rednblack/editor/proxy/ProjectManager.java +++ b/src/main/java/games/rednblack/editor/proxy/ProjectManager.java @@ -250,17 +250,17 @@ public class ProjectManager extends Proxy { FileAlterationListener listener = new FileAlterationListenerAdaptor() { @Override public void onFileCreate(File file) { - facade.sendNotification(MsgAPI.PROJECT_FILE_CREATED, file); + Gdx.app.postRunnable(() -> facade.sendNotification(MsgAPI.PROJECT_FILE_CREATED, file)); } @Override public void onFileDelete(File file) { - facade.sendNotification(MsgAPI.PROJECT_FILE_DELETED, file); + Gdx.app.postRunnable(() -> facade.sendNotification(MsgAPI.PROJECT_FILE_DELETED, file)); } @Override public void onFileChange(File file) { - facade.sendNotification(MsgAPI.PROJECT_FILE_MODIFIED, file); + Gdx.app.postRunnable(() -> facade.sendNotification(MsgAPI.PROJECT_FILE_MODIFIED, file)); } }; observer.addListener(listener); diff --git a/src/main/java/games/rednblack/editor/proxy/ResolutionManager.java b/src/main/java/games/rednblack/editor/proxy/ResolutionManager.java index 9db761c5..d794dd74 100644 --- a/src/main/java/games/rednblack/editor/proxy/ResolutionManager.java +++ b/src/main/java/games/rednblack/editor/proxy/ResolutionManager.java @@ -327,10 +327,10 @@ public class ResolutionManager extends Proxy { public void rePackProjectImagesForAllResolutions(boolean reloadProjectData, RepackCallback callback) { ExecutorService executor = Executors.newSingleThreadExecutor(); executor.execute(() -> { - facade.sendNotification(MsgAPI.SHOW_LOADING_DIALOG); + Gdx.app.postRunnable(() -> facade.sendNotification(MsgAPI.SHOW_LOADING_DIALOG)); try { rePackProjectImagesForAllResolutionsSync(); - facade.sendNotification(MsgAPI.HIDE_LOADING_DIALOG); + Gdx.app.postRunnable(() -> facade.sendNotification(MsgAPI.HIDE_LOADING_DIALOG)); if (callback != null) callback.onRepack(true); } catch (Exception e) { diff --git a/src/main/java/games/rednblack/editor/splash/SplashMediator.java b/src/main/java/games/rednblack/editor/splash/SplashMediator.java index a9a05b74..b3abf773 100644 --- a/src/main/java/games/rednblack/editor/splash/SplashMediator.java +++ b/src/main/java/games/rednblack/editor/splash/SplashMediator.java @@ -76,8 +76,10 @@ public class SplashMediator extends Mediator { e.printStackTrace(); } - splash.loadedData(); - Gdx.app.postRunnable(() -> HyperLap2DApp.getInstance().mainWindow.setVisible(true)); + Gdx.app.postRunnable(() -> { + splash.loadedData(); + HyperLap2DApp.getInstance().mainWindow.setVisible(true); + }); }); executor.shutdown(); } diff --git a/src/main/java/games/rednblack/editor/view/ui/panel/ImportPanelMediator.java b/src/main/java/games/rednblack/editor/view/ui/panel/ImportPanelMediator.java index 2acd21e4..a1018876 100644 --- a/src/main/java/games/rednblack/editor/view/ui/panel/ImportPanelMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/panel/ImportPanelMediator.java @@ -130,7 +130,7 @@ public class ImportPanelMediator extends Mediator { @Override public void progressChanged(float value) { - viewComponent.getProgressBar().setValue(value); + Gdx.app.postRunnable(() -> viewComponent.getProgressBar().setValue(value)); } @Override