added a headless render stub

This commit is contained in:
Andrea Cavalli 2017-05-01 20:30:39 +00:00
parent e4a0fbb48e
commit 144fb1593f
4 changed files with 26 additions and 4 deletions

View File

@ -1,6 +1,7 @@
package org.warp.picalculator.gui;
import java.io.IOException;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import org.warp.picalculator.Main;
@ -11,6 +12,7 @@ import org.warp.picalculator.gui.graphicengine.RenderingLoop;
import org.warp.picalculator.gui.graphicengine.Renderer;
import org.warp.picalculator.gui.graphicengine.cpu.CPUEngine;
import org.warp.picalculator.gui.graphicengine.gpu.GPUEngine;
import org.warp.picalculator.gui.graphicengine.headless.HeadlessEngine;
import org.warp.picalculator.gui.graphicengine.BinaryFont;
import org.warp.picalculator.gui.graphicengine.Skin;
import org.warp.picalculator.gui.screens.Screen;
@ -82,6 +84,10 @@ public final class DisplayManager implements RenderingLoop {
Utils.debug.println("Using CPU Graphic Engine");
return d;
}
d = new HeadlessEngine();
if (d.isSupported()) {
System.err.println("Using Headless Engine! This is a problem! No other graphic engines are available.");
}
throw new UnsupportedOperationException("No graphic engines available.");
}

View File

@ -125,8 +125,15 @@ public class GPUEngine implements org.warp.picalculator.gui.graphicengine.Graphi
@Override
public boolean isSupported() {
final boolean available = GLProfile.isAvailable(GLProfile.GL2ES1);
if (!available) {
boolean available = false;
boolean errored = false;
try {
available = GLProfile.isAvailable(GLProfile.GL2ES1);
} catch (Exception ex) {
errored = true;
System.err.println(ex.getMessage());
}
if (!available && !errored) {
System.err.println(GLProfile.glAvailabilityToString());
}
return available;

View File

@ -0,0 +1,4 @@
package org.warp.picalculator.gui.graphicengine.headless;
public class HeadlessEngine implements org.warp.picalculator.gui.graphicengine.GraphicEngine {
}

View File

@ -0,0 +1,5 @@
package org.warp.picalculator.gui.graphicengine.headless;
public class HeadlessRenderer implements Renderer {
}