Global alpha stack added into Color.

This commit is contained in:
ondra
2014-04-16 13:47:08 +02:00
parent 225f062684
commit e58156b7ee
9 changed files with 108 additions and 26 deletions
+1 -3
View File
@@ -125,7 +125,6 @@ public abstract class BaseApp implements AppAccess, UncaughtExceptionHandler {
* Resources should be registered to banks, and AsyncResourceLoader will load them.
*/
Log.f1("Loading resources...");
AsyncResourceLoader.launch(this);
initResources();
/*
@@ -210,8 +209,7 @@ public abstract class BaseApp implements AppAccess, UncaughtExceptionHandler {
/**
* Initialize resource banks; {@link AsyncResourceLoader} is already
* started.
* Initialize resource banks.
*/
@DefaultImpl
protected void initResources()
@@ -6,6 +6,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import mightypork.gamecore.control.bus.BusAccess;
import mightypork.gamecore.control.bus.events.MainLoopTaskRequest;
import mightypork.gamecore.control.bus.events.ResourceLoadRequest;
import mightypork.gamecore.control.interf.Destroyable;
import mightypork.utils.annotations.FactoryMethod;
@@ -38,8 +39,14 @@ public class AsyncResourceLoader extends Thread implements ResourceLoadRequest.L
private final LinkedBlockingQueue<Deferred> toLoad = new LinkedBlockingQueue<>();
private volatile boolean stopped;
@SuppressWarnings("unused")
private final BusAccess app;
private volatile boolean mainLoopQueuing = false;
public void enableMainLoopQueuing(boolean yes)
{
mainLoopQueuing = yes;
}
/**
@@ -61,18 +68,20 @@ public class AsyncResourceLoader extends Thread implements ResourceLoadRequest.L
// textures & fonts needs to be loaded in main thread
if (resource.getClass().isAnnotationPresent(MustLoadInMainThread.class)) {
Log.f3("<LOADER> Cannot load async: " + Log.str(resource));
// Log.f3("<LOADER> Delegating to main thread:\n " + Log.str(resource));
//
// app.getEventBus().send(new MainLoopTaskRequest(new Runnable() {
//
// @Override
// public void run()
// {
// resource.load();
// }
// }));
if (!mainLoopQueuing) {
Log.f3("<LOADER> Cannot load async: " + Log.str(resource));
} else {
Log.f3("<LOADER> Delegating to main thread:\n " + Log.str(resource));
app.getEventBus().send(new MainLoopTaskRequest(new Runnable() {
@Override
public void run()
{
resource.load();
}
}));
}
return;
}
@@ -54,7 +54,7 @@ public class DeferredFont extends DeferredResource implements GLFont {
* @param size size (px)
*/
public DeferredFont(String resourcePath, String chars, double size) {
this(resourcePath, chars, size, FontStyle.PLAIN, true, FilterMode.LINEAR);
this(resourcePath, chars, size, FontStyle.PLAIN, false, FilterMode.NEAREST);
}