New splash screen, renamed some rendering classes, Bugfixes
@ -2,7 +2,7 @@ eclipse.preferences.version=1
|
||||
encoding//src/org/nevec/rjm/BigSurd.java=UTF-8
|
||||
encoding//src/org/nevec/rjm/BigSurdVec.java=UTF-8
|
||||
encoding//src/org/warp/picalculator/Main.java=UTF-8
|
||||
encoding//src/org/warp/picalculator/gui/graphicengine/cpu/CPUDisplay.java=UTF-8
|
||||
encoding//src/org/warp/picalculator/gui/graphicengine/cpu/CPUEngine.java=UTF-8
|
||||
encoding//src/org/warp/picalculator/gui/screens/MathInputScreen.java=UTF-8
|
||||
encoding//src/org/warp/picalculator/math/MathematicalSymbols.java=UTF-8
|
||||
encoding//src/org/warp/picalculator/math/functions/Expression.java=UTF-8
|
||||
|
BIN
res/icons/calculator-016.png
Normal file
After Width: | Height: | Size: 468 B |
BIN
res/icons/calculator-018.png
Normal file
After Width: | Height: | Size: 497 B |
BIN
res/icons/calculator-024.png
Normal file
After Width: | Height: | Size: 576 B |
BIN
res/icons/calculator-032.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
res/icons/calculator-048.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
res/icons/calculator-064.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
res/icons/calculator-128.png
Normal file
After Width: | Height: | Size: 7.1 KiB |
BIN
res/icons/calculator-256.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
res/skin.png
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 21 KiB |
BIN
res/skin.xcf
@ -5,6 +5,6 @@ import org.warp.picalculator.gui.screens.KeyboardDebugScreen;
|
||||
public class KeyboardTest {
|
||||
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
new Main(new KeyboardDebugScreen());
|
||||
new Main(new KeyboardDebugScreen(), args);
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,11 @@ package org.warp.picalculator;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.warp.picalculator.gui.graphicengine.Display;
|
||||
import org.warp.picalculator.gui.graphicengine.Drawable;
|
||||
import org.warp.picalculator.gui.graphicengine.RAWFont;
|
||||
import org.warp.picalculator.gui.graphicengine.RAWSkin;
|
||||
import org.warp.picalculator.gui.graphicengine.gpu.GPUDisplay;
|
||||
import org.warp.picalculator.gui.graphicengine.GraphicEngine;
|
||||
import org.warp.picalculator.gui.graphicengine.RenderingLoop;
|
||||
import org.warp.picalculator.gui.graphicengine.BinaryFont;
|
||||
import org.warp.picalculator.gui.graphicengine.Skin;
|
||||
import org.warp.picalculator.gui.graphicengine.gpu.GPUEngine;
|
||||
import org.warp.picalculator.gui.graphicengine.gpu.GPURenderer;
|
||||
import org.warp.picalculator.gui.screens.KeyboardDebugScreen;
|
||||
import org.warp.picalculator.gui.screens.MarioScreen;
|
||||
@ -19,11 +19,9 @@ import java.util.ArrayList;
|
||||
|
||||
public class TestGPU {
|
||||
|
||||
public static final GPUDisplay d = new GPUDisplay();
|
||||
public static final GPUEngine d = new GPUEngine();
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
new Main(new KeyboardDebugScreen());
|
||||
if (true) return;
|
||||
Utils.debugOn = true;
|
||||
Utils.debugThirdScreen = false;
|
||||
d.create();
|
||||
@ -31,15 +29,15 @@ public class TestGPU {
|
||||
final Scene s = new Scene(d);
|
||||
}
|
||||
|
||||
private static class Scene implements Drawable {
|
||||
private static class Scene implements RenderingLoop {
|
||||
|
||||
private RAWFont exampleFont;
|
||||
private final RAWSkin exampleSkin;
|
||||
private BinaryFont exampleFont;
|
||||
private final Skin exampleSkin;
|
||||
|
||||
private final GPURenderer r;
|
||||
private final Display d;
|
||||
private final GraphicEngine d;
|
||||
|
||||
public Scene(Display d) throws IOException {
|
||||
public Scene(GraphicEngine d) throws IOException {
|
||||
this.d = d;
|
||||
r = (GPURenderer) d.getRenderer();
|
||||
|
||||
@ -79,6 +77,12 @@ public class TestGPU {
|
||||
exampleFont.use(d);
|
||||
r.glColor3f(1, 0, 0);
|
||||
r.glDrawStringLeft(10, 170, "Prova! 123456789");
|
||||
|
||||
//MSAA TEST
|
||||
r.glDrawStringLeft(10f, 190.5f, "Test MSAA");
|
||||
exampleSkin.use(d);
|
||||
r.glColor3f(1.0f, 1.0f, 1.0f);
|
||||
r.glFillRect(162, 2.5f, 160, 160, 0, 0, 16, 16);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ import java.util.List;
|
||||
import org.nevec.rjm.BigDecimalMath;
|
||||
import org.nevec.rjm.Rational;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.graphicengine.RAWFont;
|
||||
import org.warp.picalculator.gui.graphicengine.BinaryFont;
|
||||
import org.warp.picalculator.math.functions.AnteriorFunction;
|
||||
import org.warp.picalculator.math.functions.Division;
|
||||
import org.warp.picalculator.math.functions.Expression;
|
||||
@ -360,7 +360,9 @@ public class Utils {
|
||||
|
||||
var.draw(x + wsegno, y + (hsegno - h1));
|
||||
|
||||
DisplayManager.renderer.glDrawLine(x + 1, y + hsegno - 3, x + 3, y + hsegno - 1);
|
||||
DisplayManager.renderer.glDrawLine(x + 1, y + hsegno - 3, x + 1, y + hsegno - 3);
|
||||
DisplayManager.renderer.glDrawLine(x + 2, y + hsegno - 2, x + 2, y + hsegno - 2);
|
||||
DisplayManager.renderer.glDrawLine(x + 3, y + hsegno - 1, x + 3, y + hsegno - 1);
|
||||
DisplayManager.renderer.glDrawLine(x + 3, y + (hsegno - 1) / 2 + 1, x + 3, y + hsegno - 1);
|
||||
DisplayManager.renderer.glDrawLine(x + 4, y, x + 4, y + (hsegno - 1) / 2);
|
||||
DisplayManager.renderer.glDrawLine(x + 4, y, x + 4 + 1 + w1 + 1, y);
|
||||
@ -370,11 +372,11 @@ public class Utils {
|
||||
return getFontHeight(false);
|
||||
}
|
||||
|
||||
public static final RAWFont getFont(boolean small) {
|
||||
public static final BinaryFont getFont(boolean small) {
|
||||
return getFont(small, Main.zoomed);
|
||||
}
|
||||
|
||||
public static final RAWFont getFont(boolean small, boolean zoomed) {
|
||||
public static final BinaryFont getFont(boolean small, boolean zoomed) {
|
||||
return DisplayManager.fonts[getFontIndex(small, zoomed)];
|
||||
}
|
||||
|
||||
|
@ -700,7 +700,7 @@ public class Keyboard {
|
||||
} else {
|
||||
switch (k) {
|
||||
case POWER:
|
||||
DisplayManager.display.destroy();
|
||||
DisplayManager.engine.destroy();
|
||||
break;
|
||||
case NONE:
|
||||
break;
|
||||
|
@ -10,26 +10,26 @@ import java.util.ArrayList;
|
||||
import org.warp.picalculator.Main;
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.device.Keyboard;
|
||||
import org.warp.picalculator.gui.graphicengine.Display;
|
||||
import org.warp.picalculator.gui.graphicengine.Drawable;
|
||||
import org.warp.picalculator.gui.graphicengine.GraphicEngine;
|
||||
import org.warp.picalculator.gui.graphicengine.RenderingLoop;
|
||||
import org.warp.picalculator.gui.graphicengine.Renderer;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUDisplay;
|
||||
import org.warp.picalculator.gui.graphicengine.gpu.GPUDisplay;
|
||||
import org.warp.picalculator.gui.graphicengine.RAWFont;
|
||||
import org.warp.picalculator.gui.graphicengine.RAWSkin;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUEngine;
|
||||
import org.warp.picalculator.gui.graphicengine.gpu.GPUEngine;
|
||||
import org.warp.picalculator.gui.graphicengine.BinaryFont;
|
||||
import org.warp.picalculator.gui.graphicengine.Skin;
|
||||
import org.warp.picalculator.gui.screens.Screen;
|
||||
|
||||
import com.pi4j.wiringpi.Gpio;
|
||||
|
||||
public final class DisplayManager implements Drawable {
|
||||
public final class DisplayManager implements RenderingLoop {
|
||||
public static DisplayManager INSTANCE;
|
||||
private static float brightness;
|
||||
|
||||
public static final Display display = chooseGraphicEngine();
|
||||
public static final GraphicEngine engine = chooseGraphicEngine();
|
||||
public static Renderer renderer;
|
||||
|
||||
private static RAWSkin skin;
|
||||
public static RAWFont[] fonts;
|
||||
public static Skin guiSkin;
|
||||
public static BinaryFont[] fonts;
|
||||
|
||||
public static String error = null;
|
||||
public String[] errorStackTrace = null;
|
||||
@ -72,12 +72,18 @@ public final class DisplayManager implements Drawable {
|
||||
* }
|
||||
*/
|
||||
|
||||
private static Display chooseGraphicEngine() {
|
||||
Display d;
|
||||
d = new GPUDisplay();
|
||||
if (d.isSupported()) return d;
|
||||
d = new CPUDisplay();
|
||||
if (d.isSupported()) return d;
|
||||
private static GraphicEngine chooseGraphicEngine() {
|
||||
GraphicEngine d;
|
||||
d = new GPUEngine();
|
||||
if (d.isSupported()) {
|
||||
Utils.debug.println("Using GPU Graphic Engine");
|
||||
return d;
|
||||
}
|
||||
d = new CPUEngine();
|
||||
if (d.isSupported()) {
|
||||
Utils.debug.println("Using CPU Graphic Engine");
|
||||
return d;
|
||||
}
|
||||
throw new UnsupportedOperationException("No graphic engines available.");
|
||||
}
|
||||
|
||||
@ -197,30 +203,30 @@ public final class DisplayManager implements Drawable {
|
||||
}
|
||||
|
||||
private void load_skin() throws IOException {
|
||||
skin = display.loadSkin("skin.png");
|
||||
guiSkin = engine.loadSkin("skin.png");
|
||||
}
|
||||
|
||||
private void load_fonts() throws IOException {
|
||||
fonts = new RAWFont[7];
|
||||
fonts[0] = display.loadFont("big");
|
||||
fonts[1] = display.loadFont("small");
|
||||
fonts[2] = display.loadFont("ex");
|
||||
fonts[3] = display.loadFont("big");
|
||||
fonts[4] = display.loadFont("32");
|
||||
fonts[5] = display.loadFont("square");
|
||||
fonts = new BinaryFont[7];
|
||||
fonts[0] = engine.loadFont("big");
|
||||
fonts[1] = engine.loadFont("small");
|
||||
fonts[2] = engine.loadFont("ex");
|
||||
fonts[3] = engine.loadFont("big");
|
||||
fonts[4] = engine.loadFont("32");
|
||||
fonts[5] = engine.loadFont("square");
|
||||
}
|
||||
|
||||
private void draw_init() {
|
||||
renderer.glClear(display.getWidth(), display.getHeight());
|
||||
renderer.glClear(engine.getWidth(), engine.getHeight());
|
||||
}
|
||||
|
||||
private void draw_status() {
|
||||
renderer.glColor(0xFFc5c2af);
|
||||
renderer.glFillColor(0, 0, display.getWidth(), 20);
|
||||
renderer.glFillColor(0, 0, engine.getWidth(), 20);
|
||||
renderer.glColor3i(0, 0, 0);
|
||||
renderer.glDrawLine(0, 20, display.getWidth() - 1, 20);
|
||||
renderer.glDrawLine(0, 20, engine.getWidth() - 1, 20);
|
||||
renderer.glColor3i(255, 255, 255);
|
||||
skin.use(display);
|
||||
guiSkin.use(engine);
|
||||
if (Keyboard.shift) {
|
||||
renderer.glFillRect(2 + 18 * 0, 2, 16, 16, 16 * 2, 16 * 0, 16, 16);
|
||||
} else {
|
||||
@ -291,18 +297,22 @@ public final class DisplayManager implements Drawable {
|
||||
private void draw_bottom() {
|
||||
renderer.glDrawStringLeft(2, 90, displayDebugString);
|
||||
|
||||
Utils.getFont(false, true).use(DisplayManager.display);
|
||||
Utils.getFont(true, false).use(DisplayManager.engine);
|
||||
DisplayManager.renderer.glColor4i(255, 0, 0, 40);
|
||||
DisplayManager.renderer.glDrawStringLeft(5 + 1, Main.screenSize[1] - 20 + 1, "WORK IN PROGRESS.");
|
||||
DisplayManager.renderer.glDrawStringLeft(1 + 1, Main.screenSize[1] - 7 - 7 + 1, "WORK IN");
|
||||
DisplayManager.renderer.glColor4i(255, 0, 0, 80);
|
||||
DisplayManager.renderer.glDrawStringLeft(5, Main.screenSize[1] - 20, "WORK IN PROGRESS.");
|
||||
DisplayManager.renderer.glDrawStringLeft(1, Main.screenSize[1] - 7 - 7, "WORK IN");
|
||||
DisplayManager.renderer.glColor4i(255, 0, 0, 40);
|
||||
DisplayManager.renderer.glDrawStringLeft(1 + 1, Main.screenSize[1] - 7 + 1, "PROGRESS.");
|
||||
DisplayManager.renderer.glColor4i(255, 0, 0, 80);
|
||||
DisplayManager.renderer.glDrawStringLeft(1, Main.screenSize[1] - 7, "PROGRESS.");
|
||||
}
|
||||
|
||||
private void draw_world() {
|
||||
renderer.glColor3i(255, 255, 255);
|
||||
|
||||
if (error != null) {
|
||||
Utils.getFont(false, false).use(display);
|
||||
Utils.getFont(false, false).use(engine);
|
||||
renderer.glColor3i(129, 28, 22);
|
||||
renderer.glDrawStringRight(Main.screenSize[0] - 2, Main.screenSize[1] - DisplayManager.glyphsHeight[1] - 2, "ANDREA CAVALLI'S CALCULATOR");
|
||||
renderer.glColor3i(149, 32, 26);
|
||||
@ -313,11 +323,11 @@ public final class DisplayManager implements Drawable {
|
||||
renderer.glDrawStringLeft(2, 22 + i, stackPart);
|
||||
i += 11;
|
||||
}
|
||||
fonts[0].use(display);
|
||||
fonts[0].use(engine);
|
||||
renderer.glColor3i(129, 28, 22);
|
||||
renderer.glDrawStringCenter((Main.screenSize[0] / 2), 11, "UNEXPECTED EXCEPTION");
|
||||
} else {
|
||||
fonts[0].use(display);
|
||||
fonts[0].use(engine);
|
||||
draw_screen();
|
||||
draw_status();
|
||||
draw_bottom();
|
||||
@ -355,9 +365,9 @@ public final class DisplayManager implements Drawable {
|
||||
}
|
||||
|
||||
private void checkDisplayResized() {
|
||||
if (display.wasResized()) {
|
||||
Main.screenSize[0] = display.getWidth();
|
||||
Main.screenSize[1] = display.getHeight();
|
||||
if (engine.wasResized()) {
|
||||
Main.screenSize[0] = engine.getWidth();
|
||||
Main.screenSize[1] = engine.getHeight();
|
||||
}
|
||||
};
|
||||
|
||||
@ -365,8 +375,8 @@ public final class DisplayManager implements Drawable {
|
||||
try {
|
||||
load_skin();
|
||||
load_fonts();
|
||||
display.create();
|
||||
renderer = display.getRenderer();
|
||||
engine.create();
|
||||
renderer = engine.getRenderer();
|
||||
|
||||
try {
|
||||
screen.initialize();
|
||||
@ -438,9 +448,9 @@ public final class DisplayManager implements Drawable {
|
||||
dbgthrd.setName("Debug performance thread");
|
||||
dbgthrd.start();
|
||||
|
||||
display.start(this);
|
||||
engine.start(this);
|
||||
|
||||
display.waitUntilExit();
|
||||
engine.waitUntilExit();
|
||||
} catch (final Exception ex) {
|
||||
ex.printStackTrace();
|
||||
} finally {}
|
||||
@ -483,7 +493,7 @@ public final class DisplayManager implements Drawable {
|
||||
renderer.glColor4f(f1,f2,f3,f4);
|
||||
}
|
||||
|
||||
public static Drawable getDrawable() {
|
||||
public static RenderingLoop getDrawable() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ package org.warp.picalculator.gui.graphicengine;
|
||||
*
|
||||
* @author andreacv
|
||||
*/
|
||||
public interface RAWFont extends RAWSkin {
|
||||
public interface BinaryFont extends Skin {
|
||||
|
||||
public int getStringWidth(String text);
|
||||
|
@ -2,7 +2,7 @@ package org.warp.picalculator.gui.graphicengine;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public interface Display {
|
||||
public interface GraphicEngine {
|
||||
|
||||
public int[] getSize();
|
||||
|
||||
@ -24,15 +24,15 @@ public interface Display {
|
||||
|
||||
public void destroy();
|
||||
|
||||
public void start(Drawable d);
|
||||
public void start(RenderingLoop d);
|
||||
|
||||
public void repaint();
|
||||
|
||||
public Renderer getRenderer();
|
||||
|
||||
public RAWFont loadFont(String file) throws IOException;
|
||||
public BinaryFont loadFont(String file) throws IOException;
|
||||
|
||||
public RAWSkin loadSkin(String file) throws IOException;
|
||||
public Skin loadSkin(String file) throws IOException;
|
||||
|
||||
public void waitUntilExit();
|
||||
|
@ -23,19 +23,19 @@ public interface Renderer {
|
||||
|
||||
public void glClear(int screenWidth, int screenHeight);
|
||||
|
||||
public void glDrawLine(int x0, int y0, int x1, int y1);
|
||||
public void glDrawLine(float x0, float y0, float x1, float y1);
|
||||
|
||||
public void glFillRect(int x, int y, int width, int height, float uvX, float uvY, float uvWidth, float uvHeight);
|
||||
public void glFillRect(float x, float y, float width, float height, float uvX, float uvY, float uvWidth, float uvHeight);
|
||||
|
||||
public void glFillColor(int x, int y, int width, int height);
|
||||
public void glFillColor(float x, float y, float width, float height);
|
||||
|
||||
public void glDrawStringLeft(int x, int y, String text);
|
||||
public void glDrawStringLeft(float x, float y, String text);
|
||||
|
||||
public void glDrawStringCenter(int x, int y, String text);
|
||||
public void glDrawStringCenter(float x, float y, String text);
|
||||
|
||||
public void glDrawStringRight(int x, int y, String text);
|
||||
public void glDrawStringRight(float x, float y, String text);
|
||||
|
||||
public void glClearSkin();
|
||||
|
||||
public RAWFont getCurrentFont();
|
||||
public BinaryFont getCurrentFont();
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
package org.warp.picalculator.gui.graphicengine;
|
||||
|
||||
public interface Drawable {
|
||||
public interface RenderingLoop {
|
||||
public void refresh();
|
||||
}
|
@ -2,11 +2,11 @@ package org.warp.picalculator.gui.graphicengine;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public interface RAWSkin {
|
||||
public interface Skin {
|
||||
|
||||
public void load(String file) throws IOException;
|
||||
|
||||
public void initialize(Display d);
|
||||
public void initialize(GraphicEngine d);
|
||||
|
||||
public void use(Display d);
|
||||
public void use(GraphicEngine d);
|
||||
}
|
@ -8,13 +8,13 @@ import java.io.IOException;
|
||||
import org.warp.picalculator.Main;
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.graphicengine.Display;
|
||||
import org.warp.picalculator.gui.graphicengine.Drawable;
|
||||
import org.warp.picalculator.gui.graphicengine.RAWFont;
|
||||
import org.warp.picalculator.gui.graphicengine.RAWSkin;
|
||||
import org.warp.picalculator.gui.graphicengine.GraphicEngine;
|
||||
import org.warp.picalculator.gui.graphicengine.RenderingLoop;
|
||||
import org.warp.picalculator.gui.graphicengine.BinaryFont;
|
||||
import org.warp.picalculator.gui.graphicengine.Skin;
|
||||
import org.warp.picalculator.gui.graphicengine.Renderer;
|
||||
|
||||
public class CPUDisplay implements Display {
|
||||
public class CPUEngine implements GraphicEngine {
|
||||
|
||||
private SwingWindow INSTANCE;
|
||||
public int[] size = new int[] { 1, 1 };
|
||||
@ -85,7 +85,7 @@ public class CPUDisplay implements Display {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Drawable d) {
|
||||
public void start(RenderingLoop d) {
|
||||
Thread th = new Thread(() -> {
|
||||
try {
|
||||
double extratime = 0;
|
||||
@ -254,49 +254,59 @@ public class CPUDisplay implements Display {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDrawLine(int x0, int y0, int x1, int y1) {
|
||||
public void glDrawLine(float x0, float y0, float x1, float y1) {
|
||||
x0 += Main.screenPos[0];
|
||||
x1 += Main.screenPos[0];
|
||||
y0 += Main.screenPos[1];
|
||||
y1 += Main.screenPos[1];
|
||||
if (x0 >= size[0] || y0 >= size[0]) {
|
||||
final int ix0 = (int) x0;
|
||||
final int ix1 = (int) x1;
|
||||
final int iy0 = (int) y0;
|
||||
final int iy1 = (int) y1;
|
||||
if (ix0 >= size[0] || iy0 >= size[0]) {
|
||||
return;
|
||||
}
|
||||
if (y0 == y1) {
|
||||
for (int x = 0; x <= x1 - x0; x++) {
|
||||
canvas2d[x0 + x + y0 * size[0]] = color;
|
||||
if (iy0 == iy1) {
|
||||
for (int x = 0; x <= ix1 - ix0; x++) {
|
||||
canvas2d[ix0 + x + iy0 * size[0]] = color;
|
||||
}
|
||||
} else if (x0 == x1) {
|
||||
for (int y = 0; y <= y1 - y0; y++) {
|
||||
canvas2d[x0 + (y0 + y) * size[0]] = color;
|
||||
} else if (ix0 == ix1) {
|
||||
for (int y = 0; y <= iy1 - iy0; y++) {
|
||||
canvas2d[ix0 + (iy0 + y) * size[0]] = color;
|
||||
}
|
||||
} else {
|
||||
final int m = (y1 - y0) / (x1 - x0);
|
||||
for (int texx = 0; texx <= x1 - x0; texx++) {
|
||||
if (x0 + texx < size[0] && y0 + (m * texx) < size[1]) {
|
||||
canvas2d[(x0 + texx) + (y0 + (m * texx)) * size[0]] = color;
|
||||
final int m = (iy1 - iy0) / (ix1 - ix0);
|
||||
for (int texx = 0; texx <= ix1 - ix0; texx++) {
|
||||
if (ix0 + texx < size[0] && iy0 + (m * texx) < size[1]) {
|
||||
canvas2d[(ix0 + texx) + (iy0 + (m * texx)) * size[0]] = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glFillRect(int x, int y, int width, int height, float uvX, float uvY, float uvWidth,
|
||||
public void glFillRect(float x, float y, float width, float height, float uvX, float uvY, float uvWidth,
|
||||
float uvHeight) {
|
||||
if (currentSkin != null) {
|
||||
glDrawSkin(x, y, (int) uvX, (int) uvY, (int) (uvWidth + uvX), (int) (uvHeight + uvY), true);
|
||||
glDrawSkin((int) x, (int) y, (int) uvX, (int) uvY, (int) (uvWidth + uvX), (int) (uvHeight + uvY), true);
|
||||
} else {
|
||||
glFillColor(x, y, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glFillColor(int x, int y, int width, int height) {
|
||||
public void glFillColor(float x, float y, float width, float height) {
|
||||
x += Main.screenPos[0];
|
||||
y += Main.screenPos[1];
|
||||
int x1 = x + width;
|
||||
int y1 = y + height;
|
||||
if (x >= size[0] || y >= size[0]) {
|
||||
|
||||
final int ix = (int) x;
|
||||
final int iy = (int) y;
|
||||
final int iw = (int) width;
|
||||
final int ih = (int) height;
|
||||
|
||||
int x1 = ix + iw;
|
||||
int y1 = iy + ih;
|
||||
if (ix >= size[0] || iy >= size[0]) {
|
||||
return;
|
||||
}
|
||||
if (x1 >= size[0]) {
|
||||
@ -306,18 +316,21 @@ public class CPUDisplay implements Display {
|
||||
y1 = size[1];
|
||||
}
|
||||
final int sizeW = size[0];
|
||||
for (int px = x; px < x1; px++) {
|
||||
for (int py = y; py < y1; py++) {
|
||||
for (int px = ix; px < x1; px++) {
|
||||
for (int py = iy; py < y1; py++) {
|
||||
canvas2d[(px) + (py) * sizeW] = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDrawStringLeft(int x, int y, String textString) {
|
||||
public void glDrawStringLeft(float x, float y, String textString) {
|
||||
x += Main.screenPos[0];
|
||||
y += Main.screenPos[1];
|
||||
|
||||
final int ix = (int) x;
|
||||
final int iy = (int) y;
|
||||
|
||||
final int[] text = currentFont.getCharIndexes(textString);
|
||||
final int[] screen = canvas2d;
|
||||
final int[] screenSize = size;
|
||||
@ -335,13 +348,13 @@ public class CPUDisplay implements Display {
|
||||
final int charIndex = text[i];
|
||||
for (int dy = 0; dy < currentFont.charH; dy++) {
|
||||
for (int dx = 0; dx < currentFont.charW; dx++) {
|
||||
j = x + cpos + dx;
|
||||
j = ix + cpos + dx;
|
||||
if (j > 0 & j < screenSize[0]) {
|
||||
final int bit = dx + dy * currentFont.charW;
|
||||
currentInt = (int) (Math.floor(bit) / (CPUFont.intBits));
|
||||
currentIntBitPosition = bit - (currentInt * CPUFont.intBits);
|
||||
bitData = (currentFont.chars32[charIndex * currentFont.charIntCount + currentInt] >> currentIntBitPosition) & 1;
|
||||
screenPos = x + cpos + dx + (y + dy) * screenSize[0];
|
||||
screenPos = ix + cpos + dx + (iy + dy) * screenSize[0];
|
||||
if (bitData == 1 & screenLength > screenPos) {
|
||||
screen[screenPos] = color;
|
||||
}
|
||||
@ -352,12 +365,12 @@ public class CPUDisplay implements Display {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDrawStringCenter(int x, int y, String text) {
|
||||
public void glDrawStringCenter(float x, float y, String text) {
|
||||
glDrawStringLeft(x - (currentFont.getStringWidth(text) / 2), y, text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDrawStringRight(int x, int y, String text) {
|
||||
public void glDrawStringRight(float x, float y, String text) {
|
||||
glDrawStringLeft(x - currentFont.getStringWidth(text), y, text);
|
||||
}
|
||||
|
||||
@ -377,7 +390,7 @@ public class CPUDisplay implements Display {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RAWFont getCurrentFont() {
|
||||
public BinaryFont getCurrentFont() {
|
||||
return currentFont;
|
||||
}
|
||||
|
||||
@ -414,12 +427,12 @@ public class CPUDisplay implements Display {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RAWFont loadFont(String file) throws IOException {
|
||||
public BinaryFont loadFont(String file) throws IOException {
|
||||
return new CPUFont(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RAWSkin loadSkin(String file) throws IOException {
|
||||
public Skin loadSkin(String file) throws IOException {
|
||||
return new CPUSkin(file);
|
||||
}
|
||||
|
@ -12,11 +12,11 @@ import java.util.logging.Logger;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.gui.graphicengine.Display;
|
||||
import org.warp.picalculator.gui.graphicengine.RAWFont;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUDisplay.CPURenderer;
|
||||
import org.warp.picalculator.gui.graphicengine.GraphicEngine;
|
||||
import org.warp.picalculator.gui.graphicengine.BinaryFont;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUEngine.CPURenderer;
|
||||
|
||||
public class CPUFont implements RAWFont {
|
||||
public class CPUFont implements BinaryFont {
|
||||
|
||||
public boolean[][] rawchars;
|
||||
public int[] chars32;
|
||||
@ -134,7 +134,7 @@ public class CPUFont implements RAWFont {
|
||||
try {
|
||||
ImageIO.write(bi, "PNG", new File(coutputpng));
|
||||
} catch (final IOException ex) {
|
||||
Logger.getLogger(RAWFont.class.getName()).log(Level.SEVERE, null, ex);
|
||||
Logger.getLogger(BinaryFont.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,13 +149,13 @@ public class CPUFont implements RAWFont {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(Display d) {
|
||||
public void initialize(GraphicEngine d) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void use(Display d) {
|
||||
public void use(GraphicEngine d) {
|
||||
((CPURenderer) d.getRenderer()).currentFont = this;
|
||||
}
|
||||
|
||||
|
@ -6,11 +6,11 @@ import java.io.IOException;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.warp.picalculator.Main;
|
||||
import org.warp.picalculator.gui.graphicengine.Display;
|
||||
import org.warp.picalculator.gui.graphicengine.RAWSkin;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUDisplay.CPURenderer;
|
||||
import org.warp.picalculator.gui.graphicengine.GraphicEngine;
|
||||
import org.warp.picalculator.gui.graphicengine.Skin;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUEngine.CPURenderer;
|
||||
|
||||
public class CPUSkin implements RAWSkin {
|
||||
public class CPUSkin implements Skin {
|
||||
|
||||
public int[] skinData;
|
||||
public int[] skinSize;
|
||||
@ -40,13 +40,13 @@ public class CPUSkin implements RAWSkin {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(Display d) {
|
||||
public void initialize(GraphicEngine d) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void use(Display d) {
|
||||
public void use(GraphicEngine d) {
|
||||
((CPURenderer) d.getRenderer()).currentSkin = this;
|
||||
}
|
||||
|
||||
|
@ -19,16 +19,16 @@ import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.device.Keyboard;
|
||||
import org.warp.picalculator.device.Keyboard.Key;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.graphicengine.Drawable;
|
||||
import org.warp.picalculator.gui.graphicengine.RenderingLoop;
|
||||
|
||||
public class SwingWindow extends JFrame {
|
||||
private static final long serialVersionUID = 2945898937634075491L;
|
||||
public CustomCanvas c;
|
||||
private static Drawable d;
|
||||
private static RenderingLoop d;
|
||||
public boolean wasResized = false;
|
||||
private final CPUDisplay display;
|
||||
private final CPUEngine display;
|
||||
|
||||
public SwingWindow(CPUDisplay disp, Drawable d) {
|
||||
public SwingWindow(CPUEngine disp, RenderingLoop d) {
|
||||
SwingWindow.d = d;
|
||||
display = disp;
|
||||
c = new CustomCanvas();
|
||||
@ -60,7 +60,7 @@ public class SwingWindow extends JFrame {
|
||||
addComponentListener(new ComponentListener() {
|
||||
@Override
|
||||
public void componentHidden(ComponentEvent e) {
|
||||
DisplayManager.display.destroy();
|
||||
DisplayManager.engine.destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -231,7 +231,7 @@ public class SwingWindow extends JFrame {
|
||||
|
||||
final int[] a = ((DataBufferInt) display.g.getRaster().getDataBuffer()).getData();
|
||||
// System.arraycopy(canvas2d, 0, a, 0, canvas2d.length);
|
||||
CPUDisplay.canvas2d = a;
|
||||
CPUEngine.canvas2d = a;
|
||||
g.clearRect(0, 0, display.size[0], display.size[1]);
|
||||
g.drawImage(display.g, 0, 0, null);
|
||||
// long time2 = System.nanoTime();
|
||||
|
@ -4,19 +4,19 @@ import java.io.IOException;
|
||||
|
||||
import org.warp.picalculator.Main;
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.gui.graphicengine.Drawable;
|
||||
import org.warp.picalculator.gui.graphicengine.RAWFont;
|
||||
import org.warp.picalculator.gui.graphicengine.RAWSkin;
|
||||
import org.warp.picalculator.gui.graphicengine.RenderingLoop;
|
||||
import org.warp.picalculator.gui.graphicengine.BinaryFont;
|
||||
import org.warp.picalculator.gui.graphicengine.Skin;
|
||||
|
||||
import com.jogamp.opengl.GLProfile;
|
||||
import com.jogamp.opengl.egl.EGL;
|
||||
|
||||
public class GPUDisplay implements org.warp.picalculator.gui.graphicengine.Display {
|
||||
public class GPUEngine implements org.warp.picalculator.gui.graphicengine.GraphicEngine {
|
||||
|
||||
private volatile boolean initialized = false;
|
||||
private volatile boolean created = false;
|
||||
private NEWTWindow wnd;
|
||||
private Drawable d;
|
||||
private RenderingLoop d;
|
||||
private GPURenderer r;
|
||||
int[] size = new int[]{Main.screenSize[0], Main.screenSize[1]};
|
||||
|
||||
@ -86,7 +86,7 @@ public class GPUDisplay implements org.warp.picalculator.gui.graphicengine.Displ
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Drawable d) {
|
||||
public void start(RenderingLoop d) {
|
||||
this.d = d;
|
||||
wnd.window.setVisible(true);
|
||||
}
|
||||
@ -104,12 +104,12 @@ public class GPUDisplay implements org.warp.picalculator.gui.graphicengine.Displ
|
||||
}
|
||||
|
||||
@Override
|
||||
public RAWFont loadFont(String file) throws IOException {
|
||||
public BinaryFont loadFont(String file) throws IOException {
|
||||
return new GPUFont(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RAWSkin loadSkin(String file) throws IOException {
|
||||
public Skin loadSkin(String file) throws IOException {
|
||||
return new GPUSkin(file);
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ public class GPUDisplay implements org.warp.picalculator.gui.graphicengine.Displ
|
||||
|
||||
@Override
|
||||
public boolean isSupported() {
|
||||
return GLProfile.isAnyAvailable() == false;
|
||||
return GLProfile.isAvailable(GLProfile.GL2ES1);
|
||||
}
|
||||
|
||||
}
|
@ -6,14 +6,14 @@ import java.io.IOException;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.warp.picalculator.gui.graphicengine.Display;
|
||||
import org.warp.picalculator.gui.graphicengine.RAWFont;
|
||||
import org.warp.picalculator.gui.graphicengine.GraphicEngine;
|
||||
import org.warp.picalculator.gui.graphicengine.BinaryFont;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUFont;
|
||||
|
||||
import com.jogamp.opengl.GLException;
|
||||
import com.jogamp.opengl.util.texture.Texture;
|
||||
|
||||
public class GPUFont implements RAWFont {
|
||||
public class GPUFont implements BinaryFont {
|
||||
|
||||
public Texture texture;
|
||||
public int textureW;
|
||||
@ -100,7 +100,7 @@ public class GPUFont implements RAWFont {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(Display d) {
|
||||
public void initialize(GraphicEngine d) {
|
||||
genTexture(tmpFont.rawchars);
|
||||
tmpFont.chars32 = null;
|
||||
tmpFont.rawchars = null;
|
||||
@ -109,7 +109,7 @@ public class GPUFont implements RAWFont {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void use(Display d) {
|
||||
public void use(GraphicEngine d) {
|
||||
if (!initialized) {
|
||||
initialize(d);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import java.nio.Buffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.warp.picalculator.gui.graphicengine.RAWFont;
|
||||
import org.warp.picalculator.gui.graphicengine.BinaryFont;
|
||||
import org.warp.picalculator.gui.graphicengine.Renderer;
|
||||
|
||||
import com.jogamp.common.nio.Buffers;
|
||||
@ -112,12 +112,12 @@ public class GPURenderer implements Renderer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDrawLine(int x0, int y0, int x1, int y1) {
|
||||
public void glDrawLine(float x0, float y0, float x1, float y1) {
|
||||
glFillColor(x0, y0, x1-x0+1, y1-y0+1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glFillRect(int x, int y, int width, int height, float uvX, float uvY, float uvWidth, float uvHeight) {
|
||||
public void glFillRect(float x, float y, float width, float height, float uvX, float uvY, float uvWidth, float uvHeight) {
|
||||
enableTexture();
|
||||
uvWidth/=currentTexWidth;
|
||||
uvX/=currentTexWidth;
|
||||
@ -132,7 +132,7 @@ public class GPURenderer implements Renderer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glFillColor(int x0, int y0, int w1, int h1) {
|
||||
public void glFillColor(float x0, float y0, float w1, float h1) {
|
||||
disableTexture();
|
||||
final float[] vertices = { x0, y0, 0.0f, x0, y0 + h1, 0.0f, x0 + w1, y0, 0.0f, x0 + w1, y0 + h1, 0.0f, };
|
||||
final float[] tex_vertices = { 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, };
|
||||
@ -143,7 +143,7 @@ public class GPURenderer implements Renderer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDrawStringLeft(int x, int y, String text) {
|
||||
public void glDrawStringLeft(float x, float y, String text) {
|
||||
final int txtLen = text.length();
|
||||
int[] txtArray = currentFont.getCharIndexes(text);
|
||||
int tableIndexX;
|
||||
@ -151,22 +151,22 @@ public class GPURenderer implements Renderer {
|
||||
for (int currentCharIndex = 0; currentCharIndex < txtLen; currentCharIndex++) {
|
||||
tableIndexX = txtArray[currentCharIndex] % currentFont.memoryWidthOfEachColumn;
|
||||
tableIndexY = (txtArray[currentCharIndex] - tableIndexX) / currentFont.memoryWidthOfEachColumn;
|
||||
glFillRect(x + currentCharIndex * (currentFont.charW + 1), y, currentFont.charW, currentFont.charH, tableIndexX*currentFont.charW, tableIndexY*currentFont.charH, currentFont.charW, currentFont.charH);
|
||||
glFillRect(x + ((float)currentCharIndex) * ((float)(currentFont.charW + 1)), y, currentFont.charW, currentFont.charH, tableIndexX*currentFont.charW, tableIndexY*currentFont.charH, currentFont.charW, currentFont.charH);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDrawStringCenter(int x, int y, String text) {
|
||||
public void glDrawStringCenter(float x, float y, String text) {
|
||||
glDrawStringLeft(x - (currentFont.getStringWidth(text) / 2), y, text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDrawStringRight(int x, int y, String text) {
|
||||
public void glDrawStringRight(float x, float y, String text) {
|
||||
glDrawStringLeft(x - currentFont.getStringWidth(text), y, text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RAWFont getCurrentFont() {
|
||||
public BinaryFont getCurrentFont() {
|
||||
return currentFont;
|
||||
}
|
||||
|
||||
|
@ -2,14 +2,14 @@ package org.warp.picalculator.gui.graphicengine.gpu;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import org.warp.picalculator.gui.graphicengine.Display;
|
||||
import org.warp.picalculator.gui.graphicengine.RAWSkin;
|
||||
import org.warp.picalculator.gui.graphicengine.GraphicEngine;
|
||||
import org.warp.picalculator.gui.graphicengine.Skin;
|
||||
|
||||
import com.jogamp.opengl.GL2ES1;
|
||||
import com.jogamp.opengl.GLException;
|
||||
import com.jogamp.opengl.util.texture.Texture;
|
||||
|
||||
public class GPUSkin implements RAWSkin {
|
||||
public class GPUSkin implements Skin {
|
||||
|
||||
public Texture t;
|
||||
public int w;
|
||||
@ -31,7 +31,7 @@ public class GPUSkin implements RAWSkin {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(Display d) {
|
||||
public void initialize(GraphicEngine d) {
|
||||
try {
|
||||
BufferedImage i = GPURenderer.openTexture(texturePath);
|
||||
GL2ES1 gl = ((GPURenderer)d.getRenderer()).gl;
|
||||
@ -47,7 +47,7 @@ public class GPUSkin implements RAWSkin {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void use(Display d) {
|
||||
public void use(GraphicEngine d) {
|
||||
if (!initialized) {
|
||||
initialize(d);
|
||||
}
|
||||
|
@ -36,6 +36,10 @@ import com.jogamp.opengl.GLProfile;
|
||||
import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
|
||||
import com.jogamp.opengl.fixedfunc.GLPointerFunc;
|
||||
import com.jogamp.opengl.GLCapabilities;
|
||||
import com.jogamp.nativewindow.util.DimensionImmutable;
|
||||
import com.jogamp.nativewindow.util.PixelFormat;
|
||||
import com.jogamp.nativewindow.util.PixelRectangle;
|
||||
import com.jogamp.newt.NewtFactory;
|
||||
import com.jogamp.newt.event.KeyEvent;
|
||||
import com.jogamp.newt.event.KeyListener;
|
||||
import com.jogamp.newt.event.WindowEvent;
|
||||
@ -47,11 +51,13 @@ import com.jogamp.opengl.util.*;
|
||||
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ComponentListener;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.warp.picalculator.device.Keyboard;
|
||||
import org.warp.picalculator.device.Keyboard.Key;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.graphicengine.Display;
|
||||
import org.warp.picalculator.gui.graphicengine.GraphicEngine;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@ -88,12 +94,12 @@ import org.warp.picalculator.gui.graphicengine.Display;
|
||||
* @author Xerxes Rånby (xranby)
|
||||
*/
|
||||
|
||||
public class NEWTWindow implements GLEventListener {
|
||||
class NEWTWindow implements GLEventListener {
|
||||
|
||||
private final GPUDisplay disp;
|
||||
private final GPUEngine disp;
|
||||
private final GPURenderer renderer;
|
||||
|
||||
public NEWTWindow(GPUDisplay disp) {
|
||||
public NEWTWindow(GPUEngine disp) {
|
||||
this.disp = disp;
|
||||
renderer = disp.getRenderer();
|
||||
}
|
||||
@ -116,13 +122,16 @@ public class NEWTWindow implements GLEventListener {
|
||||
|
||||
System.out.println("Loading OpenGL...");
|
||||
System.out.println(GLProfile.glAvailabilityToString());
|
||||
if (GLProfile.isAnyAvailable()) {
|
||||
if (!GLProfile.isAvailable(GLProfile.GL2ES1)) {
|
||||
System.err.println("Le OpenGL non sono presenti su questo computer!");
|
||||
return;
|
||||
}
|
||||
System.setProperty("jnlp.newt.window.icons", "res/icons/calculator-016.png res/icons/calculator-018.png res/icons/calculator-256.png");
|
||||
final GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES1));
|
||||
System.out.println("Loaded OpenGL");
|
||||
// We may at this point tweak the caps and request a translucent drawable
|
||||
caps.setBackgroundOpaque(true); //transparency window
|
||||
caps.setSampleBuffers(false);
|
||||
final GLWindow glWindow = GLWindow.create(caps);
|
||||
window = glWindow;
|
||||
|
||||
@ -138,7 +147,7 @@ public class NEWTWindow implements GLEventListener {
|
||||
|
||||
@Override
|
||||
public void windowDestroyed(WindowEvent e) {
|
||||
DisplayManager.display.destroy();
|
||||
DisplayManager.engine.destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -299,10 +308,11 @@ public class NEWTWindow implements GLEventListener {
|
||||
|
||||
//Textures
|
||||
gl.glEnable(GL.GL_TEXTURE_2D);
|
||||
|
||||
|
||||
//Transparency
|
||||
gl.glEnable(GL2ES1.GL_BLEND);
|
||||
gl.glBlendFunc(GL2ES1.GL_SRC_ALPHA, GL2ES1.GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl.glShadeModel(GL2ES1.GL_SMOOTH);
|
||||
|
||||
try {
|
||||
renderer.currentTex = ((GPUSkin) disp.loadSkin("test.png")).t;
|
||||
|
@ -28,7 +28,7 @@ public class ChooseVariableValueScreen extends Screen {
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
Utils.getFont(false, true).use(DisplayManager.display);
|
||||
Utils.getFont(false, true).use(DisplayManager.engine);
|
||||
DisplayManager.renderer.glColor4i(0, 0, 0, 64);
|
||||
DisplayManager.renderer.glDrawStringCenter(Main.screenSize[0] / 2 + 1, Main.screenSize[1] / 2 - 20, "WORK IN PROGRESS.");
|
||||
DisplayManager.renderer.glDrawStringCenter(Main.screenSize[0] / 2, Main.screenSize[1] / 2 - 20 + 1, "WORK IN PROGRESS.");
|
||||
@ -36,7 +36,7 @@ public class ChooseVariableValueScreen extends Screen {
|
||||
DisplayManager.renderer.glColor3i(255, 0, 0);
|
||||
DisplayManager.renderer.glDrawStringCenter(Main.screenSize[0] / 2, Main.screenSize[1] / 2 - 20, "WORK IN PROGRESS.");
|
||||
|
||||
Utils.getFont(false, false).use(DisplayManager.display);
|
||||
Utils.getFont(false, false).use(DisplayManager.engine);
|
||||
DisplayManager.renderer.glColor4i(0, 0, 0, 64);
|
||||
DisplayManager.renderer.glDrawStringCenter(Main.screenSize[0] / 2 + 1, Main.screenSize[1] / 2, "THIS SCREEN MUST HAVE A GUI TO SELECT THE VARIABLE TO SOLVE.");
|
||||
DisplayManager.renderer.glDrawStringCenter(Main.screenSize[0] / 2, Main.screenSize[1] / 2 + 1, "THIS SCREEN MUST HAVE A GUI TO SELECT THE VARIABLE TO SOLVE.");
|
||||
|
@ -30,18 +30,18 @@ public class KeyboardDebugScreen extends Screen {
|
||||
@Override
|
||||
public void render() {
|
||||
Renderer renderer = DisplayManager.renderer;
|
||||
fonts[2].use(DisplayManager.display);
|
||||
fonts[2].use(DisplayManager.engine);
|
||||
renderer.glColor4f(0.75f, 0.0f, 0.0f, 1.0f);
|
||||
renderer.glDrawStringRight(Main.screenSize[0] - 10, 30, "-" + keyevent.toUpperCase() + "-");
|
||||
if (keyevent != "NONE") {
|
||||
fonts[2].use(DisplayManager.display);
|
||||
fonts[2].use(DisplayManager.engine);
|
||||
renderer.glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
renderer.glDrawStringLeft(10, 30, "Key position");
|
||||
renderer.glDrawStringLeft(10, 45, "X: " + keyX + ", Y:" + keyY);
|
||||
renderer.glDrawStringLeft(10, 65, "Key value");
|
||||
renderer.glDrawStringLeft(10, 80, key);
|
||||
}
|
||||
fonts[3].use(DisplayManager.display);
|
||||
fonts[3].use(DisplayManager.engine);
|
||||
renderer.glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (log[i] != null) {
|
||||
@ -53,10 +53,10 @@ public class KeyboardDebugScreen extends Screen {
|
||||
renderer.glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
renderer.glFillColor(-80 + 100 + 200, 90, 5, 5);
|
||||
renderer.glFillColor(-80 + 100, 100, 200, 70);
|
||||
fonts[2].use(DisplayManager.display);
|
||||
fonts[2].use(DisplayManager.engine);
|
||||
renderer.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
renderer.glDrawStringCenter(-80 + 100 + 200 / 2, 100 + 70 / 2 - (renderer.getCurrentFont().getCharacterHeight() / 2), "FROM SERIAL");
|
||||
fonts[3].use(DisplayManager.display);
|
||||
fonts[3].use(DisplayManager.engine);
|
||||
renderer.glColor4f(0.0f, 0.0f, 1.0f, 1.0f);
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (pinsA[i] == 1) {
|
||||
@ -99,10 +99,10 @@ public class KeyboardDebugScreen extends Screen {
|
||||
renderer.glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
renderer.glFillColor(150 + 90, 200, 5, 5);
|
||||
renderer.glFillColor(150 + 100, 100, 200, 70);
|
||||
fonts[2].use(DisplayManager.display);
|
||||
fonts[2].use(DisplayManager.engine);
|
||||
renderer.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
renderer.glDrawStringCenter(150 + 100 + 200 / 2, 100 + 70 / 2 - (renderer.getCurrentFont().getCharacterHeight() / 2), "TO SERIAL");
|
||||
fonts[3].use(DisplayManager.display);
|
||||
fonts[3].use(DisplayManager.engine);
|
||||
renderer.glColor4f(0.0f, 0.0f, 1.0f, 1.0f);
|
||||
for (int i = 15; i >= 8; i--) {
|
||||
if (pinsB[i] == 1) {
|
||||
|
@ -43,31 +43,13 @@ public class LoadingScreen extends Screen {
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
fonts[2].use(DisplayManager.display);
|
||||
DisplayManager.renderer.glClearColor(0xFF000000);
|
||||
DisplayManager.renderer.glClear(DisplayManager.display.getWidth(), DisplayManager.display.getWidth());
|
||||
DisplayManager.renderer.glColor3i(230, 33, 23);
|
||||
DisplayManager.renderer.glDrawStringCenter((Main.screenSize[0] / 2) - 1, (int) ((Main.screenSize[1] / 2) - 25 + loadingTextTranslation), titleString);
|
||||
DisplayManager.renderer.glDrawStringCenter((Main.screenSize[0] / 2) - 2, (int) ((Main.screenSize[1] / 2) - 25 + loadingTextTranslation), titleString);
|
||||
DisplayManager.renderer.glDrawStringCenter((Main.screenSize[0] / 2) + 1, (int) ((Main.screenSize[1] / 2) - 25 + loadingTextTranslation), titleString);
|
||||
DisplayManager.renderer.glDrawStringCenter((Main.screenSize[0] / 2) + 2, (int) ((Main.screenSize[1] / 2) - 25 + loadingTextTranslation), titleString);
|
||||
DisplayManager.renderer.glDrawStringCenter((Main.screenSize[0] / 2), (int) ((Main.screenSize[1] / 2) - 25 - 1 + loadingTextTranslation), titleString);
|
||||
DisplayManager.renderer.glDrawStringCenter((Main.screenSize[0] / 2), (int) ((Main.screenSize[1] / 2) - 25 - 2 + loadingTextTranslation), titleString);
|
||||
DisplayManager.renderer.glDrawStringCenter((Main.screenSize[0] / 2), (int) ((Main.screenSize[1] / 2) - 25 + 1 + loadingTextTranslation), titleString);
|
||||
DisplayManager.renderer.glDrawStringCenter((Main.screenSize[0] / 2), (int) ((Main.screenSize[1] / 2) - 25 + 2 + loadingTextTranslation), titleString);
|
||||
|
||||
DisplayManager.renderer.glDrawStringCenter((Main.screenSize[0] / 2) + 1, (int) ((Main.screenSize[1] / 2) - 25 + 1 + loadingTextTranslation), titleString);
|
||||
DisplayManager.renderer.glDrawStringCenter((Main.screenSize[0] / 2) - 1, (int) ((Main.screenSize[1] / 2) - 25 + 1 + loadingTextTranslation), titleString);
|
||||
DisplayManager.renderer.glDrawStringCenter((Main.screenSize[0] / 2) - 1, (int) ((Main.screenSize[1] / 2) - 25 - 1 + loadingTextTranslation), titleString);
|
||||
DisplayManager.renderer.glDrawStringCenter((Main.screenSize[0] / 2) + 1, (int) ((Main.screenSize[1] / 2) - 25 - 1 + loadingTextTranslation), titleString);
|
||||
DisplayManager.guiSkin.use(DisplayManager.engine);
|
||||
DisplayManager.renderer.glColor3i(255, 255, 255);
|
||||
DisplayManager.renderer.glDrawStringCenter((Main.screenSize[0] / 2), (int) ((Main.screenSize[1] / 2) - 25 + loadingTextTranslation), titleString);
|
||||
DisplayManager.renderer.glColor4f(0.0f, 0.0f, 0.0f, 0.75f);
|
||||
fonts[0].use(DisplayManager.display);
|
||||
DisplayManager.renderer.glDrawStringCenter((Main.screenSize[0] / 2), (Main.screenSize[1] / 2) + 11, "LOADING");
|
||||
fonts[1].use(DisplayManager.display);
|
||||
DisplayManager.renderer.glColor4f(0.0f, 0.0f, 0.0f, 0.5f);
|
||||
DisplayManager.renderer.glDrawStringCenter((Main.screenSize[0] / 2), (Main.screenSize[1] / 2) + 22, "PLEASE WAIT...");
|
||||
DisplayManager.renderer.glFillRect(Main.screenSize[0]/2f-80, Main.screenSize[1]/2f-64, 160, 48, 0, 32, 160, 48);
|
||||
DisplayManager.renderer.glFillRect(Main.screenSize[0]/2f-24, Main.screenSize[1]/2f-loadingTextTranslation, 48, 48, 160, 32, 48, 48);
|
||||
|
||||
DisplayManager.renderer.glFillRect(Main.screenSize[0]-224, Main.screenSize[1]-48, 224, 48, 0, 80, 224, 48);
|
||||
DisplayManager.renderer.glFillRect(Main.screenSize[0]-160-24-224, Main.screenSize[1]-48, 160, 48, 224, 80, 160, 48);
|
||||
|
||||
}
|
||||
|
||||
|
@ -9,12 +9,12 @@ import org.warp.picalculator.Main;
|
||||
import org.warp.picalculator.device.Keyboard;
|
||||
import org.warp.picalculator.device.Keyboard.Key;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.graphicengine.RAWSkin;
|
||||
import org.warp.picalculator.gui.graphicengine.Skin;
|
||||
|
||||
public class MarioScreen extends Screen {
|
||||
|
||||
private RAWSkin skin;
|
||||
private RAWSkin groundskin;
|
||||
private Skin skin;
|
||||
private Skin groundskin;
|
||||
private boolean errored;
|
||||
public float[] marioPos = new float[] { 30, 0 };
|
||||
public float[] marioForces = new float[] { 0, 0 };
|
||||
@ -35,8 +35,8 @@ public class MarioScreen extends Screen {
|
||||
@Override
|
||||
public void init() {
|
||||
try {
|
||||
skin = DisplayManager.display.loadSkin("marioskin.png");
|
||||
groundskin = DisplayManager.display.loadSkin("marioground.png");
|
||||
skin = DisplayManager.engine.loadSkin("marioskin.png");
|
||||
groundskin = DisplayManager.engine.loadSkin("marioground.png");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -125,8 +125,8 @@ public class MarioScreen extends Screen {
|
||||
if (errored) {
|
||||
DisplayManager.renderer.glDrawStringLeft(0, 20, "ERROR");
|
||||
} else {
|
||||
DisplayManager.fonts[0].use(DisplayManager.display);
|
||||
groundskin.use(DisplayManager.display);
|
||||
DisplayManager.fonts[0].use(DisplayManager.engine);
|
||||
groundskin.use(DisplayManager.engine);
|
||||
DisplayManager.renderer.glFillRect(16 * 0, 25 + 25, 16, 16, 0, 0, 16, 16);
|
||||
DisplayManager.renderer.glFillRect(16 * 1, 25 + 25, 16, 16, 0, 0, 16, 16);
|
||||
DisplayManager.renderer.glFillRect(16 * 2, 25 + 25, 16, 16, 0, 0, 16, 16);
|
||||
@ -165,7 +165,7 @@ public class MarioScreen extends Screen {
|
||||
// glDrawStringRight(0, Main.screenSize[1]-glGetCurrentFontHeight(), "G");
|
||||
|
||||
//DRAW MARIO
|
||||
skin.use(DisplayManager.display);
|
||||
skin.use(DisplayManager.engine);
|
||||
DisplayManager.renderer.glFillRect(getPosX() - 18, 25 + getPosY(), 35, 27, 35 * (marioSkinPos[0] + 1), 27 * marioSkinPos[1], 35, 27);
|
||||
// PIDisplay.renderer.glDrawSkin(getPosX() - 18, 25 + getPosY(), 35 * (marioSkinPos[0] + (flipped ? 2 : 1)), 27 * marioSkinPos[1], 35 * (marioSkinPos[0] + (flipped ? 1 : 2)), 27 * (marioSkinPos[1] + 1), true);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.device.Keyboard;
|
||||
import org.warp.picalculator.device.Keyboard.Key;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.graphicengine.RAWFont;
|
||||
import org.warp.picalculator.gui.graphicengine.BinaryFont;
|
||||
import org.warp.picalculator.gui.graphicengine.Renderer;
|
||||
import org.warp.picalculator.math.AngleMode;
|
||||
import org.warp.picalculator.math.Calculator;
|
||||
@ -142,7 +142,7 @@ public class MathInputScreen extends Screen {
|
||||
}
|
||||
}
|
||||
|
||||
private static final RAWFont fontBig = Utils.getFont(false);
|
||||
private static final BinaryFont fontBig = Utils.getFont(false);
|
||||
|
||||
@Override
|
||||
public void renderStatusbar() {
|
||||
@ -161,7 +161,7 @@ public class MathInputScreen extends Screen {
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
fontBig.use(DisplayManager.display);
|
||||
fontBig.use(DisplayManager.engine);
|
||||
final int textColor = 0xFF000000;
|
||||
final int padding = 4;
|
||||
DisplayManager.renderer.glColor(textColor);
|
||||
@ -221,14 +221,14 @@ public class MathInputScreen extends Screen {
|
||||
int bottomSpacing = 0;
|
||||
for (final Function f : calc.f2) {
|
||||
bottomSpacing += f.getHeight() + 2;
|
||||
f.draw(DisplayManager.display.getWidth() - 2 - f.getWidth(), DisplayManager.display.getHeight() - bottomSpacing);
|
||||
f.draw(DisplayManager.engine.getWidth() - 2 - f.getWidth(), DisplayManager.engine.getHeight() - bottomSpacing);
|
||||
}
|
||||
if (calc.resultsCount > 1 && calc.resultsCount != calc.f2.size()) {
|
||||
final String resultsCountText = calc.resultsCount + " total results".toUpperCase();
|
||||
DisplayManager.renderer.glColor(0xFF9AAEA0);
|
||||
Utils.getFont(true).use(DisplayManager.display);
|
||||
Utils.getFont(true).use(DisplayManager.engine);
|
||||
bottomSpacing += fontBig.getCharacterHeight() + 2;
|
||||
DisplayManager.renderer.glDrawStringRight(DisplayManager.display.getWidth() - 2, DisplayManager.display.getHeight() - bottomSpacing, resultsCountText);
|
||||
DisplayManager.renderer.glDrawStringRight(DisplayManager.engine.getWidth() - 2, DisplayManager.engine.getHeight() - bottomSpacing, resultsCountText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import java.util.ArrayList;
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUDisplay;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUEngine;
|
||||
import org.warp.picalculator.math.Calculator;
|
||||
|
||||
import com.rits.cloning.Cloner;
|
||||
@ -83,7 +83,7 @@ public abstract class AnteriorFunction implements Function {
|
||||
variable.setSmall(small);
|
||||
variable.generateGraphics();
|
||||
|
||||
width = DisplayManager.renderer.glGetStringWidth(Utils.getFont(small), getSymbol()) + 1 + getVariable().getWidth();
|
||||
width = Utils.getFont(small).getStringWidth(getSymbol()) + 1 + getVariable().getWidth();
|
||||
height = variable.getHeight();
|
||||
line = variable.getLine();
|
||||
}
|
||||
@ -91,10 +91,10 @@ public abstract class AnteriorFunction implements Function {
|
||||
@Override
|
||||
public void draw(int x, int y) {
|
||||
final float h1 = getVariable().getHeight();
|
||||
final int wsegno = DisplayManager.renderer.glGetStringWidth(Utils.getFont(small), getSymbol());
|
||||
final int wsegno = Utils.getFont(small).getStringWidth(getSymbol());
|
||||
final float hsegno = Utils.getFontHeight(small);
|
||||
final float maxh = getHeight();
|
||||
DisplayManager.renderer.glSetFont(Utils.getFont(small));
|
||||
Utils.getFont(small).use(DisplayManager.engine);
|
||||
|
||||
DisplayManager.renderer.glDrawStringLeft(x, (int) Math.floor(y + (maxh - hsegno) / 2), getSymbol());
|
||||
getVariable().draw(x + wsegno + 1, (int) Math.floor(y + (maxh - h1) / 2));
|
||||
|
@ -5,7 +5,7 @@ import java.util.ArrayList;
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUDisplay;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUEngine;
|
||||
import org.warp.picalculator.math.Calculator;
|
||||
import org.warp.picalculator.math.MathematicalSymbols;
|
||||
import org.warp.picalculator.math.rules.FractionsRule1;
|
||||
@ -112,7 +112,7 @@ public class Division extends FunctionTwoValues {
|
||||
}
|
||||
int w1 = 0;
|
||||
int h1 = 0;
|
||||
Utils.getFont(small).use(DisplayManager.display);
|
||||
Utils.getFont(small).use(DisplayManager.engine);
|
||||
if (minus) {
|
||||
w1 = Utils.getFont(small).getStringWidth(numerator);
|
||||
h1 = Utils.getFont(small).getCharacterHeight();
|
||||
|
@ -5,7 +5,7 @@ import java.util.List;
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUDisplay;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUEngine;
|
||||
import org.warp.picalculator.math.Calculator;
|
||||
|
||||
public class EmptyNumber implements Function {
|
||||
@ -44,17 +44,17 @@ public class EmptyNumber implements Function {
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return DisplayManager.renderer.glGetStringWidth(Utils.getFont(small), "␀");
|
||||
return Utils.getFont(small).getStringWidth("␀");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return Utils.getFont(small).charH;
|
||||
return Utils.getFont(small).getCharacterHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLine() {
|
||||
return Utils.getFont(small).charH / 2;
|
||||
return Utils.getFont(small).getCharacterHeight() / 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -5,7 +5,7 @@ import java.util.ArrayList;
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUDisplay;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUEngine;
|
||||
import org.warp.picalculator.math.Calculator;
|
||||
|
||||
import com.rits.cloning.Cloner;
|
||||
@ -112,7 +112,7 @@ public abstract class FunctionTwoValues implements Function {
|
||||
variable1.draw(dx + x, ln - variable1.getLine() + y);
|
||||
dx += 1 + variable1.getWidth();
|
||||
if (drawSignum()) {
|
||||
Utils.getFont(small).use(DisplayManager.display);
|
||||
Utils.getFont(small).use(DisplayManager.engine);
|
||||
DisplayManager.renderer.glDrawStringLeft(dx + x, ln - Utils.getFontHeight(small) / 2 + y, getSymbol());
|
||||
dx += Utils.getFont(small).getStringWidth(getSymbol());
|
||||
}
|
||||
|
@ -5,8 +5,8 @@ import java.util.List;
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.graphicengine.RAWFont;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUDisplay;
|
||||
import org.warp.picalculator.gui.graphicengine.BinaryFont;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUEngine;
|
||||
import org.warp.picalculator.math.Calculator;
|
||||
|
||||
public class Joke implements Function {
|
||||
@ -46,31 +46,31 @@ public class Joke implements Function {
|
||||
|
||||
@Override
|
||||
public void draw(int x, int y) {
|
||||
final RAWFont rf = DisplayManager.renderer.getCurrentFont();
|
||||
final BinaryFont rf = DisplayManager.renderer.getCurrentFont();
|
||||
if (jokesFont[joke] >= 0) {
|
||||
DisplayManager.renderer.glSetFont(DisplayManager.fonts[jokesFont[joke]]);
|
||||
DisplayManager.fonts[jokesFont[joke]].use(DisplayManager.engine);
|
||||
}
|
||||
DisplayManager.renderer.glDrawStringLeft(x, y, jokes[joke]);
|
||||
if (jokesFont[joke] >= 0) {
|
||||
DisplayManager.renderer.glSetFont(rf);
|
||||
rf.use(DisplayManager.engine);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
if (jokesFont[joke] >= 0) {
|
||||
return DisplayManager.renderer.glGetStringWidth(DisplayManager.fonts[jokesFont[joke]], jokes[joke]);
|
||||
return DisplayManager.fonts[jokesFont[joke]].getStringWidth(jokes[joke]);
|
||||
} else {
|
||||
return DisplayManager.renderer.glGetStringWidth(Utils.getFont(small), jokes[joke]);
|
||||
return Utils.getFont(small).getStringWidth(jokes[joke]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
if (jokesFont[joke] >= 0) {
|
||||
return DisplayManager.fonts[jokesFont[joke]].charH;
|
||||
return DisplayManager.fonts[jokesFont[joke]].getCharacterHeight();
|
||||
} else {
|
||||
return Utils.getFont(small).charH;
|
||||
return Utils.getFont(small).getCharacterHeight();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.Errors;
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUDisplay;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUEngine;
|
||||
import org.warp.picalculator.math.Calculator;
|
||||
import org.warp.picalculator.math.MathematicalSymbols;
|
||||
import org.warp.picalculator.math.rules.ExpandRule1;
|
||||
@ -34,7 +34,7 @@ public class Negative extends AnteriorFunction {
|
||||
variable.generateGraphics();
|
||||
|
||||
height = getVariable().getHeight();
|
||||
width = DisplayManager.renderer.glGetStringWidth(Utils.getFont(small), "-") + getVariable().getWidth();
|
||||
width = Utils.getFont(small).getCharacterWidth() /* Width of - */ + getVariable().getWidth();
|
||||
line = getVariable().getLine();
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ import org.nevec.rjm.BigDecimalMath;
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.graphicengine.RAWFont;
|
||||
import org.warp.picalculator.gui.graphicengine.BinaryFont;
|
||||
import org.warp.picalculator.math.Calculator;
|
||||
|
||||
import com.rits.cloning.Cloner;
|
||||
@ -130,7 +130,7 @@ public class Number implements Function {
|
||||
|
||||
@Override
|
||||
public void draw(int x, int y) {
|
||||
Utils.getFont(small).use(DisplayManager.display);
|
||||
Utils.getFont(small).use(DisplayManager.engine);
|
||||
String t = toString();
|
||||
|
||||
if (t.startsWith("-")) {
|
||||
@ -141,12 +141,12 @@ public class Number implements Function {
|
||||
}
|
||||
}
|
||||
if (t.contains("ℯ℮")) {
|
||||
final RAWFont defaultf = Utils.getFont(small);
|
||||
final RAWFont smallf = Utils.getFont(true);
|
||||
final BinaryFont defaultf = Utils.getFont(small);
|
||||
final BinaryFont smallf = Utils.getFont(true);
|
||||
final String s = t.substring(0, t.indexOf("ℯ℮") + 2);
|
||||
final int sw = defaultf.getStringWidth(s);
|
||||
DisplayManager.renderer.glDrawStringLeft(x + 1, y + smallf.getCharacterHeight() - 2, s);
|
||||
smallf.use(DisplayManager.display);
|
||||
smallf.use(DisplayManager.engine);
|
||||
DisplayManager.renderer.glDrawStringLeft(x + 1 + sw - 3, y, t.substring(t.indexOf("ℯ℮") + 2));
|
||||
} else {
|
||||
DisplayManager.renderer.glDrawStringLeft(x + 1, y, t);
|
||||
@ -191,8 +191,8 @@ public class Number implements Function {
|
||||
}
|
||||
}
|
||||
if (t.contains("ℯ℮")) {
|
||||
final RAWFont defaultf = Utils.getFont(small);
|
||||
final RAWFont smallf = Utils.getFont(true);
|
||||
final BinaryFont defaultf = Utils.getFont(small);
|
||||
final BinaryFont smallf = Utils.getFont(true);
|
||||
final String s = t.substring(0, t.indexOf("ℯ℮") + 2);
|
||||
final int sw = defaultf.getStringWidth(s);
|
||||
return 1 + sw - 3 + smallf.getStringWidth(t.substring(t.indexOf("ℯ℮") + 2));
|
||||
|
@ -98,7 +98,9 @@ public class Root extends FunctionTwoValues {
|
||||
getVariable1().draw(x + 1, y);
|
||||
getVariable2().draw(x + 1 + w2 + 2, y + h2 - 2);
|
||||
|
||||
DisplayManager.renderer.glDrawLine(x + 1 + w2 - 2, y + height - 3, x + 1 + w2, y + height);
|
||||
DisplayManager.renderer.glDrawLine(x + 1 + w2 - 2, y + height - 2, x + 1 + w2 - 2, y + height - 2);
|
||||
DisplayManager.renderer.glDrawLine(x + 1 + w2 - 1, y + height - 1, x + 1 + w2 - 1, y + height - 1);
|
||||
DisplayManager.renderer.glDrawLine(x + 1 + w2 - 0, y + height - 0, x + 1 + w2 - 0, y + height - 0);
|
||||
DisplayManager.renderer.glDrawLine(x + 1 + w2, y + height - 1 - hh, x + 1 + w2, y + height - 1);
|
||||
DisplayManager.renderer.glDrawLine(x + 1 + w2 + 1, y + height - 2 - h1, x + 1 + w2 + 1, y + height - 1 - hh - 1);
|
||||
DisplayManager.renderer.glDrawLine(x + 1 + w2 + 1, y + height - h1 - 2, x + 1 + w2 + 2 + w1 + 1, y + height - h1 - 2);
|
||||
|
@ -129,7 +129,7 @@ public class Sum extends FunctionTwoValues {
|
||||
int dx = 0;
|
||||
dx += variable1.getWidth();
|
||||
dx += 1;
|
||||
dx += DisplayManager.renderer.glGetStringWidth(Utils.getFont(small), getSymbol());
|
||||
dx += Utils.getFont(small).getStringWidth(getSymbol());
|
||||
return dx += variable2.getWidth();
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.Errors;
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUDisplay;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUEngine;
|
||||
import org.warp.picalculator.math.Calculator;
|
||||
import org.warp.picalculator.math.MathematicalSymbols;
|
||||
import org.warp.picalculator.math.rules.ExpandRule1;
|
||||
@ -94,10 +94,10 @@ public class SumSubtraction extends FunctionTwoValues {
|
||||
int dx = 0;
|
||||
variable1.draw(dx + x, ln - variable1.getLine() + y);
|
||||
dx += variable1.getWidth();
|
||||
DisplayManager.renderer.glSetFont(Utils.getFont(small));
|
||||
Utils.getFont(small).use(DisplayManager.engine);
|
||||
dx += 1;
|
||||
DisplayManager.renderer.glDrawStringLeft(dx + x, ln - Utils.getFontHeight(small) / 2 + y, getSymbol());
|
||||
dx += DisplayManager.renderer.glGetStringWidth(Utils.getFont(small), getSymbol());
|
||||
dx += Utils.getFont(small).getStringWidth(getSymbol());
|
||||
variable2.draw(dx + x, ln - variable2.getLine() + y);
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ public class SumSubtraction extends FunctionTwoValues {
|
||||
int dx = 0;
|
||||
dx += variable1.getWidth();
|
||||
dx += 1;
|
||||
dx += DisplayManager.renderer.glGetStringWidth(Utils.getFont(small), getSymbol());
|
||||
dx += Utils.getFont(small).getStringWidth(getSymbol());
|
||||
return dx += variable2.getWidth();
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.util.List;
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.Utils;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUDisplay;
|
||||
import org.warp.picalculator.gui.graphicengine.cpu.CPUEngine;
|
||||
import org.warp.picalculator.math.Calculator;
|
||||
|
||||
public class Undefined implements Function {
|
||||
@ -36,14 +36,14 @@ public class Undefined implements Function {
|
||||
|
||||
@Override
|
||||
public void generateGraphics() {
|
||||
width = DisplayManager.renderer.glGetStringWidth(Utils.getFont(small), "UNDEFINED");
|
||||
width = Utils.getFont(small).getStringWidth("UNDEFINED");
|
||||
height = Utils.getFontHeight(small);
|
||||
line = height / 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int x, int y) {
|
||||
DisplayManager.renderer.glSetFont(Utils.getFont(small));
|
||||
Utils.getFont(small).use(DisplayManager.engine);
|
||||
DisplayManager.renderer.glDrawStringLeft(x, y, "UNDEFINED");
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class Variable implements Function {
|
||||
|
||||
@Override
|
||||
public void draw(int x, int y) {
|
||||
Utils.getFont(small).use(DisplayManager.display);
|
||||
Utils.getFont(small).use(DisplayManager.engine);
|
||||
DisplayManager.renderer.glDrawStringLeft(x + 1, y, toString());
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.warp.picalculator.Error;
|
||||
import org.warp.picalculator.gui.DisplayManager;
|
||||
import org.warp.picalculator.math.Calculator;
|
||||
import org.warp.picalculator.math.MathematicalSymbols;
|
||||
import org.warp.picalculator.math.functions.AnteriorFunction;
|
||||
@ -17,7 +18,7 @@ public class EquationsSystemPart extends AnteriorFunction {
|
||||
|
||||
@Override
|
||||
protected Function NewInstance(Calculator root, Function value) {
|
||||
return new EquationsSystemPart(root, value);
|
||||
return new EquationsSystemPart(root, (Equation) value);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -42,13 +43,13 @@ public class EquationsSystemPart extends AnteriorFunction {
|
||||
final int spazioSotto = (h - 3 - 2) / 2 + paddingTop;
|
||||
final int spazioSopra = h - spazioSotto;
|
||||
variable.draw(x + 5, y + paddingTop);
|
||||
glDrawLine(x + 2, y + 0, x + 3, y + 0);
|
||||
glDrawLine(x + 1, y + 1, x + 1, y + spazioSotto / 2);
|
||||
glDrawLine(x + 2, y + spazioSotto / 2 + 1, x + 2, y + spazioSotto - 1);
|
||||
glDrawLine(x + 0, y + spazioSotto, x + 1, y + spazioSotto);
|
||||
glDrawLine(x + 2, y + spazioSotto + 1, x + 2, y + spazioSotto + spazioSopra / 2 - 1);
|
||||
glDrawLine(x + 1, y + spazioSotto + spazioSopra / 2, x + 1, y + h - 1);
|
||||
glDrawLine(x + 2, y + h, x + 3, y + h);
|
||||
DisplayManager.renderer.glDrawLine(x + 2, y + 0, x + 3, y + 0);
|
||||
DisplayManager.renderer.glDrawLine(x + 1, y + 1, x + 1, y + spazioSotto / 2);
|
||||
DisplayManager.renderer.glDrawLine(x + 2, y + spazioSotto / 2 + 1, x + 2, y + spazioSotto - 1);
|
||||
DisplayManager.renderer.glDrawLine(x + 0, y + spazioSotto, x + 1, y + spazioSotto);
|
||||
DisplayManager.renderer.glDrawLine(x + 2, y + spazioSotto + 1, x + 2, y + spazioSotto + spazioSopra / 2 - 1);
|
||||
DisplayManager.renderer.glDrawLine(x + 1, y + spazioSotto + spazioSopra / 2, x + 1, y + h - 1);
|
||||
DisplayManager.renderer.glDrawLine(x + 2, y + h, x + 3, y + h);
|
||||
}
|
||||
|
||||
@Override
|
||||
|