Disabled debug mode for TeaVM
This commit is contained in:
parent
3808613a58
commit
5e5a09ad83
@ -89,12 +89,17 @@ public class Engine {
|
||||
}
|
||||
Engine.platform.getConsoleUtils().out().println(ConsoleUtils.OUTPUTLEVEL_DEBUG_MIN, args);
|
||||
checkDeviceType();
|
||||
if (Engine.getPlatform().isRunningOnRaspberry() && args.isRaspberryModeAllowed()) {
|
||||
if (args.isRaspberryModeAllowed() == false) {
|
||||
Engine.getPlatform().setRunningOnRaspberry(false);
|
||||
}
|
||||
if (Engine.getPlatform().isRunningOnRaspberry()) {
|
||||
Engine.getPlatform().getGpio().wiringPiSetupPhys();
|
||||
Engine.getPlatform().getGpio().pinMode(12, Engine.getPlatform().getGpio().valuePwmOutput());
|
||||
} else {
|
||||
StaticVars.screenPos = new int[] { 0, 0 };
|
||||
Engine.getPlatform().getSettings().setDebugEnabled(true);
|
||||
if (Engine.getPlatform().isJavascript() == false) {
|
||||
Engine.getPlatform().getSettings().setDebugEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,8 @@ public interface Platform {
|
||||
|
||||
boolean isJavascript();
|
||||
|
||||
void setRunningOnRaspberry(boolean b);
|
||||
|
||||
boolean isRunningOnRaspberry();
|
||||
|
||||
String getOsName();
|
||||
|
@ -12,6 +12,7 @@ import it.cavallium.warppi.event.KeyPressedEvent;
|
||||
import it.cavallium.warppi.event.KeyReleasedEvent;
|
||||
import it.cavallium.warppi.event.KeyboardEventListener;
|
||||
import it.cavallium.warppi.extra.mario.MarioScreen;
|
||||
import it.cavallium.warppi.extra.tetris.TetrisScreen;
|
||||
import it.cavallium.warppi.gui.GUIErrorMessage;
|
||||
import it.cavallium.warppi.gui.screens.KeyboardDebugScreen;
|
||||
import it.cavallium.warppi.gui.screens.Screen;
|
||||
@ -41,15 +42,15 @@ public class Keyboard {
|
||||
|
||||
public synchronized void startKeyboard() {
|
||||
final Thread kt = new Thread(() -> {
|
||||
if (Engine.getPlatform().getSettings().isDebugEnabled()) {
|
||||
if (Engine.getPlatform().isRunningOnRaspberry() == false) {
|
||||
try {
|
||||
while (true) {
|
||||
if (Keyboard.debugKeyCode != -1) {
|
||||
Keyboard.debugKeyPressed(Keyboard.debugKeyCode);
|
||||
Keyboard.debugKey(Keyboard.debugKeyCode, false);
|
||||
Keyboard.debugKeyCode = -1;
|
||||
}
|
||||
if (Keyboard.debugKeyCodeRelease != -1) {
|
||||
Keyboard.debugKeyReleased(Keyboard.debugKeyCodeRelease);
|
||||
Keyboard.debugKey(Keyboard.debugKeyCodeRelease, true);
|
||||
Keyboard.debugKeyCodeRelease = -1;
|
||||
}
|
||||
Thread.sleep(50);
|
||||
@ -88,9 +89,9 @@ public class Keyboard {
|
||||
if (data[row] == true && Keyboard.precedentStates[row][col] == false) {
|
||||
// System.out.println("Pressed button at " + (row + 1) + ", " + (col + 1));
|
||||
// KeyboardDebugScreen.log("Pressed button at " + (row + 1) + ", " + (col + 1));
|
||||
Keyboard.keyPressedRaw(row, col);
|
||||
Keyboard.keyRaw(row, col, false);
|
||||
} else if (data[row] == false && Keyboard.precedentStates[row][col] == true) {
|
||||
Keyboard.keyReleasedRaw(row, col);
|
||||
Keyboard.keyRaw(row, col, true);
|
||||
}
|
||||
// KeyboardDebugScreen.log("Released button at " + (row + 1) + ", " + (col + 1));
|
||||
Keyboard.precedentStates[row][col] = data[row];
|
||||
@ -105,123 +106,141 @@ public class Keyboard {
|
||||
kt.start();
|
||||
}
|
||||
|
||||
public static void debugKeyPressed(final int keyCode) {
|
||||
/**
|
||||
*
|
||||
* @param k
|
||||
* @param released true: released, false: pressed
|
||||
*/
|
||||
private static void debugKey(Key k, boolean released) {
|
||||
if (released) {
|
||||
Keyboard.keyReleased(k);
|
||||
} else {
|
||||
Keyboard.keyPressed(k);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param keyCode
|
||||
* @param released true: released, false: pressed
|
||||
*/
|
||||
public static void debugKey(final int keyCode, boolean released) {
|
||||
switch (keyCode) {
|
||||
case KeyEvent.VK_ESCAPE:
|
||||
Keyboard.keyPressed(Key.BACK);
|
||||
debugKey(Key.BACK, released);
|
||||
break;
|
||||
case KeyEvent.VK_S:
|
||||
if (Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.ARCSINE);
|
||||
debugKey(Key.ARCSINE, released);
|
||||
} else if (Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.LETTER_S);
|
||||
debugKey(Key.LETTER_S, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.SINE);
|
||||
debugKey(Key.SINE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_C:
|
||||
if (Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.ARCCOSINE);
|
||||
debugKey(Key.ARCCOSINE, released);
|
||||
} else if (Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.LETTER_C);
|
||||
debugKey(Key.LETTER_C, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.COSINE);
|
||||
debugKey(Key.COSINE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_T:
|
||||
if (Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.ARCTANGENT);
|
||||
debugKey(Key.ARCTANGENT, released);
|
||||
} else if (Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.LETTER_T);
|
||||
debugKey(Key.LETTER_T, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.TANGENT);
|
||||
debugKey(Key.TANGENT, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_D:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.debug_DEG);
|
||||
debugKey(Key.debug_DEG, released);
|
||||
} else if (Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.LETTER_D);
|
||||
debugKey(Key.LETTER_D, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_R:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.debug_RAD);
|
||||
debugKey(Key.debug_RAD, released);
|
||||
} else if (Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.LETTER_R);
|
||||
debugKey(Key.LETTER_R, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_G:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.debug_GRA);
|
||||
debugKey(Key.debug_GRA, released);
|
||||
} else if (Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.LETTER_G);
|
||||
debugKey(Key.LETTER_G, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_X:
|
||||
if (Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.LETTER_X);
|
||||
debugKey(Key.LETTER_X, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_P:
|
||||
if (Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else if (Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.LETTER_P);
|
||||
debugKey(Key.LETTER_P, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.PI);
|
||||
debugKey(Key.PI, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_E:
|
||||
if (Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else if (Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.LETTER_E);
|
||||
debugKey(Key.LETTER_E, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.EULER_NUMBER);
|
||||
debugKey(Key.EULER_NUMBER, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_Y:
|
||||
if (Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.LETTER_Y);
|
||||
debugKey(Key.LETTER_Y, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_B:
|
||||
if (Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.BRIGHTNESS_CYCLE_REVERSE);
|
||||
debugKey(Key.BRIGHTNESS_CYCLE_REVERSE, released);
|
||||
} else if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.BRIGHTNESS_CYCLE);
|
||||
debugKey(Key.BRIGHTNESS_CYCLE, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.LETTER_B);
|
||||
debugKey(Key.LETTER_B, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_L:
|
||||
if (Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.LOGARITHM);
|
||||
debugKey(Key.LOGARITHM, released);
|
||||
} else if (Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.LETTER_L);
|
||||
debugKey(Key.LETTER_L, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.LOGARITHM);
|
||||
debugKey(Key.LOGARITHM, released);
|
||||
}
|
||||
break;
|
||||
case KeyboardJogampValues.VK_ENTER:
|
||||
case KeyEvent.VK_ENTER:
|
||||
if (Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.STEP);
|
||||
debugKey(Key.STEP, released);
|
||||
} else if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.SIMPLIFY);
|
||||
debugKey(Key.SIMPLIFY, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
int row = 2;
|
||||
int col = 1;
|
||||
@ -229,134 +248,134 @@ public class Keyboard {
|
||||
break;
|
||||
case KeyEvent.VK_1:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NUM1);
|
||||
debugKey(Key.NUM1, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_2:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NUM2);
|
||||
debugKey(Key.NUM2, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_3:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NUM3);
|
||||
debugKey(Key.NUM3, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_4:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NUM4);
|
||||
debugKey(Key.NUM4, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_5:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NUM5);
|
||||
debugKey(Key.NUM5, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_6:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NUM6);
|
||||
debugKey(Key.NUM6, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_7:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NUM7);
|
||||
debugKey(Key.NUM7, released);
|
||||
} else if (Keyboard.shift) {
|
||||
if (Engine.getPlatform().getSettings().isDebugEnabled()) {
|
||||
Keyboard.keyPressed(Key.DIVIDE);
|
||||
if (Engine.getPlatform().isRunningOnRaspberry() == false) {
|
||||
debugKey(Key.DIVIDE, released);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_8:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NUM8);
|
||||
debugKey(Key.NUM8, released);
|
||||
} else if (Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.PARENTHESIS_OPEN);
|
||||
debugKey(Key.PARENTHESIS_OPEN, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_9:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NUM9);
|
||||
debugKey(Key.NUM9, released);
|
||||
} else if (Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.PARENTHESIS_CLOSE);
|
||||
debugKey(Key.PARENTHESIS_CLOSE, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_0:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NUM0);
|
||||
debugKey(Key.NUM0, released);
|
||||
} else if (Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.EQUAL);
|
||||
debugKey(Key.EQUAL, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_M:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.SURD_MODE);
|
||||
debugKey(Key.SURD_MODE, released);
|
||||
} else if (Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.LETTER_M);
|
||||
debugKey(Key.LETTER_M, released);
|
||||
}
|
||||
break;
|
||||
case KeyboardJogampValues.VK_ADD:
|
||||
case KeyEvent.VK_ADD:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.PLUS);
|
||||
debugKey(Key.PLUS, released);
|
||||
} else if (Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.PLUS_MINUS);
|
||||
debugKey(Key.PLUS_MINUS, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyboardJogampValues.VK_SUBTRACT:
|
||||
case KeyEvent.VK_SUBTRACT:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.MINUS);
|
||||
debugKey(Key.MINUS, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyboardJogampValues.VK_MULTIPLY:
|
||||
case KeyEvent.VK_MULTIPLY:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.MULTIPLY);
|
||||
debugKey(Key.MULTIPLY, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyboardJogampValues.VK_DIVIDE:
|
||||
case KeyEvent.VK_DIVIDE:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.DIVIDE);
|
||||
debugKey(Key.DIVIDE, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_BACK_SPACE:
|
||||
Keyboard.keyPressed(Key.DELETE);
|
||||
debugKey(Key.DELETE, released);
|
||||
break;
|
||||
case KeyboardJogampValues.VK_DELETE:
|
||||
case KeyEvent.VK_DELETE:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.RESET);
|
||||
debugKey(Key.RESET, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyboardJogampValues.VK_LEFT:
|
||||
@ -366,9 +385,9 @@ public class Keyboard {
|
||||
col = 3;
|
||||
Keyboard.debugKeysDown[row - 1][col - 1] = true;
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.LEFT);
|
||||
debugKey(Key.LEFT, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyboardJogampValues.VK_RIGHT:
|
||||
@ -378,9 +397,9 @@ public class Keyboard {
|
||||
col = 5;
|
||||
Keyboard.debugKeysDown[row - 1][col - 1] = true;
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.RIGHT);
|
||||
debugKey(Key.RIGHT, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyboardJogampValues.VK_UP:
|
||||
@ -390,9 +409,9 @@ public class Keyboard {
|
||||
col = 4;
|
||||
Keyboard.debugKeysDown[row - 1][col - 1] = true;
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.UP);
|
||||
debugKey(Key.UP, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyboardJogampValues.VK_DOWN:
|
||||
@ -402,9 +421,9 @@ public class Keyboard {
|
||||
col = 4;
|
||||
Keyboard.debugKeysDown[row - 1][col - 1] = true;
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.DOWN);
|
||||
debugKey(Key.DOWN, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case (short) 12:
|
||||
@ -413,199 +432,199 @@ public class Keyboard {
|
||||
col = 4;
|
||||
Keyboard.debugKeysDown[row - 1][col - 1] = true;
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.OK);
|
||||
debugKey(Key.OK, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyboardJogampValues.VK_NUMPAD4:
|
||||
case KeyEvent.VK_NUMPAD4:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.HISTORY_BACK);
|
||||
debugKey(Key.HISTORY_BACK, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyboardJogampValues.VK_NUMPAD6:
|
||||
case KeyEvent.VK_NUMPAD6:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.HISTORY_FORWARD);
|
||||
debugKey(Key.HISTORY_FORWARD, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_PERIOD:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.DOT);
|
||||
debugKey(Key.DOT, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_A:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else if (Keyboard.alpha && !Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.LETTER_A);
|
||||
debugKey(Key.LETTER_A, released);
|
||||
} else if (Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_F:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else if (Keyboard.alpha && !Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.LETTER_F);
|
||||
debugKey(Key.LETTER_F, released);
|
||||
} else if (Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_H:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else if (Keyboard.alpha && !Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.LETTER_H);
|
||||
debugKey(Key.LETTER_H, released);
|
||||
} else if (Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_I:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else if (Keyboard.alpha && !Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.LETTER_I);
|
||||
debugKey(Key.LETTER_I, released);
|
||||
} else if (Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_J:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else if (Keyboard.alpha && !Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.LETTER_J);
|
||||
debugKey(Key.LETTER_J, released);
|
||||
} else if (Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_K:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else if (Keyboard.alpha && !Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.LETTER_K);
|
||||
debugKey(Key.LETTER_K, released);
|
||||
} else if (Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_N:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else if (Keyboard.alpha && !Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.LETTER_N);
|
||||
debugKey(Key.LETTER_N, released);
|
||||
} else if (Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_O:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else if (Keyboard.alpha && !Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.LETTER_O);
|
||||
debugKey(Key.LETTER_O, released);
|
||||
} else if (Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_Q:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else if (Keyboard.alpha && !Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.LETTER_Q);
|
||||
debugKey(Key.LETTER_Q, released);
|
||||
} else if (Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_U:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else if (Keyboard.alpha && !Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.LETTER_U);
|
||||
debugKey(Key.LETTER_U, released);
|
||||
} else if (Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_V:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else if (Keyboard.alpha && !Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.LETTER_V);
|
||||
debugKey(Key.LETTER_V, released);
|
||||
} else if (Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_W:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else if (Keyboard.alpha && !Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.LETTER_W);
|
||||
debugKey(Key.LETTER_W, released);
|
||||
} else if (Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_Z:
|
||||
if (!Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
} else if (Keyboard.alpha && !Keyboard.shift) {
|
||||
Keyboard.keyPressed(Key.LETTER_Z);
|
||||
debugKey(Key.LETTER_Z, released);
|
||||
} else if (Keyboard.shift && !Keyboard.alpha) {
|
||||
Keyboard.keyPressed(Key.ZOOM_MODE);
|
||||
debugKey(Key.ZOOM_MODE, released);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
debugKey(Key.NONE, released);
|
||||
}
|
||||
break;
|
||||
case KeyboardJogampValues.VK_SHIFT:
|
||||
case KeyEvent.VK_SHIFT:
|
||||
Keyboard.keyPressed(Key.SHIFT);
|
||||
debugKey(Key.SHIFT, released);
|
||||
break;
|
||||
case KeyEvent.VK_CONTROL:
|
||||
Keyboard.keyPressed(Key.ALPHA);
|
||||
debugKey(Key.ALPHA, released);
|
||||
break;
|
||||
case KeyboardJogampValues.VK_NUMPAD1:
|
||||
case KeyEvent.VK_NUMPAD1:
|
||||
Keyboard.keyPressed(Key.SQRT);
|
||||
debugKey(Key.SQRT, released);
|
||||
break;
|
||||
case KeyboardJogampValues.VK_NUMPAD2:
|
||||
case KeyEvent.VK_NUMPAD2:
|
||||
Keyboard.keyPressed(Key.ROOT);
|
||||
debugKey(Key.ROOT, released);
|
||||
break;
|
||||
case KeyboardJogampValues.VK_NUMPAD3:
|
||||
case KeyEvent.VK_NUMPAD3:
|
||||
Keyboard.keyPressed(Key.POWER_OF_2);
|
||||
debugKey(Key.POWER_OF_2, released);
|
||||
break;
|
||||
case KeyboardJogampValues.VK_NUMPAD5:
|
||||
case KeyEvent.VK_NUMPAD5:
|
||||
Keyboard.keyPressed(Key.POWER_OF_x);
|
||||
debugKey(Key.POWER_OF_x, released);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -655,22 +674,21 @@ public class Keyboard {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param row
|
||||
* @param col
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean isKeyDown(final int row, final int col) {
|
||||
if (Engine.getPlatform().getSettings().isDebugEnabled() == false) {
|
||||
if (Engine.getPlatform().isRunningOnRaspberry()) {
|
||||
return Keyboard.precedentStates[row - 1][col - 1];
|
||||
} else {
|
||||
return Keyboard.debugKeysDown[row - 1][col - 1];
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized static void keyReleasedRaw(final int row, final int col) {
|
||||
// KeyboardDebugScreen.keyX = row;
|
||||
// KeyboardDebugScreen.keyY = col;
|
||||
if (row == 1 && col == 1) {
|
||||
//keyReleased(Key.BRIGHTNESS_CYCLE);
|
||||
}
|
||||
}
|
||||
|
||||
static final String[][][] KeyLabelsMap = /* [ROW, COLUMN, (0:normal 1:shift 2:alpha)] */
|
||||
{ { /* ROW 0 */
|
||||
{ "⇪", "⇪", null }, /* 0,0 */
|
||||
@ -687,8 +705,8 @@ public class Keyboard {
|
||||
{ "⇦", null, null }, /* 1,2 */
|
||||
{ "OK", null, null }, /* 1,3 */
|
||||
{ "⇨", null, null }, /* 1,4 */
|
||||
{ "↤", null, null }, /* 1,5 */
|
||||
{ "↦", null, null }, /* 1,6 */
|
||||
{ "≪", null, null }, /* 1,5 */
|
||||
{ "≫", null, null }, /* 1,6 */
|
||||
{ "", null, null } /* 1,7 */
|
||||
}, { /* ROW 2 */
|
||||
{ "", null, null }, /* 2,0 */
|
||||
@ -850,19 +868,33 @@ public class Keyboard {
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized void keyPressedRaw(final int row, final int col) {
|
||||
/**
|
||||
*
|
||||
* @param row
|
||||
* @param col
|
||||
* @param released true: released, false: pressed
|
||||
*/
|
||||
public static synchronized void keyRaw(final int row, final int col, final boolean released) {
|
||||
// KeyboardDebugScreen.keyX = row;
|
||||
// KeyboardDebugScreen.keyY = col;
|
||||
final Key k = Keyboard.keyMap[row][col][Keyboard.shift ? 1 : Keyboard.alpha ? 2 : 0];
|
||||
if (k != null) {
|
||||
Keyboard.keyPressed(k);
|
||||
if (released) {
|
||||
Keyboard.keyReleased(k);
|
||||
} else {
|
||||
Keyboard.keyPressed(k);
|
||||
}
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
if (released) {
|
||||
Keyboard.keyReleased(Key.NONE);
|
||||
} else {
|
||||
Keyboard.keyPressed(Key.NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void stopKeyboard() {
|
||||
if (Engine.getPlatform().getSettings().isDebugEnabled() == false) {
|
||||
if (Engine.getPlatform().isRunningOnRaspberry()) {
|
||||
Engine.getPlatform().getGpio().digitalWrite(33, false);
|
||||
Engine.getPlatform().getGpio().digitalWrite(35, false);
|
||||
Engine.getPlatform().getGpio().digitalWrite(36, false);
|
||||
@ -900,6 +932,7 @@ public class Keyboard {
|
||||
case NONE:
|
||||
break;
|
||||
case BRIGHTNESS_CYCLE:
|
||||
Engine.INSTANCE.getHardwareDevice().getDisplayManager().setScreen(new TetrisScreen()); //TODO: rimuovere: prova
|
||||
Engine.INSTANCE.getHardwareDevice().getDisplayManager().cycleBrightness(false);
|
||||
refresh = true;
|
||||
break;
|
||||
|
@ -13,7 +13,7 @@ public class PIHardwareDisplay implements HardwareDisplay {
|
||||
|
||||
@Override
|
||||
public void setBrightness(final double value) {
|
||||
if (Engine.getPlatform().getSettings().isDebugEnabled() == false) {
|
||||
if (Engine.getPlatform().isRunningOnRaspberry()) {
|
||||
Engine.getPlatform().getGpio().pwmWrite(12, (int) Math.ceil(value * 1024f));
|
||||
// SoftPwm.softPwmWrite(12, (int)(Math.ceil(brightness*10)));
|
||||
} else {
|
||||
|
@ -7,6 +7,7 @@ import it.cavallium.warppi.StaticVars;
|
||||
import it.cavallium.warppi.Platform.ConsoleUtils;
|
||||
import it.cavallium.warppi.device.Keyboard;
|
||||
import it.cavallium.warppi.event.KeyPressedEvent;
|
||||
import it.cavallium.warppi.event.KeyReleasedEvent;
|
||||
import it.cavallium.warppi.gui.HistoryBehavior;
|
||||
import it.cavallium.warppi.gui.graphicengine.BinaryFont;
|
||||
import it.cavallium.warppi.gui.graphicengine.Skin;
|
||||
@ -87,12 +88,49 @@ public class MarioScreen extends Screen {
|
||||
}
|
||||
}
|
||||
|
||||
boolean rightPressed, leftPressed, jumpPressed;
|
||||
|
||||
@Override
|
||||
public boolean onKeyPressed(KeyPressedEvent k) {
|
||||
switch(k.getKey()) {
|
||||
case OK:
|
||||
case SIMPLIFY:
|
||||
case STEP:
|
||||
jumpPressed = true;
|
||||
return true;
|
||||
case LEFT:
|
||||
leftPressed = true;
|
||||
return true;
|
||||
case RIGHT:
|
||||
rightPressed = true;
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyReleased(KeyReleasedEvent k) {
|
||||
switch(k.getKey()) {
|
||||
case OK:
|
||||
case SIMPLIFY:
|
||||
case STEP:
|
||||
jumpPressed = false;
|
||||
return true;
|
||||
case LEFT:
|
||||
leftPressed = false;
|
||||
return true;
|
||||
case RIGHT:
|
||||
rightPressed = false;
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeRender(final float dt) {
|
||||
if (!errored) {
|
||||
final boolean rightPressed = Keyboard.isKeyDown(2, 5);
|
||||
final boolean leftPressed = Keyboard.isKeyDown(2, 3);
|
||||
final boolean jumpPressed = Keyboard.isKeyDown(2, 1);
|
||||
final boolean upPressed = false, downPressed = false, runPressed = false;
|
||||
g.gameTick(dt, upPressed, downPressed, leftPressed, rightPressed, jumpPressed, runPressed);
|
||||
|
||||
|
@ -2,17 +2,17 @@ package it.cavallium.warppi.extra.tetris;
|
||||
|
||||
public class TetrisGame {
|
||||
|
||||
private static final int WIDTH = 10, HEIGHT = 22;
|
||||
private BlockType[] grid;
|
||||
private BlockType[] hovergrid;
|
||||
private GameStatus gameStatus = GameStatus.INITIAL;
|
||||
private int score = 0;
|
||||
static final int WIDTH = 10, HEIGHT = 22;
|
||||
BlockType[] grid;
|
||||
BlockType[] hovergrid;
|
||||
GameStatus gameStatus = GameStatus.INITIAL;
|
||||
int score = 0;
|
||||
|
||||
public TetrisGame() {
|
||||
|
||||
}
|
||||
|
||||
private void playAgain() {
|
||||
void playAgain() {
|
||||
grid = new BlockType[WIDTH * HEIGHT];
|
||||
hovergrid = new BlockType[WIDTH * HEIGHT];
|
||||
score = 0;
|
||||
|
@ -5,8 +5,12 @@ import java.io.IOException;
|
||||
import it.cavallium.warppi.Engine;
|
||||
import it.cavallium.warppi.StaticVars;
|
||||
import it.cavallium.warppi.device.Keyboard;
|
||||
import it.cavallium.warppi.event.KeyPressedEvent;
|
||||
import it.cavallium.warppi.event.KeyReleasedEvent;
|
||||
import it.cavallium.warppi.gui.HistoryBehavior;
|
||||
import it.cavallium.warppi.gui.graphicengine.BinaryFont;
|
||||
import it.cavallium.warppi.gui.graphicengine.GraphicEngine;
|
||||
import it.cavallium.warppi.gui.graphicengine.Renderer;
|
||||
import it.cavallium.warppi.gui.graphicengine.Skin;
|
||||
import it.cavallium.warppi.gui.screens.Screen;
|
||||
|
||||
@ -14,6 +18,10 @@ public class TetrisScreen extends Screen {
|
||||
|
||||
private TetrisGame g;
|
||||
|
||||
private GraphicEngine e;
|
||||
|
||||
private Renderer r;
|
||||
|
||||
private static Skin skin;
|
||||
|
||||
public TetrisScreen() {
|
||||
@ -23,153 +31,32 @@ public class TetrisScreen extends Screen {
|
||||
|
||||
@Override
|
||||
public void initialized() {
|
||||
// try {
|
||||
// if (TetrisScreen.skin == null) {
|
||||
// TetrisScreen.skin = Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.loadSkin("/marioskin.png");
|
||||
// }
|
||||
// if (TetrisScreen.groundskin == null) {
|
||||
// TetrisScreen.groundskin = Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.loadSkin("/marioground.png");
|
||||
// }
|
||||
// if (TetrisScreen.gpuTest2 == null) {
|
||||
// try {
|
||||
// TetrisScreen.gpuTest2 = Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.loadFont("N:\\gputest\\gputest2");
|
||||
// } catch (final Exception ex) {}
|
||||
// }
|
||||
// if (TetrisScreen.gpuTest1 == null) {
|
||||
// try {
|
||||
// TetrisScreen.gpuTest1 = Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.loadFont("N:\\gputest\\gputest12");
|
||||
// TetrisScreen.gpuTest12 = true;
|
||||
// } catch (final Exception ex) {
|
||||
// TetrisScreen.gpuTest12 = false;
|
||||
// try {
|
||||
// TetrisScreen.gpuTest1 = Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.loadFont("N:\\gputest\\gputest1");
|
||||
// } catch (final Exception ex2) {}
|
||||
// }
|
||||
// }
|
||||
// if (TetrisScreen.gpuTest3 == null) {
|
||||
// try {
|
||||
// TetrisScreen.gpuTest3 = Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.loadSkin("N:\\gputest\\font_gputest3.png");
|
||||
// } catch (final Exception ex) {
|
||||
// ex.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// } catch (final IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
try {
|
||||
e = d.engine;
|
||||
r = d.renderer;
|
||||
if (TetrisScreen.skin == null) {
|
||||
TetrisScreen.skin = Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.loadSkin("/tetrisskin.png");
|
||||
}
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void created() throws InterruptedException {
|
||||
// if (!errored) {
|
||||
// g = new MarioGame();
|
||||
// }
|
||||
g = new TetrisGame();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeRender(final float dt) {
|
||||
// if (!errored) {
|
||||
// final boolean rightPressed = Keyboard.isKeyDown(2, 5);
|
||||
// final boolean leftPressed = Keyboard.isKeyDown(2, 3);
|
||||
// final boolean jumpPressed = Keyboard.isKeyDown(2, 1);
|
||||
// final boolean upPressed = false, downPressed = false, runPressed = false;
|
||||
// g.gameTick(dt, upPressed, downPressed, leftPressed, rightPressed, jumpPressed, runPressed);
|
||||
//
|
||||
// gpuTestElapsed += dt;
|
||||
// while (gpuTestElapsed >= 0.04) {
|
||||
// gpuTestNum = (gpuTestNum + 1) % gpuTestMax;
|
||||
// gpuTestElapsed -= 0.04;
|
||||
// }
|
||||
// gpuCharTestt1Elapsed += dt;
|
||||
// while (gpuCharTestt1Elapsed >= 1.5) {
|
||||
// gpuCharTest1Num = (gpuCharTest1Num + 1) % gpuCharTest1.length;
|
||||
// gpuCharTestt1Elapsed -= 1.5;
|
||||
// }
|
||||
//
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glClearColor(0xff000000);
|
||||
// }
|
||||
Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glClearColor(0xff000000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
// if (errored) {
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glDrawStringLeft(0, 20, "ERROR");
|
||||
// } else {
|
||||
// if (TetrisScreen.groundskin != null) {
|
||||
// final double playerX = g.getPlayer().getX();
|
||||
// final double playerY = g.getPlayer().getY();
|
||||
// TetrisScreen.groundskin.use(Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine);
|
||||
// final MarioWorld w = g.getCurrentWorld();
|
||||
// final int width = w.getWidth();
|
||||
// final int height = w.getHeight();
|
||||
// final float screenX = Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.getWidth() / 2f - 8f;
|
||||
// final float screenY = Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.getHeight() / 2f - 8f;
|
||||
// final float shiftX = -8 + 16 * (float) playerX;
|
||||
// final float shiftY = -8 + 16 * (height - (float) playerY);
|
||||
// int blue = -1;
|
||||
// for (int ix = 0; ix < width; ix++) {
|
||||
// for (int iy = 0; iy < height; iy++) {
|
||||
// final double distX = Math.abs(playerX - ix);
|
||||
// final double distY = Math.abs(playerY - iy - 1.5d);
|
||||
// if (distX * distX + distY * distY / 2d < 25d) {
|
||||
// final byte b = w.getBlockIdAt(ix, iy);
|
||||
// if (b == 0) {
|
||||
// if (blue != 1) {
|
||||
// blue = 1;
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glColor(0xff9290ff);
|
||||
// }
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glFillColor(screenX - shiftX + 16 * ix, screenY - shiftY + 16 * (height - iy), 16, 16);
|
||||
// } else {
|
||||
// if (blue != 0) {
|
||||
// blue = 0;
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glColor(0xffffffff);
|
||||
// }
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glFillRect(screenX - shiftX + 16 * ix, screenY - shiftY + 16 * (height - iy), 16, 16, 0, 0, 16, 16);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (blue != 0) {
|
||||
// blue = 0;
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glColor(0xffffffff);
|
||||
// }
|
||||
//
|
||||
// //DRAW MARIO
|
||||
// TetrisScreen.skin.use(Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine);
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glFillRect(screenX - (g.getPlayer().flipped ? 3 : 0), screenY, 35, 27, 35 * (g.getPlayer().marioSkinPos[0] + (g.getPlayer().flipped ? 2 : 1)), 27 * g.getPlayer().marioSkinPos[1], 35 * (g.getPlayer().flipped ? -1 : 1), 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);
|
||||
// }
|
||||
//
|
||||
//// GPU PERFORMANCE TEST
|
||||
// if (TetrisScreen.gpuTest1 != null) {
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glColor3f(1, 1, 1);
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glFillColor(Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.getWidth() - (TetrisScreen.gpuTest12 ? 512 : 256), Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.getHeight() / 2 - (TetrisScreen.gpuTest12 ? 256 : 128), TetrisScreen.gpuTest12 ? 512 : 256, TetrisScreen.gpuTest12 ? 512 : 256);
|
||||
// TetrisScreen.gpuTest1.use(Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine);
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glColor3f(0, 0, 0);
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glDrawStringRight(Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.getWidth(), Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.getHeight() / 2 - (TetrisScreen.gpuTest12 ? 256 : 128), gpuCharTest1[gpuCharTest1Num]);
|
||||
// }
|
||||
// if (TetrisScreen.gpuTest3 != null) {
|
||||
// TetrisScreen.gpuTest3.use(Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine);
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glColor4f(1, 1, 1, 0.7f);
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glFillRect(0, StaticVars.screenSize[1] - 128, 224, 128, gpuTestNum * 224, 0, 224, 128);
|
||||
// }
|
||||
// if (TetrisScreen.gpuTest2 != null) {
|
||||
// TetrisScreen.gpuTest2.use(Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine);
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glColor(0xFF000000);
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glDrawStringRight(StaticVars.screenSize[0], Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.getHeight() - TetrisScreen.gpuTest2.getCharacterHeight(), "A");
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glColor(0xFF800000);
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glDrawStringRight(StaticVars.screenSize[0], Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.getHeight() - TetrisScreen.gpuTest2.getCharacterHeight(), "B");
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glColor(0xFFeea28e);
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glDrawStringRight(StaticVars.screenSize[0], Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.getHeight() - TetrisScreen.gpuTest2.getCharacterHeight(), "C");
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glColor(0xFFee7255);
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glDrawStringRight(StaticVars.screenSize[0], Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.getHeight() - TetrisScreen.gpuTest2.getCharacterHeight(), "D");
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glColor(0xFFeac0b0);
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glDrawStringRight(StaticVars.screenSize[0], Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.getHeight() - TetrisScreen.gpuTest2.getCharacterHeight(), "E");
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glColor(0xFFf3d8ce);
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glDrawStringRight(StaticVars.screenSize[0], Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.getHeight() - TetrisScreen.gpuTest2.getCharacterHeight(), "F");
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glColor(0xFFffede7);
|
||||
// Engine.INSTANCE.getHardwareDevice().getDisplayManager().renderer.glDrawStringRight(StaticVars.screenSize[0], Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.getHeight() - TetrisScreen.gpuTest2.getCharacterHeight(), "G");
|
||||
// }
|
||||
// }
|
||||
if (TetrisScreen.skin != null) {
|
||||
TetrisScreen.skin.use(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -179,7 +66,18 @@ public class TetrisScreen extends Screen {
|
||||
|
||||
@Override
|
||||
public String getSessionTitle() {
|
||||
return "Absolutely not Super Mario";
|
||||
return "Absolutely Not Tetris";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyPressed(KeyPressedEvent k) {
|
||||
System.out.println("pr:"+k.getKey());
|
||||
return super.onKeyPressed(k);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyReleased(KeyReleasedEvent k) {
|
||||
System.out.println("re:"+k.getKey());
|
||||
return super.onKeyReleased(k);
|
||||
}
|
||||
}
|
||||
|
BIN
core/src/main/resources/tetrisskin.png
Normal file
BIN
core/src/main/resources/tetrisskin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
BIN
core/src/main/resources/tetrisskin.xcf
Normal file
BIN
core/src/main/resources/tetrisskin.xcf
Normal file
Binary file not shown.
@ -30,6 +30,7 @@ public class DesktopPlatform implements Platform {
|
||||
private final String on;
|
||||
private final Map<String, GraphicEngine> el;
|
||||
private final DesktopSettings settings;
|
||||
private Boolean runningOnRaspberryOverride = null;
|
||||
|
||||
public DesktopPlatform() {
|
||||
cu = new DesktopConsoleUtils();
|
||||
@ -205,8 +206,18 @@ public class DesktopPlatform implements Platform {
|
||||
return org.eclipse.jdt.internal.compiler.batch.Main.compile(command, printWriter, errors, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRunningOnRaspberry(boolean b) {
|
||||
if (isRunningOnRaspberry()) {
|
||||
runningOnRaspberryOverride = b;
|
||||
} else {
|
||||
runningOnRaspberryOverride = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRunningOnRaspberry() {
|
||||
if (runningOnRaspberryOverride != null) return runningOnRaspberryOverride;
|
||||
return CacheUtils.get("isRunningOnRaspberry", 24 * 60 * 60 * 1000, () -> {
|
||||
if (Engine.getPlatform().isJavascript())
|
||||
return false;
|
||||
|
@ -244,21 +244,16 @@ public class SwingWindow extends JFrame {
|
||||
b.setFont(f);
|
||||
b.setBackground(new Color(200, 200, 200));
|
||||
b.setFocusable(true);
|
||||
b.addActionListener(e -> {
|
||||
Keyboard.keyPressedRaw(row, col);
|
||||
Keyboard.keyReleasedRaw(row, col);
|
||||
c.grabFocus();
|
||||
});
|
||||
b.addMouseListener(new MouseListener() {
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
Keyboard.keyRaw(row, col, true);
|
||||
c.grabFocus();
|
||||
}
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
Keyboard.keyRaw(row, col, false);
|
||||
c.grabFocus();
|
||||
}
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
|
@ -25,6 +25,7 @@ public class HardwarePlatform implements Platform {
|
||||
private final String on;
|
||||
private final Map<String, GraphicEngine> el;
|
||||
private final HardwareSettings settings;
|
||||
private Boolean runningOnRaspberryOverride = null;
|
||||
|
||||
public HardwarePlatform() {
|
||||
cu = new HardwareConsoleUtils();
|
||||
@ -194,8 +195,14 @@ public class HardwarePlatform implements Platform {
|
||||
return org.eclipse.jdt.internal.compiler.batch.Main.compile(command, printWriter, errors, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRunningOnRaspberry(boolean b) {
|
||||
runningOnRaspberryOverride = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRunningOnRaspberry() {
|
||||
if (runningOnRaspberryOverride != null) return runningOnRaspberryOverride;
|
||||
return true;
|
||||
/*
|
||||
return CacheUtils.get("isRunningOnRaspberry", 24 * 60 * 60 * 1000, () -> {
|
||||
|
@ -70,15 +70,10 @@ public class HtmlEngine implements GraphicEngine {
|
||||
}
|
||||
|
||||
private String previousValue = "";
|
||||
|
||||
@JSBody(params = { "ctx", "enabled" }, script = ""
|
||||
+ "ctx.mozImageSmoothingEnabled = enabled;"
|
||||
+ "ctx.oImageSmoothingEnabled = enabled;"
|
||||
+ "ctx.webkitImageSmoothingEnabled = enabled;"
|
||||
+ "ctx.msImageSmoothingEnabled = enabled;"
|
||||
+ "ctx.imageSmoothingEnabled = enabled;")
|
||||
|
||||
@JSBody(params = { "ctx", "enabled" }, script = "" + "ctx.mozImageSmoothingEnabled = enabled;" + "ctx.oImageSmoothingEnabled = enabled;" + "ctx.webkitImageSmoothingEnabled = enabled;" + "ctx.msImageSmoothingEnabled = enabled;" + "ctx.imageSmoothingEnabled = enabled;")
|
||||
public static native void setImageSmoothingEnabled(CanvasRenderingContext2D ctx, boolean enabled);
|
||||
|
||||
|
||||
@Override
|
||||
public void create(final Runnable onInitialized) {
|
||||
exitSemaphore = Engine.getPlatform().newSemaphore(0);
|
||||
@ -93,14 +88,14 @@ public class HtmlEngine implements GraphicEngine {
|
||||
onZoom.subscribe((windowZoom) -> {
|
||||
if (windowZoom != 0) {
|
||||
if (suppportsZoom()) {
|
||||
canvas.setWidth((int)(480 / 1));
|
||||
canvas.setHeight((int)(320 / 1));
|
||||
canvas.setWidth((int) (480 / 1));
|
||||
canvas.setHeight((int) (320 / 1));
|
||||
canvas.getStyle().setProperty("zoom", "" + (1 + 1));
|
||||
} else {
|
||||
canvas.setWidth((int)(480 * 2));
|
||||
canvas.setHeight((int)(320 * 2));
|
||||
canvas.setWidth((int) (480 * 2));
|
||||
canvas.setHeight((int) (320 * 2));
|
||||
}
|
||||
canvas.getStyle().setProperty("max-height", (int)(44 / (1+1)) + "vh");
|
||||
canvas.getStyle().setProperty("max-height", (int) (44 / (1 + 1)) + "vh");
|
||||
width = 480 / windowZoom.intValue();
|
||||
height = 320 / windowZoom.intValue();
|
||||
this.mult = windowZoom.intValue();
|
||||
@ -114,11 +109,13 @@ public class HtmlEngine implements GraphicEngine {
|
||||
HtmlEngine.document.getElementById("container").appendChild(canvas);
|
||||
HtmlEngine.document.getBody().appendChild(keyInput);
|
||||
keyInput.setTabIndex(0);
|
||||
keyInput.setValue("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
keyInput.addEventListener("keydown", (final KeyboardEvent evt) -> {
|
||||
evt.preventDefault();
|
||||
new Thread(() -> {
|
||||
previousValue = keyInput.getValue();
|
||||
Keyboard.debugKeyPressed(evt.getKeyCode());
|
||||
Keyboard.debugKey(evt.getKeyCode(), false);
|
||||
Keyboard.debugKey(evt.getKeyCode(), true);
|
||||
System.out.println(evt.getKeyCode());
|
||||
System.out.println("" + (int) evt.getKey().charAt(0));
|
||||
}).start();
|
||||
@ -133,14 +130,17 @@ public class HtmlEngine implements GraphicEngine {
|
||||
new Thread(() -> {
|
||||
if (newLen == prevLen) {
|
||||
|
||||
} else if (newLen - prevLen == 1)
|
||||
Keyboard.debugKeyPressed(newValue.toUpperCase().charAt(newLen - 1));
|
||||
} else if (newLen - prevLen == 1) {
|
||||
Keyboard.debugKey(newValue.toUpperCase().charAt(newLen - 1), false);
|
||||
Keyboard.debugKey(newValue.toUpperCase().charAt(newLen - 1), true);}
|
||||
else if (newLen - prevLen > 1)
|
||||
for (int i = 0; i < newLen - prevLen; i++)
|
||||
Keyboard.debugKeyPressed(newValue.toUpperCase().charAt(prevLen + i));
|
||||
for (int i = 0; i < newLen - prevLen; i++) {
|
||||
Keyboard.debugKey(newValue.toUpperCase().charAt(prevLen + i), false);
|
||||
Keyboard.debugKey(newValue.toUpperCase().charAt(prevLen + i), true);}
|
||||
else if (newLen - prevLen < 1)
|
||||
for (int i = 0; i < prevLen - newLen; i++)
|
||||
Keyboard.debugKeyPressed(8);
|
||||
for (int i = 0; i < prevLen - newLen; i++) {
|
||||
Keyboard.debugKey(8, false);
|
||||
Keyboard.debugKey(8, true);}
|
||||
}).start();
|
||||
});
|
||||
canvas.addEventListener("click", (final Event evt) -> {
|
||||
@ -163,36 +163,48 @@ public class HtmlEngine implements GraphicEngine {
|
||||
final String[] coordinates = code.split(",", 2);
|
||||
final boolean removeshift = Keyboard.shift && Integer.parseInt(coordinates[0]) != 0 && Integer.parseInt(coordinates[1]) != 0;
|
||||
final boolean removealpha = Keyboard.alpha && Integer.parseInt(coordinates[0]) != 0 && Integer.parseInt(coordinates[1]) != 1;
|
||||
Keyboard.keyPressedRaw(Integer.parseInt(coordinates[0]), Integer.parseInt(coordinates[1]));
|
||||
Keyboard.keyRaw(Integer.parseInt(coordinates[0]), Integer.parseInt(coordinates[1]), false);
|
||||
if (removeshift)
|
||||
Keyboard.keyPressedRaw(0, 0);
|
||||
Keyboard.keyRaw(0, 0, false);
|
||||
if (removealpha)
|
||||
Keyboard.keyPressedRaw(0, 1);
|
||||
Keyboard.keyRaw(0, 1, false);
|
||||
Thread.sleep(100);
|
||||
Keyboard.keyReleasedRaw(Integer.parseInt(coordinates[0]), Integer.parseInt(coordinates[1]));
|
||||
Keyboard.keyRaw(Integer.parseInt(coordinates[0]), Integer.parseInt(coordinates[1]), true);
|
||||
if (removeshift)
|
||||
Keyboard.keyReleasedRaw(0, 0);
|
||||
Keyboard.keyRaw(0, 0, true);
|
||||
if (removealpha)
|
||||
Keyboard.keyReleasedRaw(0, 1);
|
||||
Keyboard.keyRaw(0, 1, true);
|
||||
} else if (Keyboard.alpha && !Keyboard.shift) {
|
||||
if (button.hasAttribute("keycodea"))
|
||||
Keyboard.debugKeyPressed(Integer.parseInt(button.getAttribute("keycodea")));
|
||||
else
|
||||
Keyboard.debugKeyPressed(Integer.parseInt(button.getAttribute("keycode")));
|
||||
if (button.hasAttribute("keycodea")) {
|
||||
Keyboard.debugKey(Integer.parseInt(button.getAttribute("keycodea")), false);
|
||||
Keyboard.debugKey(Integer.parseInt(button.getAttribute("keycodea")), true);
|
||||
} else {
|
||||
Keyboard.debugKey(Integer.parseInt(button.getAttribute("keycode")), false);
|
||||
Keyboard.debugKey(Integer.parseInt(button.getAttribute("keycode")), true);
|
||||
}
|
||||
} else if (!Keyboard.alpha && Keyboard.shift) {
|
||||
if (button.hasAttribute("keycodes"))
|
||||
Keyboard.debugKeyPressed(Integer.parseInt(button.getAttribute("keycodes")));
|
||||
else
|
||||
Keyboard.debugKeyPressed(Integer.parseInt(button.getAttribute("keycode")));
|
||||
if (button.hasAttribute("keycodes")) {
|
||||
Keyboard.debugKey(Integer.parseInt(button.getAttribute("keycodes")), false);
|
||||
Keyboard.debugKey(Integer.parseInt(button.getAttribute("keycodes")), true);
|
||||
} else {
|
||||
Keyboard.debugKey(Integer.parseInt(button.getAttribute("keycode")), false);
|
||||
Keyboard.debugKey(Integer.parseInt(button.getAttribute("keycode")), true);
|
||||
}
|
||||
} else if (Keyboard.alpha && Keyboard.shift) {
|
||||
if (button.hasAttribute("keycodesa"))
|
||||
Keyboard.debugKeyPressed(Integer.parseInt(button.getAttribute("keycodesa")));
|
||||
else if (button.hasAttribute("keycodes"))
|
||||
Keyboard.debugKeyPressed(Integer.parseInt(button.getAttribute("keycodes")));
|
||||
else
|
||||
Keyboard.debugKeyPressed(Integer.parseInt(button.getAttribute("keycode")));
|
||||
} else
|
||||
Keyboard.debugKeyPressed(Integer.parseInt(button.getAttribute("keycode")));
|
||||
if (button.hasAttribute("keycodesa")) {
|
||||
Keyboard.debugKey(Integer.parseInt(button.getAttribute("keycodesa")), false);
|
||||
Keyboard.debugKey(Integer.parseInt(button.getAttribute("keycodesa")), true);
|
||||
} else if (button.hasAttribute("keycodes")) {
|
||||
Keyboard.debugKey(Integer.parseInt(button.getAttribute("keycodes")), false);
|
||||
Keyboard.debugKey(Integer.parseInt(button.getAttribute("keycodes")), true);
|
||||
} else {
|
||||
Keyboard.debugKey(Integer.parseInt(button.getAttribute("keycode")), false);
|
||||
Keyboard.debugKey(Integer.parseInt(button.getAttribute("keycode")), true);
|
||||
}
|
||||
} else {
|
||||
Keyboard.debugKey(Integer.parseInt(button.getAttribute("keycode")), false);
|
||||
Keyboard.debugKey(Integer.parseInt(button.getAttribute("keycode")), true);
|
||||
}
|
||||
} catch (final Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import it.cavallium.warppi.gui.graphicengine.Renderer;
|
||||
|
||||
public class HtmlRenderer implements Renderer {
|
||||
private String currentColor = "#000000ff";
|
||||
private String clearColor = "#000000ff";
|
||||
private String clearColor = "#c5c2afff";
|
||||
HtmlFont f = null;
|
||||
HtmlSkin currentSkin = null;
|
||||
private final CanvasRenderingContext2D g;
|
||||
|
@ -23,6 +23,7 @@ public class TeaVMPlatform implements Platform {
|
||||
private final Map<String, GraphicEngine> el;
|
||||
private final TeaVMPngUtils pu;
|
||||
private final TeaVMSettings settings;
|
||||
private Boolean runningOnRaspberryOverride = null;
|
||||
|
||||
public TeaVMPlatform() {
|
||||
cu = new TeaVMConsoleUtils();
|
||||
@ -208,6 +209,10 @@ public class TeaVMPlatform implements Platform {
|
||||
throw new java.lang.UnsupportedOperationException("Not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRunningOnRaspberry(boolean b) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRunningOnRaspberry() {
|
||||
return false;
|
||||
|
@ -7,7 +7,7 @@ public class TeaVMSettings implements Settings {
|
||||
private boolean debug;
|
||||
|
||||
public TeaVMSettings() {
|
||||
debug = true;
|
||||
debug = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user