diff --git a/core/src/main/java/it/cavallium/warppi/Engine.java b/core/src/main/java/it/cavallium/warppi/Engine.java
index df7b2e0b..7b9fa42d 100644
--- a/core/src/main/java/it/cavallium/warppi/Engine.java
+++ b/core/src/main/java/it/cavallium/warppi/Engine.java
@@ -21,15 +21,14 @@ public class Engine {
private static Platform platform;
private static boolean running = false;
private static BehaviorSubject loadPhase = BehaviorSubject.create();
- private BehaviorSubject loaded = BehaviorSubject.create(false);
+ private final BehaviorSubject loaded = BehaviorSubject.create(false);
private HardwareDevice hardwareDevice;
- private Engine() {
- }
+ private Engine() {}
/**
* Start an instance of the calculator.
- *
+ *
* @param platform
* Platform implementation
* @param screen
@@ -43,32 +42,34 @@ public class Engine {
* @throws InterruptedException
* @throws IOException
*/
- public static void start(Platform platform, Screen screen, HardwareDisplay disp, HardwareTouchDevice touchdevice, HUD hud,
- StartupArguments args) throws InterruptedException, IOException {
- if (running) {
+ public static void start(final Platform platform, final Screen screen, final HardwareDisplay disp,
+ final HardwareTouchDevice touchdevice, final HUD hud, final StartupArguments args)
+ throws InterruptedException, IOException {
+ if (Engine.running)
throw new RuntimeException("Already running!");
- } else {
- running = true;
- INSTANCE.startInstance(platform, screen, disp, touchdevice, hud, args);
+ else {
+ Engine.running = true;
+ Engine.INSTANCE.startInstance(platform, screen, disp, touchdevice, hud, args);
}
}
- private void startInstance(final Platform platform, Screen screen, HardwareDisplay disp, HardwareTouchDevice touchdevice, HUD hud,
- StartupArguments args) throws InterruptedException, IOException {
+ private void startInstance(final Platform platform, final Screen screen, final HardwareDisplay disp,
+ final HardwareTouchDevice touchdevice, final HUD hud, final StartupArguments args)
+ throws InterruptedException, IOException {
Engine.platform = platform;
platform.getConsoleUtils().out().println("WarpPI Calculator");
initializeEnvironment(args);
- Thread currentThread = Thread.currentThread();
+ final Thread currentThread = Thread.currentThread();
currentThread.setPriority(Thread.MAX_PRIORITY);
Engine.getPlatform().setThreadName(currentThread, "Main thread");
- DisplayManager dm = new DisplayManager(disp, hud, screen, "WarpPI Calculator by Andrea Cavalli (@Cavallium)");
- Keyboard k = new Keyboard();
- InputManager im = new InputManager(k, touchdevice);
+ final DisplayManager dm = new DisplayManager(disp, hud, screen, "WarpPI Calculator by Andrea Cavalli (@Cavallium)");
+ final Keyboard k = new Keyboard();
+ final InputManager im = new InputManager(k, touchdevice);
hardwareDevice = new HardwareDevice(dm, im);
-
- hardwareDevice.setup(() -> loadPhase.onNext(new LoadingStatus()));
+
+ hardwareDevice.setup(() -> Engine.loadPhase.onNext(new LoadingStatus()));
}
private void onShutdown() {
@@ -79,13 +80,12 @@ public class Engine {
Engine.getPlatform().exit(0);
}
- private void initializeEnvironment(StartupArguments args) throws IOException {
+ private void initializeEnvironment(final StartupArguments args) throws IOException {
ClassUtils.classLoader = this.getClass();
StaticVars.startupArguments = args;
StaticVars.debugWindow2x = args.isZoomed();
- if (args.isVerboseLoggingEnabled() || args.isDebugEnabled()) {
+ if (args.isVerboseLoggingEnabled() || args.isDebugEnabled())
StaticVars.outputLevel = ConsoleUtils.OUTPUTLEVEL_DEBUG_VERBOSE;
- }
Engine.platform.getConsoleUtils().out().println(ConsoleUtils.OUTPUTLEVEL_DEBUG_MIN, args);
checkDeviceType();
if (Engine.getPlatform().isRunningOnRaspberry() && args.isRaspberryModeAllowed()) {
@@ -111,15 +111,15 @@ public class Engine {
}
public Observable getLoadPhase() {
- return loadPhase;
+ return Engine.loadPhase;
}
-
+
public HardwareDevice getHardwareDevice() {
return hardwareDevice;
}
-
+
public static Platform getPlatform() {
- return platform;
+ return Engine.platform;
}
public static class LoadingStatus {
diff --git a/core/src/main/java/it/cavallium/warppi/Platform.java b/core/src/main/java/it/cavallium/warppi/Platform.java
index 8bad5737..592579f9 100644
--- a/core/src/main/java/it/cavallium/warppi/Platform.java
+++ b/core/src/main/java/it/cavallium/warppi/Platform.java
@@ -14,166 +14,189 @@ import it.cavallium.warppi.util.Error;
public interface Platform {
- public ConsoleUtils getConsoleUtils();
- public Gpio getGpio();
- public StorageUtils getStorageUtils();
- public PngUtils getPngUtils();
- public Settings getSettings();
+ ConsoleUtils getConsoleUtils();
- public void setThreadName(Thread t, String name);
- public void setThreadDaemon(Thread t);
- public void setThreadDaemon(Thread t, boolean value);
+ Gpio getGpio();
- public void exit(int value);
- public void gc();
+ StorageUtils getStorageUtils();
- public boolean isJavascript();
- public boolean isRunningOnRaspberry();
-
- public String getOsName();
+ PngUtils getPngUtils();
- public void alphaChanged(boolean val);
- public void shiftChanged(boolean val);
+ Settings getSettings();
- public Semaphore newSemaphore();
- public Semaphore newSemaphore(int i);
-
- public URLClassLoader newURLClassLoader(URL[] urls);
+ void setThreadName(Thread t, String name);
- public Map getEnginesList();
- public GraphicEngine getEngine(String string) throws NullPointerException;
+ void setThreadDaemon(Thread t);
- public void throwNewExceptionInInitializerError(String text);
- public String[] stacktraceToString(Error e);
+ void setThreadDaemon(Thread t, boolean value);
- public void loadPlatformRules();
- public void zip(String targetPath, String destinationFilePath, String password);
- public void unzip(String targetZipFilePath, String destinationFolderPath, String password);
+ void exit(int value);
- public boolean compile(String[] command, PrintWriter printWriter, PrintWriter errors);
+ void gc();
+
+ boolean isJavascript();
+
+ boolean isRunningOnRaspberry();
+
+ String getOsName();
+
+ void alphaChanged(boolean val);
+
+ void shiftChanged(boolean val);
+
+ Semaphore newSemaphore();
+
+ Semaphore newSemaphore(int i);
+
+ URLClassLoader newURLClassLoader(URL[] urls);
+
+ Map getEnginesList();
+
+ GraphicEngine getEngine(String string) throws NullPointerException;
+
+ void throwNewExceptionInInitializerError(String text);
+
+ String[] stacktraceToString(Error e);
+
+ void loadPlatformRules();
+
+ void zip(String targetPath, String destinationFilePath, String password);
+
+ void unzip(String targetZipFilePath, String destinationFolderPath, String password);
+
+ boolean compile(String[] command, PrintWriter printWriter, PrintWriter errors);
public interface Gpio {
- public int valueOutput();
- public int valuePwmOutput();
- public int valueInput();
- public int valueHigh();
- public int valueLow();
- public Object valueUnknownBoardType();
+ int valueOutput();
- public void wiringPiSetupPhys();
+ int valuePwmOutput();
- public void pinMode(int i, int type);
+ int valueInput();
- public void digitalWrite(int pin, int val);
+ int valueHigh();
- public void digitalWrite(int pin, boolean val);
+ int valueLow();
- public void pwmWrite(int pin, int val);
-
- public void delayMicroseconds(int t);
+ Object valueUnknownBoardType();
- public int digitalRead(int pin);
+ void wiringPiSetupPhys();
- public Object getBoardType();
+ void pinMode(int i, int type);
+
+ void digitalWrite(int pin, int val);
+
+ void digitalWrite(int pin, boolean val);
+
+ void pwmWrite(int pin, int val);
+
+ void delayMicroseconds(int t);
+
+ int digitalRead(int pin);
+
+ Object getBoardType();
}
-
+
public interface ConsoleUtils {
- public static final int OUTPUTLEVEL_NODEBUG = 0;
- public static final int OUTPUTLEVEL_DEBUG_MIN = 1;
- public static final int OUTPUTLEVEL_DEBUG_VERBOSE = 4;
-
- public AdvancedOutputStream out();
-
- public int getOutputLevel();
-
+ int OUTPUTLEVEL_NODEBUG = 0;
+ int OUTPUTLEVEL_DEBUG_MIN = 1;
+ int OUTPUTLEVEL_DEBUG_VERBOSE = 4;
+
+ AdvancedOutputStream out();
+
+ int getOutputLevel();
+
public interface AdvancedOutputStream {
- public void println(Object str);
+ void println(Object str);
- public void println(int level);
+ void println(int level);
- public void println(int level, Object str);
+ void println(int level, Object str);
- public void print(int level, String str);
+ void print(int level, String str);
- public void println(int level, String prefix, String str);
+ void println(int level, String prefix, String str);
- public void println(int level, String... parts);
+ void println(int level, String... parts);
}
}
-
+
public interface StorageUtils {
int OpenOptionWrite = 0;
int OpenOptionCreate = 1;
- public boolean exists(File f);
+ boolean exists(File f);
- public File get(String path);
+ File get(String path);
- public File get(String... path);
+ File get(String... path);
@Deprecated()
- public File getResource(String string) throws IOException, URISyntaxException;
+ File getResource(String string) throws IOException, URISyntaxException;
- public InputStream getResourceStream(String string) throws IOException, URISyntaxException;
+ InputStream getResourceStream(String string) throws IOException, URISyntaxException;
- public List readAllLines(File file) throws IOException;
-
- public String read(InputStream input) throws IOException;
+ List readAllLines(File file) throws IOException;
- public List walk(File dir) throws IOException;
+ String read(InputStream input) throws IOException;
- public File relativize(File rulesPath, File f);
+ List walk(File dir) throws IOException;
- public File resolve(File file, String string);
-
- public File getParent(File f);
+ File relativize(File rulesPath, File f);
- public void createDirectories(File dir) throws IOException;
+ File resolve(File file, String string);
- public void write(File f, byte[] bytes, int... options) throws IOException;
+ File getParent(File f);
- public List readAllLines(InputStream input) throws IOException;
+ void createDirectories(File dir) throws IOException;
- public String getBasePath();
+ void write(File f, byte[] bytes, int... options) throws IOException;
+
+ List readAllLines(InputStream input) throws IOException;
+
+ String getBasePath();
}
-
+
public interface Semaphore {
void release();
+
void acquire() throws InterruptedException;
}
-
+
public interface URLClassLoader {
- public Class> loadClass(String name) throws ClassNotFoundException;
+ Class> loadClass(String name) throws ClassNotFoundException;
+
void close() throws IOException;
}
-
+
public interface PngUtils {
- public PngReader load(InputStream resourceStream);
-
+ PngReader load(InputStream resourceStream);
+
public interface PngReader {
int[] getImageMatrix();
int[] getSize();
-
+
}
-
+
}
-
+
public interface Settings {
- public boolean isDebugEnabled();
+ boolean isDebugEnabled();
- public void setDebugEnabled(boolean debugOn);
+ void setDebugEnabled(boolean debugOn);
- public default String getCalculatorName() {
+ default String getCalculatorName() {
return "WarpPI";
}
- public default String getCalculatorNameLowercase() {
+
+ default String getCalculatorNameLowercase() {
return "warppi";
}
- public default String getCalculatorNameUppercase() {
+
+ default String getCalculatorNameUppercase() {
return "WARPPI";
}
diff --git a/core/src/main/java/it/cavallium/warppi/StaticVars.java b/core/src/main/java/it/cavallium/warppi/StaticVars.java
index 2ac86784..0e8a1b4a 100644
--- a/core/src/main/java/it/cavallium/warppi/StaticVars.java
+++ b/core/src/main/java/it/cavallium/warppi/StaticVars.java
@@ -17,13 +17,12 @@ public class StaticVars {
public static boolean debugWindow2x = false;
public static BehaviorSubject windowZoom = BehaviorSubject.create(2F);
public static Function windowZoomFunction = (val) -> {
- if (StaticVars.debugWindow2x) {
+ if (StaticVars.debugWindow2x)
return val + 1;
- } else {
+ else
return val;
- }
};
- public static Observable windowZoom$ = windowZoom.map(windowZoomFunction);
+ public static Observable windowZoom$ = StaticVars.windowZoom.map(StaticVars.windowZoomFunction);
public static StartupArguments startupArguments;
private StaticVars() {
diff --git a/core/src/main/java/it/cavallium/warppi/TestDrivers.java b/core/src/main/java/it/cavallium/warppi/TestDrivers.java
index bc27a251..441dd2a2 100644
--- a/core/src/main/java/it/cavallium/warppi/TestDrivers.java
+++ b/core/src/main/java/it/cavallium/warppi/TestDrivers.java
@@ -1,25 +1,23 @@
package it.cavallium.warppi;
public class TestDrivers {
- public static void main(String[] args) {
+ public static void main(final String[] args) {
System.out.println("Test started.");
String className;
className = "jogamp.newt.driver.bcm.vc.iv.DisplayDriver";
- if (exists(className)) {
+ if (TestDrivers.exists(className))
System.out.println("[FOUND] " + className);
- } else {
+ else
System.out.println("[NOT FOUND] " + className);
- }
className = ".bcm.vc.iv.DisplayDriver";
- if (exists(className)) {
+ if (TestDrivers.exists(className))
System.out.println("[FOUND] " + className);
- } else {
+ else
System.out.println("[NOT FOUND] " + className);
- }
System.out.println("Test finished.");
}
- public static boolean exists(String className) {
+ public static boolean exists(final String className) {
try {
Class.forName(className);
return true;
diff --git a/core/src/main/java/it/cavallium/warppi/boot/Boot.java b/core/src/main/java/it/cavallium/warppi/boot/Boot.java
index d3ffaea2..329f1032 100644
--- a/core/src/main/java/it/cavallium/warppi/boot/Boot.java
+++ b/core/src/main/java/it/cavallium/warppi/boot/Boot.java
@@ -13,13 +13,13 @@ import it.cavallium.warppi.math.rules.RulesManager;
import it.cavallium.warppi.util.Error;
public class Boot {
-
- public static void boot(Platform platform, String[] args) throws Exception {
- Engine.start(platform, new LoadingScreen(), new PIHardwareDisplay(), new PIHardwareTouchDevice(false, false, false), new CalculatorHUD(), parseStartupArguments(args));
+
+ public static void boot(final Platform platform, final String[] args) throws Exception {
+ Engine.start(platform, new LoadingScreen(), new PIHardwareDisplay(), new PIHardwareTouchDevice(false, false, false), new CalculatorHUD(), Boot.parseStartupArguments(args));
Engine.INSTANCE.getLoadPhase().subscribe(Boot::loadCalculator);
}
- private static void loadCalculator(LoadingStatus loading) {
+ private static void loadCalculator(final LoadingStatus loading) {
try {
Engine.INSTANCE.getHardwareDevice().getDisplayManager().setBrightness(0.2f);
RulesManager.initialize();
@@ -33,12 +33,12 @@ public class Boot {
public static StartupArguments parseStartupArguments(final String[] a) {
final StartupArgumentsImpl args = new StartupArgumentsImpl();
- Arrays.asList(a).stream().parallel().map(String::toLowerCase).forEach(arg -> parseArgument(args, arg));
+ Arrays.asList(a).stream().parallel().map(String::toLowerCase).forEach(arg -> Boot.parseArgument(args, arg));
args.setHeadlessEngineForced(args.isHeadlessEngineForced() || args.isHeadless8EngineForced() || args.isHeadless256EngineForced() || args.isHeadless24bitEngineForced());
return args;
}
- public static void parseArgument(StartupArgumentsImpl args, String arg) {
+ public static void parseArgument(final StartupArgumentsImpl args, final String arg) {
switch (arg) {
case "-zoomed":
args.setZoomed(true);
diff --git a/core/src/main/java/it/cavallium/warppi/boot/StartupArguments.java b/core/src/main/java/it/cavallium/warppi/boot/StartupArguments.java
index 1f6928bc..9cbc7039 100644
--- a/core/src/main/java/it/cavallium/warppi/boot/StartupArguments.java
+++ b/core/src/main/java/it/cavallium/warppi/boot/StartupArguments.java
@@ -1,36 +1,36 @@
package it.cavallium.warppi.boot;
public interface StartupArguments {
- public boolean isRaspberryModeAllowed();
+ boolean isRaspberryModeAllowed();
- public boolean isZoomed();
+ boolean isZoomed();
- public boolean isHeadlessEngineForced();
+ boolean isHeadlessEngineForced();
- public boolean isHeadless8EngineForced();
+ boolean isHeadless8EngineForced();
- public boolean isHeadless256EngineForced();
+ boolean isHeadless256EngineForced();
- public boolean isHeadless24bitEngineForced();
+ boolean isHeadless24bitEngineForced();
- public boolean isCPUEngineForced();
+ boolean isCPUEngineForced();
- public boolean isGPUEngineForced();
+ boolean isGPUEngineForced();
- public boolean isFrameBufferEngineForced();
+ boolean isFrameBufferEngineForced();
- public boolean isNoGUIEngineForced();
+ boolean isNoGUIEngineForced();
- public boolean isHTMLEngineForced();
+ boolean isHTMLEngineForced();
- public boolean isMSDOSModeEnabled();
+ boolean isMSDOSModeEnabled();
- public boolean isVerboseLoggingEnabled();
+ boolean isVerboseLoggingEnabled();
- public boolean isDebugEnabled();
+ boolean isDebugEnabled();
- public boolean isUncached();
+ boolean isUncached();
- public boolean isEngineForced();
+ boolean isEngineForced();
}
diff --git a/core/src/main/java/it/cavallium/warppi/boot/StartupArgumentsImpl.java b/core/src/main/java/it/cavallium/warppi/boot/StartupArgumentsImpl.java
index 99f79928..f8feb508 100644
--- a/core/src/main/java/it/cavallium/warppi/boot/StartupArgumentsImpl.java
+++ b/core/src/main/java/it/cavallium/warppi/boot/StartupArgumentsImpl.java
@@ -102,63 +102,63 @@ public class StartupArgumentsImpl implements StartupArguments {
return isCPUEngineForced || isFrameBufferEngineForced || isGPUEngineForced || isHeadless24bitEngineForced || isHeadless256EngineForced || isHeadless8EngineForced || isHTMLEngineForced || isNoGUIEngineForced;
}
- void setRaspberryModeAllowed(boolean isRaspberryModeAllowed) {
+ void setRaspberryModeAllowed(final boolean isRaspberryModeAllowed) {
this.isRaspberryModeAllowed = isRaspberryModeAllowed;
}
- void setZoomed(boolean isZoomed) {
+ void setZoomed(final boolean isZoomed) {
this.isZoomed = isZoomed;
}
- void setHeadlessEngineForced(boolean isHeadlessEngineForced) {
+ void setHeadlessEngineForced(final boolean isHeadlessEngineForced) {
this.isHeadlessEngineForced = isHeadlessEngineForced;
}
- void setHeadless8EngineForced(boolean isHeadless8EngineForced) {
+ void setHeadless8EngineForced(final boolean isHeadless8EngineForced) {
this.isHeadless8EngineForced = isHeadless8EngineForced;
}
- void setHeadless256EngineForced(boolean isHeadless256EngineForced) {
+ void setHeadless256EngineForced(final boolean isHeadless256EngineForced) {
this.isHeadless256EngineForced = isHeadless256EngineForced;
}
- void setHeadless24bitEngineForced(boolean isHeadless24bitEngineForced) {
+ void setHeadless24bitEngineForced(final boolean isHeadless24bitEngineForced) {
this.isHeadless24bitEngineForced = isHeadless24bitEngineForced;
}
- void setCPUEngineForced(boolean isCPUEngineForced) {
+ void setCPUEngineForced(final boolean isCPUEngineForced) {
this.isCPUEngineForced = isCPUEngineForced;
}
- void setGPUEngineForced(boolean isGPUEngineForced) {
+ void setGPUEngineForced(final boolean isGPUEngineForced) {
this.isGPUEngineForced = isGPUEngineForced;
}
- void setFrameBufferEngineForced(boolean isFrameBufferEngineForced) {
+ void setFrameBufferEngineForced(final boolean isFrameBufferEngineForced) {
this.isFrameBufferEngineForced = isFrameBufferEngineForced;
}
- void setNoGUIEngineForced(boolean isNoGUIEngineForced) {
+ void setNoGUIEngineForced(final boolean isNoGUIEngineForced) {
this.isNoGUIEngineForced = isNoGUIEngineForced;
}
- void setHTMLEngineForced(boolean isHTMLEngineForced) {
+ void setHTMLEngineForced(final boolean isHTMLEngineForced) {
this.isHTMLEngineForced = isHTMLEngineForced;
}
- void setMSDOSModeEnabled(boolean isMSDOSModeEnabled) {
+ void setMSDOSModeEnabled(final boolean isMSDOSModeEnabled) {
this.isMSDOSModeEnabled = isMSDOSModeEnabled;
}
- void setVerboseLoggingEnabled(boolean isVerboseLoggingEnabled) {
+ void setVerboseLoggingEnabled(final boolean isVerboseLoggingEnabled) {
this.isVerboseLoggingEnabled = isVerboseLoggingEnabled;
}
- void setDebugEnabled(boolean isDebugEnabled) {
+ void setDebugEnabled(final boolean isDebugEnabled) {
this.isDebugEnabled = isDebugEnabled;
}
- void setUncached(boolean isUncached) {
+ void setUncached(final boolean isUncached) {
this.isUncached = isUncached;
}
diff --git a/core/src/main/java/it/cavallium/warppi/device/CacheFile.java b/core/src/main/java/it/cavallium/warppi/device/CacheFile.java
index 48a5eb29..62c23b97 100644
--- a/core/src/main/java/it/cavallium/warppi/device/CacheFile.java
+++ b/core/src/main/java/it/cavallium/warppi/device/CacheFile.java
@@ -18,9 +18,9 @@ public class CacheFile {
private FileInputStream lastFIS;
public CacheFile() {
- do {
+ do
path = UUID.randomUUID().toString() + ".ser";
- } while (new File(path).exists());
+ while (new File(path).exists());
try {
File.createTempFile(Engine.getPlatform().getSettings().getCalculatorNameLowercase(), "");
} catch (final IOException e) {
@@ -29,28 +29,26 @@ public class CacheFile {
}
public ObjectOutputStream getObjectOutputStram() {
- if (lastOOS == null) {
+ if (lastOOS == null)
try {
return new ObjectOutputStream(new FileOutputStream(path));
} catch (final IOException e) {
e.printStackTrace();
return lastOOS;
}
- } else {
+ else
return lastOOS;
- }
}
public ObjectInputStream getObjectInputStram() {
- if (lastOIS == null) {
+ if (lastOIS == null)
try {
return new ObjectInputStream(new FileInputStream(path));
} catch (final IOException e) {
return lastOIS;
}
- } else {
+ else
return lastOIS;
- }
}
public void closeStreams() {
diff --git a/core/src/main/java/it/cavallium/warppi/device/HardwareDevice.java b/core/src/main/java/it/cavallium/warppi/device/HardwareDevice.java
index 299a5f00..402060d8 100644
--- a/core/src/main/java/it/cavallium/warppi/device/HardwareDevice.java
+++ b/core/src/main/java/it/cavallium/warppi/device/HardwareDevice.java
@@ -7,7 +7,7 @@ public class HardwareDevice {
private final DisplayManager displayManager;
private final InputManager inputManager;
- public HardwareDevice(DisplayManager m, InputManager im) {
+ public HardwareDevice(final DisplayManager m, final InputManager im) {
displayManager = m;
inputManager = im;
}
@@ -20,10 +20,10 @@ public class HardwareDevice {
return inputManager;
}
- public void setup(Runnable r) {
+ public void setup(final Runnable r) {
displayManager.initialize();
inputManager.getKeyboard().startKeyboard();
- Thread t = new Thread(r);
+ final Thread t = new Thread(r);
Engine.getPlatform().setThreadDaemon(t, false);
Engine.getPlatform().setThreadName(t, "Main thread (after setup)");
t.start();
diff --git a/core/src/main/java/it/cavallium/warppi/device/HardwareTouchDevice.java b/core/src/main/java/it/cavallium/warppi/device/HardwareTouchDevice.java
index ce37c52c..5bf36efb 100644
--- a/core/src/main/java/it/cavallium/warppi/device/HardwareTouchDevice.java
+++ b/core/src/main/java/it/cavallium/warppi/device/HardwareTouchDevice.java
@@ -4,18 +4,18 @@ import it.cavallium.warppi.event.TouchEventListener;
import it.cavallium.warppi.event.TouchPoint;
public interface HardwareTouchDevice extends TouchEventListener {
- public boolean getInvertedXY();
+ boolean getInvertedXY();
- public boolean getInvertedX();
+ boolean getInvertedX();
- public boolean getInvertedY();
+ boolean getInvertedY();
- public default void setInvertedXY() {}
+ default void setInvertedXY() {}
- public default void setInvertedX() {}
+ default void setInvertedX() {}
- public default void setInvertedY() {}
+ default void setInvertedY() {}
- public TouchPoint makePoint(long id, float x, float y, int maxX, int maxY, float radiusX, float radiusY,
- float force, float rotationAngle);
+ TouchPoint makePoint(long id, float x, float y, int maxX, int maxY, float radiusX, float radiusY, float force,
+ float rotationAngle);
}
diff --git a/core/src/main/java/it/cavallium/warppi/device/InputManager.java b/core/src/main/java/it/cavallium/warppi/device/InputManager.java
index 41f9cc0e..22e93090 100644
--- a/core/src/main/java/it/cavallium/warppi/device/InputManager.java
+++ b/core/src/main/java/it/cavallium/warppi/device/InputManager.java
@@ -4,9 +4,9 @@ public class InputManager {
private final Keyboard keyboard;
private final HardwareTouchDevice touchDevice;
- public InputManager(Keyboard k, HardwareTouchDevice t) {
- this.keyboard = k;
- this.touchDevice = t;
+ public InputManager(final Keyboard k, final HardwareTouchDevice t) {
+ keyboard = k;
+ touchDevice = t;
}
public Keyboard getKeyboard() {
diff --git a/core/src/main/java/it/cavallium/warppi/device/Keyboard.java b/core/src/main/java/it/cavallium/warppi/device/Keyboard.java
index f6df9d0b..d9edafea 100644
--- a/core/src/main/java/it/cavallium/warppi/device/Keyboard.java
+++ b/core/src/main/java/it/cavallium/warppi/device/Keyboard.java
@@ -41,36 +41,36 @@ public class Keyboard {
public synchronized void startKeyboard() {
final Thread kt = new Thread(() -> {
- if (Engine.getPlatform().getSettings().isDebugEnabled()) {
+ if (Engine.getPlatform().getSettings().isDebugEnabled())
try {
while (true) {
- if (debugKeyCode != -1) {
- debugKeyPressed(debugKeyCode);
- debugKeyCode = -1;
+ if (Keyboard.debugKeyCode != -1) {
+ Keyboard.debugKeyPressed(Keyboard.debugKeyCode);
+ Keyboard.debugKeyCode = -1;
}
- if (debugKeyCodeRelease != -1) {
- debugKeyReleased(debugKeyCodeRelease);
- debugKeyCodeRelease = -1;
+ if (Keyboard.debugKeyCodeRelease != -1) {
+ Keyboard.debugKeyReleased(Keyboard.debugKeyCodeRelease);
+ Keyboard.debugKeyCodeRelease = -1;
}
Thread.sleep(50);
}
} catch (final InterruptedException e) {}
- } else {
- Engine.getPlatform().getGpio().pinMode(CLK_INH_pin, Engine.getPlatform().getGpio().valueOutput());
- Engine.getPlatform().getGpio().pinMode(RCK_pin, Engine.getPlatform().getGpio().valueOutput());
- Engine.getPlatform().getGpio().pinMode(SER_pin, Engine.getPlatform().getGpio().valueOutput());
- Engine.getPlatform().getGpio().pinMode(SH_LD_pin, Engine.getPlatform().getGpio().valueOutput());
- Engine.getPlatform().getGpio().pinMode(SCK_and_CLK_pin, Engine.getPlatform().getGpio().valueOutput());
- Engine.getPlatform().getGpio().pinMode(QH_pin, Engine.getPlatform().getGpio().valueInput());
+ else {
+ Engine.getPlatform().getGpio().pinMode(Keyboard.CLK_INH_pin, Engine.getPlatform().getGpio().valueOutput());
+ Engine.getPlatform().getGpio().pinMode(Keyboard.RCK_pin, Engine.getPlatform().getGpio().valueOutput());
+ Engine.getPlatform().getGpio().pinMode(Keyboard.SER_pin, Engine.getPlatform().getGpio().valueOutput());
+ Engine.getPlatform().getGpio().pinMode(Keyboard.SH_LD_pin, Engine.getPlatform().getGpio().valueOutput());
+ Engine.getPlatform().getGpio().pinMode(Keyboard.SCK_and_CLK_pin, Engine.getPlatform().getGpio().valueOutput());
+ Engine.getPlatform().getGpio().pinMode(Keyboard.QH_pin, Engine.getPlatform().getGpio().valueInput());
- Engine.getPlatform().getGpio().digitalWrite(CLK_INH_pin, false);
- Engine.getPlatform().getGpio().digitalWrite(RCK_pin, false);
- Engine.getPlatform().getGpio().digitalWrite(SER_pin, false);
- Engine.getPlatform().getGpio().digitalWrite(SH_LD_pin, false);
- Engine.getPlatform().getGpio().digitalWrite(SCK_and_CLK_pin, false);
- Engine.getPlatform().getGpio().digitalWrite(QH_pin, false);
- final SerialToParallel chip1 = new SerialToParallel(RCK_pin, SCK_and_CLK_pin /*SCK*/, SER_pin);
- final ParallelToSerial chip2 = new ParallelToSerial(SH_LD_pin, CLK_INH_pin, QH_pin, SCK_and_CLK_pin/*CLK*/);
+ Engine.getPlatform().getGpio().digitalWrite(Keyboard.CLK_INH_pin, false);
+ Engine.getPlatform().getGpio().digitalWrite(Keyboard.RCK_pin, false);
+ Engine.getPlatform().getGpio().digitalWrite(Keyboard.SER_pin, false);
+ Engine.getPlatform().getGpio().digitalWrite(Keyboard.SH_LD_pin, false);
+ Engine.getPlatform().getGpio().digitalWrite(Keyboard.SCK_and_CLK_pin, false);
+ Engine.getPlatform().getGpio().digitalWrite(Keyboard.QH_pin, false);
+ final SerialToParallel chip1 = new SerialToParallel(Keyboard.RCK_pin, Keyboard.SCK_and_CLK_pin /*SCK*/, Keyboard.SER_pin);
+ final ParallelToSerial chip2 = new ParallelToSerial(Keyboard.SH_LD_pin, Keyboard.CLK_INH_pin, Keyboard.QH_pin, Keyboard.SCK_and_CLK_pin/*CLK*/);
KeyboardDebugScreen.log("Started keyboard system");
@@ -85,15 +85,14 @@ public class Keyboard {
// KeyboardDebugScreen.ks[col] = data;
for (int row = 0; row < 8; row++) {
- if (data[row] == true && precedentStates[row][col] == false) {
-// System.out.println("Pressed button at " + (row + 1) + ", " + (col + 1));
+ 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));
- keyPressedRaw(row, col);
- } else if (data[row] == false && precedentStates[row][col] == true) {
- keyReleasedRaw(row, col);
+ Keyboard.keyPressedRaw(row, col);
+ else if (data[row] == false && Keyboard.precedentStates[row][col] == true)
+ Keyboard.keyReleasedRaw(row, col);
// KeyboardDebugScreen.log("Released button at " + (row + 1) + ", " + (col + 1));
- }
- precedentStates[row][col] = data[row];
+ Keyboard.precedentStates[row][col] = data[row];
}
}
}
@@ -105,259 +104,229 @@ public class Keyboard {
kt.start();
}
- public static void debugKeyPressed(int keyCode) {
+ public static void debugKeyPressed(final int keyCode) {
switch (keyCode) {
case KeyEvent.VK_ESCAPE:
Keyboard.keyPressed(Key.POWEROFF);
break;
case KeyEvent.VK_S:
- if (Keyboard.shift) {
+ if (Keyboard.shift)
Keyboard.keyPressed(Key.ARCSINE);
- } else if (Keyboard.alpha) {
+ else if (Keyboard.alpha)
Keyboard.keyPressed(Key.LETTER_S);
- } else {
+ else
Keyboard.keyPressed(Key.SINE);
- }
break;
case KeyEvent.VK_C:
- if (Keyboard.shift) {
+ if (Keyboard.shift)
Keyboard.keyPressed(Key.ARCCOSINE);
- } else if (Keyboard.alpha) {
+ else if (Keyboard.alpha)
Keyboard.keyPressed(Key.LETTER_C);
- } else {
+ else
Keyboard.keyPressed(Key.COSINE);
- }
break;
case KeyEvent.VK_T:
- if (Keyboard.shift) {
+ if (Keyboard.shift)
Keyboard.keyPressed(Key.ARCTANGENT);
- } else if (Keyboard.alpha) {
+ else if (Keyboard.alpha)
Keyboard.keyPressed(Key.LETTER_T);
- } else {
+ else
Keyboard.keyPressed(Key.TANGENT);
- }
break;
case KeyEvent.VK_D:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.debug_DEG);
- } else if (Keyboard.alpha) {
+ else if (Keyboard.alpha)
Keyboard.keyPressed(Key.LETTER_D);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_R:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.debug_RAD);
- } else if (Keyboard.alpha) {
+ else if (Keyboard.alpha)
Keyboard.keyPressed(Key.LETTER_R);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_G:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.debug_GRA);
- } else if (Keyboard.alpha) {
+ else if (Keyboard.alpha)
Keyboard.keyPressed(Key.LETTER_G);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_X:
- if (Keyboard.alpha) {
+ if (Keyboard.alpha)
Keyboard.keyPressed(Key.LETTER_X);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_P:
- if (Keyboard.shift) {
+ if (Keyboard.shift)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha) {
+ else if (Keyboard.alpha)
Keyboard.keyPressed(Key.LETTER_P);
- } else {
+ else
Keyboard.keyPressed(Key.PI);
- }
break;
case KeyEvent.VK_E:
- if (Keyboard.shift) {
+ if (Keyboard.shift)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha) {
+ else if (Keyboard.alpha)
Keyboard.keyPressed(Key.LETTER_E);
- } else {
+ else
Keyboard.keyPressed(Key.EULER_NUMBER);
- }
break;
case KeyEvent.VK_Y:
- if (Keyboard.alpha) {
+ if (Keyboard.alpha)
Keyboard.keyPressed(Key.LETTER_Y);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_B:
- if (Keyboard.shift) {
+ if (Keyboard.shift)
Keyboard.keyPressed(Key.BRIGHTNESS_CYCLE_REVERSE);
- } else if (!Keyboard.shift && !Keyboard.alpha) {
+ else if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.BRIGHTNESS_CYCLE);
- } else {
+ else
Keyboard.keyPressed(Key.LETTER_B);
- }
break;
case KeyEvent.VK_L:
- if (Keyboard.shift) {
+ if (Keyboard.shift)
Keyboard.keyPressed(Key.LOGARITHM);
- } else if (Keyboard.alpha) {
+ else if (Keyboard.alpha)
Keyboard.keyPressed(Key.LETTER_L);
- } else {
+ else
Keyboard.keyPressed(Key.LOGARITHM);
- }
break;
case KeyboardJogampValues.VK_ENTER:
case KeyEvent.VK_ENTER:
- if (Keyboard.shift) {
+ if (Keyboard.shift)
Keyboard.keyPressed(Key.STEP);
- } else if (!Keyboard.shift && !Keyboard.alpha) {
+ else if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.SIMPLIFY);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
int row = 2;
int col = 1;
Keyboard.debugKeysDown[row - 1][col - 1] = true;
break;
case KeyEvent.VK_1:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NUM1);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_2:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NUM2);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_3:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NUM3);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_4:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NUM4);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_5:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NUM5);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_6:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NUM6);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_7:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NUM7);
- } else if (Keyboard.shift) {
- if (Engine.getPlatform().getSettings().isDebugEnabled()) {
+ else if (Keyboard.shift)
+ if (Engine.getPlatform().getSettings().isDebugEnabled())
Keyboard.keyPressed(Key.DIVIDE);
- }
- }
break;
case KeyEvent.VK_8:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NUM8);
- } else if (Keyboard.shift) {
+ else if (Keyboard.shift)
Keyboard.keyPressed(Key.PARENTHESIS_OPEN);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_9:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NUM9);
- } else if (Keyboard.shift) {
+ else if (Keyboard.shift)
Keyboard.keyPressed(Key.PARENTHESIS_CLOSE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_0:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NUM0);
- } else if (Keyboard.shift) {
+ else if (Keyboard.shift)
Keyboard.keyPressed(Key.EQUAL);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_M:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.SURD_MODE);
- } else if (Keyboard.shift) {
+ else if (Keyboard.shift)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.LETTER_M);
- }
break;
case KeyboardJogampValues.VK_ADD:
case KeyEvent.VK_ADD:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.PLUS);
- } else if (Keyboard.shift) {
+ else if (Keyboard.shift)
Keyboard.keyPressed(Key.PLUS_MINUS);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyboardJogampValues.VK_SUBTRACT:
case KeyEvent.VK_SUBTRACT:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.MINUS);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyboardJogampValues.VK_MULTIPLY:
case KeyEvent.VK_MULTIPLY:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.MULTIPLY);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyboardJogampValues.VK_DIVIDE:
case KeyEvent.VK_DIVIDE:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.DIVIDE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_BACK_SPACE:
Keyboard.keyPressed(Key.DELETE);
break;
case KeyboardJogampValues.VK_DELETE:
case KeyEvent.VK_DELETE:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.RESET);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyboardJogampValues.VK_LEFT:
case KeyEvent.VK_LEFT:
@@ -365,11 +334,10 @@ public class Keyboard {
row = 2;
col = 3;
Keyboard.debugKeysDown[row - 1][col - 1] = true;
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.LEFT);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyboardJogampValues.VK_RIGHT:
case KeyEvent.VK_RIGHT:
@@ -377,11 +345,10 @@ public class Keyboard {
row = 2;
col = 5;
Keyboard.debugKeysDown[row - 1][col - 1] = true;
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.RIGHT);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyboardJogampValues.VK_UP:
case KeyEvent.VK_UP:
@@ -389,11 +356,10 @@ public class Keyboard {
row = 1;
col = 4;
Keyboard.debugKeysDown[row - 1][col - 1] = true;
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.UP);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyboardJogampValues.VK_DOWN:
case KeyEvent.VK_DOWN:
@@ -401,188 +367,170 @@ public class Keyboard {
row = 3;
col = 4;
Keyboard.debugKeysDown[row - 1][col - 1] = true;
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.DOWN);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case (short) 12:
//DOWN
row = 2;
col = 4;
Keyboard.debugKeysDown[row - 1][col - 1] = true;
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.OK);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyboardJogampValues.VK_NUMPAD4:
case KeyEvent.VK_NUMPAD4:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.HISTORY_BACK);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyboardJogampValues.VK_NUMPAD6:
case KeyEvent.VK_NUMPAD6:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.HISTORY_FORWARD);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_PERIOD:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.DOT);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_A:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_A);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_F:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_F);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_H:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_H);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_I:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_I);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_J:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_J);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_K:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_K);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_N:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_N);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_O:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_O);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_Q:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_Q);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_U:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_U);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_V:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_V);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_W:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_W);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyEvent.VK_Z:
- if (!Keyboard.shift && !Keyboard.alpha) {
+ if (!Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.NONE);
- } else if (Keyboard.alpha && !Keyboard.shift) {
+ else if (Keyboard.alpha && !Keyboard.shift)
Keyboard.keyPressed(Key.LETTER_Z);
- } else if (Keyboard.shift && !Keyboard.alpha) {
+ else if (Keyboard.shift && !Keyboard.alpha)
Keyboard.keyPressed(Key.ZOOM_MODE);
- } else {
+ else
Keyboard.keyPressed(Key.NONE);
- }
break;
case KeyboardJogampValues.VK_SHIFT:
case KeyEvent.VK_SHIFT:
@@ -610,7 +558,7 @@ public class Keyboard {
}
}
- private synchronized static void debugKeyReleased(int keyCode) {
+ private synchronized static void debugKeyReleased(final int keyCode) {
switch (keyCode) {
case KeyEvent.VK_ENTER:
int row = 2;
@@ -655,15 +603,14 @@ public class Keyboard {
}
}
- public static boolean isKeyDown(int row, int col) {
- if (Engine.getPlatform().getSettings().isDebugEnabled() == false) {
- return precedentStates[row - 1][col - 1];
- } else {
- return debugKeysDown[row - 1][col - 1];
- }
+ public static boolean isKeyDown(final int row, final int col) {
+ if (Engine.getPlatform().getSettings().isDebugEnabled() == false)
+ return Keyboard.precedentStates[row - 1][col - 1];
+ else
+ return Keyboard.debugKeysDown[row - 1][col - 1];
}
- public synchronized static void keyReleasedRaw(int row, int col) {
+ public synchronized static void keyReleasedRaw(final int row, final int col) {
// KeyboardDebugScreen.keyX = row;
// KeyboardDebugScreen.keyY = col;
if (row == 1 && col == 1) {
@@ -672,80 +619,80 @@ public class Keyboard {
}
static final String[][][] KeyLabelsMap = /* [ROW, COLUMN, (0:normal 1:shift 2:alpha)] */
- { { /* ROW 0 */
- { "⇪", "⇪", null }, /* 0,0 */
- { "A", null, "A" }, /* 0,1 */
- {"", null, null }, /* 0,2 */
- { "⇧", null, null }, /* 0,3 */
- {"", null, null }, /* 0,4 */
- {"", null, null }, /* 0,5 */
- { "☼", "☼", null }, /* 0,6 */
- {"↩", null, null } /* 0,7 */
- }, { /* ROW 1 */
- {"", null, null }, /* 1,0 */
- {"", null, null }, /* 1,1 */
- {"⇦", null, null }, /* 1,2 */
- {"OK", null, null }, /* 1,3 */
- {"⇨", null, null }, /* 1,4 */
- {"↤", null, null }, /* 1,5 */
- {"↦", null, null }, /* 1,6 */
- {"", null, null } /* 1,7 */
- }, { /* ROW 2 */
- {"", null, null }, /* 2,0 */
- {"√", null, null }, /* 2,1 */
- {"", null, null }, /* 2,2 */
- {"⇩", null, null }, /* 2,3 */
- {"↶", null, null }, /* 2,4 */
- {"", null, null }, /* 2,5 */
- {"", null, null }, /* 2,6 */
- {"", null, null } /* 2,7 */
- }, { /* ROW 3 */
- {"", null, null }, /* 3,0 */
- {"", null, null }, /* 3,1 */
- {"^x", null, null }, /* 3,2 */
- {"^2", null, null }, /* 3,3 */
- {"", null, null }, /* 3,4 */
- {"", null, null }, /* 3,5 */
- {"", null, null }, /* 3,6 */
- {".", null, "y" } /* 3,7 */
- }, { /* ROW 4 */
- {"", null, null }, /* 4,0 */
- {"", null, null }, /* 4,1 */
- {"(", null, null }, /* 4,2 */
- {")", null, null }, /* 4,3 */
- {"", null, null }, /* 4,4 */
- {"S⇔D", null, null }, /* 4,5 */
- {"", null, null }, /* 4,6 */
- {"0", null, "x" } /* 4,7 */
- }, { /* ROW 5 */
- {"7", null, null }, /* 5,0 */
- {"8", null, null }, /* 5,1 */
- {"9", null, null }, /* 5,2 */
- {"⌫", null, null }, /* 5,3 */
- {"RESET", null, null }, /* 5,4 */
- {"", null, null }, /* 5,5 */
- {"", null, null }, /* 5,6 */
- {"", null, null } /* 5,7 */
- }, { /* ROW 6 */
- {"4", null, null }, /* 6,0 */
- {"5", null, null }, /* 6,1 */
- {"6", null, null }, /* 6,2 */
- {"*", null, null }, /* 6,3 */
- {"/", null, null }, /* 6,4 */
- {"", null, null }, /* 6,5 */
- {"", null, null }, /* 6,6 */
- {"", null, null } /* 6,7 */
- }, { /* ROW 7 */
- {"1", null, null }, /* 7,0 */
- {"2", null, null }, /* 7,1 */
- {"3", null, null }, /* 7,2 */
- {"+", null, null }, /* 7,3 */
- {"-", null, null }, /* 7,4 */
- {"", null, null }, /* 7,5 */
- {"", null, null }, /* 7,6 */
- {"", null, null } /* 7,7 */
- } };
-
+ { { /* ROW 0 */
+ { "⇪", "⇪", null }, /* 0,0 */
+ { "A", null, "A" }, /* 0,1 */
+ { "", null, null }, /* 0,2 */
+ { "⇧", null, null }, /* 0,3 */
+ { "", null, null }, /* 0,4 */
+ { "", null, null }, /* 0,5 */
+ { "☼", "☼", null }, /* 0,6 */
+ { "↩", null, null } /* 0,7 */
+ }, { /* ROW 1 */
+ { "", null, null }, /* 1,0 */
+ { "", null, null }, /* 1,1 */
+ { "⇦", null, null }, /* 1,2 */
+ { "OK", null, null }, /* 1,3 */
+ { "⇨", null, null }, /* 1,4 */
+ { "↤", null, null }, /* 1,5 */
+ { "↦", null, null }, /* 1,6 */
+ { "", null, null } /* 1,7 */
+ }, { /* ROW 2 */
+ { "", null, null }, /* 2,0 */
+ { "√", null, null }, /* 2,1 */
+ { "", null, null }, /* 2,2 */
+ { "⇩", null, null }, /* 2,3 */
+ { "↶", null, null }, /* 2,4 */
+ { "", null, null }, /* 2,5 */
+ { "", null, null }, /* 2,6 */
+ { "", null, null } /* 2,7 */
+ }, { /* ROW 3 */
+ { "", null, null }, /* 3,0 */
+ { "", null, null }, /* 3,1 */
+ { "^x", null, null }, /* 3,2 */
+ { "^2", null, null }, /* 3,3 */
+ { "", null, null }, /* 3,4 */
+ { "", null, null }, /* 3,5 */
+ { "", null, null }, /* 3,6 */
+ { ".", null, "y" } /* 3,7 */
+ }, { /* ROW 4 */
+ { "", null, null }, /* 4,0 */
+ { "", null, null }, /* 4,1 */
+ { "(", null, null }, /* 4,2 */
+ { ")", null, null }, /* 4,3 */
+ { "", null, null }, /* 4,4 */
+ { "S⇔D", null, null }, /* 4,5 */
+ { "", null, null }, /* 4,6 */
+ { "0", null, "x" } /* 4,7 */
+ }, { /* ROW 5 */
+ { "7", null, null }, /* 5,0 */
+ { "8", null, null }, /* 5,1 */
+ { "9", null, null }, /* 5,2 */
+ { "⌫", null, null }, /* 5,3 */
+ { "RESET", null, null }, /* 5,4 */
+ { "", null, null }, /* 5,5 */
+ { "", null, null }, /* 5,6 */
+ { "", null, null } /* 5,7 */
+ }, { /* ROW 6 */
+ { "4", null, null }, /* 6,0 */
+ { "5", null, null }, /* 6,1 */
+ { "6", null, null }, /* 6,2 */
+ { "*", null, null }, /* 6,3 */
+ { "/", null, null }, /* 6,4 */
+ { "", null, null }, /* 6,5 */
+ { "", null, null }, /* 6,6 */
+ { "", null, null } /* 6,7 */
+ }, { /* ROW 7 */
+ { "1", null, null }, /* 7,0 */
+ { "2", null, null }, /* 7,1 */
+ { "3", null, null }, /* 7,2 */
+ { "+", null, null }, /* 7,3 */
+ { "-", null, null }, /* 7,4 */
+ { "", null, null }, /* 7,5 */
+ { "", null, null }, /* 7,6 */
+ { "", null, null } /* 7,7 */
+ } };
+
static final Key[][][] keyMap = /* [ROW, COLUMN, (0:normal 1:shift 2:alpha)] */
{ { /* ROW 0 */
{ Key.SHIFT, Key.SHIFT, Key.SHIFT }, /* 0,0 */
@@ -820,45 +767,40 @@ public class Keyboard {
{ Key.NONE, Key.NONE, Key.NONE }, /* 7,6 */
{ Key.NONE, Key.NONE, Key.NONE } /* 7,7 */
} };
-
- public static String getKeyName(int row, int col) {
- return getKeyName(row, col, shift, alpha);
+
+ public static String getKeyName(final int row, final int col) {
+ return Keyboard.getKeyName(row, col, Keyboard.shift, Keyboard.alpha);
}
-
- public static String getKeyName(int row, int col, boolean shift, boolean alpha) {
- String[] keyValues = KeyLabelsMap[row][col];
+
+ public static String getKeyName(final int row, final int col, final boolean shift, final boolean alpha) {
+ final String[] keyValues = Keyboard.KeyLabelsMap[row][col];
if (shift) {
- if (keyValues[1] != null) {
+ if (keyValues[1] != null)
return keyValues[1];
- }
- } else if (alpha) {
- if (keyValues[2] != null) {
+ } else if (alpha)
+ if (keyValues[2] != null)
return keyValues[2];
- }
- }
return keyValues[0];
}
- public static boolean hasKeyName(int row, int col) {
- String[] keyValues = KeyLabelsMap[row][col];
- if (shift) {
+ public static boolean hasKeyName(final int row, final int col) {
+ final String[] keyValues = Keyboard.KeyLabelsMap[row][col];
+ if (Keyboard.shift)
return keyValues[1] != null;
- } else if (alpha) {
+ else if (Keyboard.alpha)
return keyValues[2] != null;
- } else {
+ else
return true;
- }
}
- public static synchronized void keyPressedRaw(int row, int col) {
+ public static synchronized void keyPressedRaw(final int row, final int col) {
// KeyboardDebugScreen.keyX = row;
// KeyboardDebugScreen.keyY = col;
- final Key k = keyMap[row][col][shift ? 1 : alpha ? 2 : 0];
- if (k != null) {
- keyPressed(k);
- } else {
- keyPressed(Key.NONE);
- }
+ final Key k = Keyboard.keyMap[row][col][Keyboard.shift ? 1 : Keyboard.alpha ? 2 : 0];
+ if (k != null)
+ Keyboard.keyPressed(k);
+ else
+ Keyboard.keyPressed(Key.NONE);
}
public static void stopKeyboard() {
@@ -872,15 +814,14 @@ public class Keyboard {
}
}
- public synchronized static void keyPressed(Key k) {
+ public synchronized static void keyPressed(final Key k) {
boolean done = false;
- if (additionalListener != null) {
+ if (Keyboard.additionalListener != null)
try {
- done = additionalListener.onKeyPressed(new KeyPressedEvent(k));
+ done = Keyboard.additionalListener.onKeyPressed(new KeyPressedEvent(k));
} catch (final Exception ex) {
new GUIErrorMessage(ex);
}
- }
if (Engine.INSTANCE.getHardwareDevice().getDisplayManager() != null) {
final Screen scr = Engine.INSTANCE.getHardwareDevice().getDisplayManager().getScreen();
boolean refresh = false;
@@ -890,9 +831,9 @@ public class Keyboard {
} catch (final Exception ex) {
new GUIErrorMessage(ex);
}
- if (scr != null && scr.initialized && scrdone) {
+ if (scr != null && scr.initialized && scrdone)
refresh = true;
- } else {
+ else
switch (k) {
case POWEROFF:
Engine.INSTANCE.getHardwareDevice().getDisplayManager().engine.destroy();
@@ -909,7 +850,7 @@ public class Keyboard {
refresh = true;
break;
case ZOOM_MODE:
- float newZoom = (StaticVars.windowZoom.getLastValue() % 3) + 1;
+ final float newZoom = StaticVars.windowZoom.getLastValue() % 3 + 1;
StaticVars.windowZoom.onNext(newZoom);
Engine.getPlatform().getConsoleUtils().out().println(ConsoleUtils.OUTPUTLEVEL_DEBUG_MIN, "Keyboard", "Zoom: " + newZoom);
// StaticVars.windowZoom = ((StaticVars.windowZoom - 0.5f) % 2f) + 1f;
@@ -925,7 +866,6 @@ public class Keyboard {
default:
break;
}
- }
switch (k) {
case SHIFT:
if (Keyboard.alpha)
@@ -948,47 +888,41 @@ public class Keyboard {
}
break;
}
- if (refresh) {
- refreshRequest = true;
- }
- } else if (!done) {
+ if (refresh)
+ Keyboard.refreshRequest = true;
+ } else if (!done)
Engine.getPlatform().getConsoleUtils().out().println(1, "Key " + k.toString() + " ignored.");
- }
}
- public synchronized static void keyReleased(Key k) {
+ public synchronized static void keyReleased(final Key k) {
boolean done = false;
- if (additionalListener != null) {
- done = additionalListener.onKeyReleased(new KeyReleasedEvent(k));
- }
+ if (Keyboard.additionalListener != null)
+ done = Keyboard.additionalListener.onKeyReleased(new KeyReleasedEvent(k));
boolean refresh = false;
if (Engine.INSTANCE.getHardwareDevice().getDisplayManager() != null) {
final Screen scr = Engine.INSTANCE.getHardwareDevice().getDisplayManager().getScreen();
- if (scr != null && scr.initialized && scr.onKeyReleased(new KeyReleasedEvent(k))) {
+ if (scr != null && scr.initialized && scr.onKeyReleased(new KeyReleasedEvent(k)))
refresh = true;
- } else {
+ else
switch (k) {
case NONE:
break;
default:
break;
}
- }
- if (refresh) {
- refreshRequest = true;
- }
- } else if (!done) {
+ if (refresh)
+ Keyboard.refreshRequest = true;
+ } else if (!done)
Engine.getPlatform().getConsoleUtils().out().println(1, "Key " + k.toString() + " ignored.");
- }
}
- public void setAdditionalKeyboardListener(KeyboardEventListener l) {
- additionalListener = l;
+ public void setAdditionalKeyboardListener(final KeyboardEventListener l) {
+ Keyboard.additionalListener = l;
}
public static boolean popRefreshRequest() {
- if (refreshRequest) {
- refreshRequest = false;
+ if (Keyboard.refreshRequest) {
+ Keyboard.refreshRequest = false;
return true;
}
return false;
@@ -1007,7 +941,7 @@ Keyboard:
| SHIFT STATE |
| ALPHA STATE |
|--------------|
-
+
Physical keyboard:
|0,0-----|0,1-----|########|0,3-----|########|0,5-----|0,6-----|
| SHIFT | ALPHA |########| ^ |########|SETTINGS|+BRIGHT |
@@ -1050,28 +984,28 @@ Keyboard:
SCREEN F_n:
MathInputScreen:
Default:
- [F_1] Normal: Solve for X Shift: Solve for _ Alpha:
- [F_2] Normal: Shift: Alpha:
- [F_3] Normal: Variables & constants Shift: Alpha:
- [F_4] Normal: Functions f(x) Shift: Alpha:
+ [F_1] Normal: Solve for X Shift: Solve for _ Alpha:
+ [F_2] Normal: Shift: Alpha:
+ [F_3] Normal: Variables & constants Shift: Alpha:
+ [F_4] Normal: Functions f(x) Shift: Alpha:
Variable popup:
- [F_1] Normal(if constant):Set value Shift: Alpha:
- [F_2] Normal: Shift: Alpha:
- [F_3] Normal: Shift: Alpha:
- [F_4] Normal: Shift: Alpha:
+ [F_1] Normal(if constant):Set value Shift: Alpha:
+ [F_2] Normal: Shift: Alpha:
+ [F_3] Normal: Shift: Alpha:
+ [F_4] Normal: Shift: Alpha:
MarioScreen
- [F_1] Normal: Shift: Alpha:
- [F_2] Normal: Shift: Alpha:
- [F_3] Normal: Shift: Alpha:
- [F_4] Normal: Shift: Alpha:
+ [F_1] Normal: Shift: Alpha:
+ [F_2] Normal: Shift: Alpha:
+ [F_3] Normal: Shift: Alpha:
+ [F_4] Normal: Shift: Alpha:
ChooseVariableValueScreen
- [F_1] Normal: Shift: Alpha:
- [F_2] Normal: Shift: Alpha:
- [F_3] Normal: Shift: Alpha:
- [F_4] Normal: Shift: Alpha:
+ [F_1] Normal: Shift: Alpha:
+ [F_2] Normal: Shift: Alpha:
+ [F_3] Normal: Shift: Alpha:
+ [F_4] Normal: Shift: Alpha:
SolveForXScreen
- [F_1] Normal: Shift: Alpha:
- [F_2] Normal: Shift: Alpha:
- [F_3] Normal: Shift: Alpha:
- [F_4] Normal: Shift: Alpha:
+ [F_1] Normal: Shift: Alpha:
+ [F_2] Normal: Shift: Alpha:
+ [F_3] Normal: Shift: Alpha:
+ [F_4] Normal: Shift: Alpha:
*/
\ No newline at end of file
diff --git a/core/src/main/java/it/cavallium/warppi/device/KeyboardJogampValues.java b/core/src/main/java/it/cavallium/warppi/device/KeyboardJogampValues.java
index 7a59f6f7..1cfe22e3 100644
--- a/core/src/main/java/it/cavallium/warppi/device/KeyboardJogampValues.java
+++ b/core/src/main/java/it/cavallium/warppi/device/KeyboardJogampValues.java
@@ -9,108 +9,108 @@ public interface KeyboardJogampValues {
/**
* This value, {@value}, is used to indicate that the keyCode is unknown.
*/
- public static final short VK_UNDEFINED = (short) 0x0;
+ short VK_UNDEFINED = (short) 0x0;
- static final short VK_FREE01 = (short) 0x01;
+ short VK_FREE01 = (short) 0x01;
/** Constant for the HOME function key. ASCII: Start Of Text. */
- public static final short VK_HOME = (short) 0x02;
+ short VK_HOME = (short) 0x02;
/** Constant for the END function key. ASCII: End Of Text. */
- public static final short VK_END = (short) 0x03;
+ short VK_END = (short) 0x03;
/** Constant for the END function key. ASCII: End Of Transmission. */
- public static final short VK_FINAL = (short) 0x04;
+ short VK_FINAL = (short) 0x04;
/** Constant for the PRINT function key. ASCII: Enquiry. */
- public static final short VK_PRINTSCREEN = (short) 0x05;
+ short VK_PRINTSCREEN = (short) 0x05;
- static final short VK_FREE06 = (short) 0x06;
- static final short VK_FREE07 = (short) 0x07;
+ short VK_FREE06 = (short) 0x06;
+ short VK_FREE07 = (short) 0x07;
/** Constant for the BACK SPACE key "\b", matching ASCII. Printable! */
- public static final short VK_BACK_SPACE = (short) 0x08;
+ short VK_BACK_SPACE = (short) 0x08;
/** Constant for the HORIZ TAB key "\t", matching ASCII. Printable! */
- public static final short VK_TAB = (short) 0x09;
+ short VK_TAB = (short) 0x09;
/** LINE_FEED "\n", matching ASCII, n/a on keyboard. */
- static final short VK_FREE0A = (short) 0x0A;
+ short VK_FREE0A = (short) 0x0A;
/** Constant for the PAGE DOWN function key. ASCII: Vertical Tabulation. */
- public static final short VK_PAGE_DOWN = (short) 0x0B;
+ short VK_PAGE_DOWN = (short) 0x0B;
/** Constant for the CLEAR key, i.e. FORM FEED, matching ASCII. */
- public static final short VK_CLEAR = (short) 0x0C;
+ short VK_CLEAR = (short) 0x0C;
/**
* Constant for the ENTER key, i.e. CARRIAGE RETURN, matching ASCII.
* Printable!
*/
- public static final short VK_ENTER = (short) 0x0D;
+ short VK_ENTER = (short) 0x0D;
- static final short VK_FREE0E = (short) 0x0E;
+ short VK_FREE0E = (short) 0x0E;
/** Constant for the CTRL function key. ASCII: shift-in. */
- public static final short VK_SHIFT = (short) 0x0F;
+ short VK_SHIFT = (short) 0x0F;
/** Constant for the PAGE UP function key. ASCII: Data Link Escape. */
- public static final short VK_PAGE_UP = (short) 0x10;
+ short VK_PAGE_UP = (short) 0x10;
/** Constant for the CTRL function key. ASCII: device-ctrl-one. */
- public static final short VK_CONTROL = (short) 0x11;
+ short VK_CONTROL = (short) 0x11;
/** Constant for the left ALT function key. ASCII: device-ctrl-two. */
- public static final short VK_ALT = (short) 0x12;
+ short VK_ALT = (short) 0x12;
/**
* Constant for the ALT_GRAPH function key, i.e. right ALT key. ASCII:
* device-ctrl-three.
*/
- public static final short VK_ALT_GRAPH = (short) 0x13;
+ short VK_ALT_GRAPH = (short) 0x13;
/** Constant for the CAPS LOCK function key. ASCII: device-ctrl-four. */
- public static final short VK_CAPS_LOCK = (short) 0x14;
+ short VK_CAPS_LOCK = (short) 0x14;
- static final short VK_FREE15 = (short) 0x15;
+ short VK_FREE15 = (short) 0x15;
/** Constant for the PAUSE function key. ASCII: sync-idle. */
- public static final short VK_PAUSE = (short) 0x16;
+ short VK_PAUSE = (short) 0x16;
/** scroll lock key. ASCII: End Of Transmission Block. */
- public static final short VK_SCROLL_LOCK = (short) 0x17;
+ short VK_SCROLL_LOCK = (short) 0x17;
/** Constant for the CANCEL function key. ASCII: Cancel. */
- public static final short VK_CANCEL = (short) 0x18;
+ short VK_CANCEL = (short) 0x18;
- static final short VK_FREE19 = (short) 0x19;
+ short VK_FREE19 = (short) 0x19;
/** Constant for the INSERT function key. ASCII: Substitute. */
- public static final short VK_INSERT = (short) 0x1A;
+ short VK_INSERT = (short) 0x1A;
/** Constant for the ESCAPE function key. ASCII: Escape. */
- public static final short VK_ESCAPE = (short) 0x1B;
+ short VK_ESCAPE = (short) 0x1B;
/**
* Constant for the Convert function key, Japanese "henkan". ASCII: File
* Separator.
*/
- public static final short VK_CONVERT = (short) 0x1C;
+ short VK_CONVERT = (short) 0x1C;
/**
* Constant for the Don't Convert function key, Japanese "muhenkan". ASCII:
* Group Separator.
*/
- public static final short VK_NONCONVERT = (short) 0x1D;
+ short VK_NONCONVERT = (short) 0x1D;
/**
* Constant for the Accept or Commit function key, Japanese "kakutei".
* ASCII: Record Separator.
*/
- public static final short VK_ACCEPT = (short) 0x1E;
+ short VK_ACCEPT = (short) 0x1E;
/** Constant for the Mode Change (?). ASCII: Unit Separator. */
- public static final short VK_MODECHANGE = (short) 0x1F;
+ short VK_MODECHANGE = (short) 0x1F;
//
// Unicode: Printable [0x20 - 0x7E]
@@ -118,168 +118,168 @@ public interface KeyboardJogampValues {
//
/** Constant for the SPACE function key. ASCII: SPACE. */
- public static final short VK_SPACE = (short) 0x20;
+ short VK_SPACE = (short) 0x20;
/** Constant for the "!" key. */
- public static final short VK_EXCLAMATION_MARK = (short) 0x21;
+ short VK_EXCLAMATION_MARK = (short) 0x21;
/** Constant for the """ key. */
- public static final short VK_QUOTEDBL = (short) 0x22;
+ short VK_QUOTEDBL = (short) 0x22;
/** Constant for the "#" key. */
- public static final short VK_NUMBER_SIGN = (short) 0x23;
+ short VK_NUMBER_SIGN = (short) 0x23;
/** Constant for the "$" key. */
- public static final short VK_DOLLAR = (short) 0x24;
+ short VK_DOLLAR = (short) 0x24;
/** Constant for the "%" key. */
- public static final short VK_PERCENT = (short) 0x25;
+ short VK_PERCENT = (short) 0x25;
/** Constant for the "&" key. */
- public static final short VK_AMPERSAND = (short) 0x26;
+ short VK_AMPERSAND = (short) 0x26;
/** Constant for the "'" key. */
- public static final short VK_QUOTE = (short) 0x27;
+ short VK_QUOTE = (short) 0x27;
/** Constant for the "(" key. */
- public static final short VK_LEFT_PARENTHESIS = (short) 0x28;
+ short VK_LEFT_PARENTHESIS = (short) 0x28;
/** Constant for the ")" key. */
- public static final short VK_RIGHT_PARENTHESIS = (short) 0x29;
+ short VK_RIGHT_PARENTHESIS = (short) 0x29;
/** Constant for the "*" key */
- public static final short VK_ASTERISK = (short) 0x2A;
+ short VK_ASTERISK = (short) 0x2A;
/** Constant for the "+" key. */
- public static final short VK_PLUS = (short) 0x2B;
+ short VK_PLUS = (short) 0x2B;
/** Constant for the comma key, "," */
- public static final short VK_COMMA = (short) 0x2C;
+ short VK_COMMA = (short) 0x2C;
/** Constant for the minus key, "-" */
- public static final short VK_MINUS = (short) 0x2D;
+ short VK_MINUS = (short) 0x2D;
/** Constant for the period key, "." */
- public static final short VK_PERIOD = (short) 0x2E;
+ short VK_PERIOD = (short) 0x2E;
/** Constant for the forward slash key, "/" */
- public static final short VK_SLASH = (short) 0x2F;
+ short VK_SLASH = (short) 0x2F;
/** VK_0 thru VK_9 are the same as UTF16/ASCII '0' thru '9' [0x30 - 0x39] */
- public static final short VK_0 = (short) 0x30;
+ short VK_0 = (short) 0x30;
/** See {@link #VK_0}. */
- public static final short VK_1 = (short) 0x31;
+ short VK_1 = (short) 0x31;
/** See {@link #VK_0}. */
- public static final short VK_2 = (short) 0x32;
+ short VK_2 = (short) 0x32;
/** See {@link #VK_0}. */
- public static final short VK_3 = (short) 0x33;
+ short VK_3 = (short) 0x33;
/** See {@link #VK_0}. */
- public static final short VK_4 = (short) 0x34;
+ short VK_4 = (short) 0x34;
/** See {@link #VK_0}. */
- public static final short VK_5 = (short) 0x35;
+ short VK_5 = (short) 0x35;
/** See {@link #VK_0}. */
- public static final short VK_6 = (short) 0x36;
+ short VK_6 = (short) 0x36;
/** See {@link #VK_0}. */
- public static final short VK_7 = (short) 0x37;
+ short VK_7 = (short) 0x37;
/** See {@link #VK_0}. */
- public static final short VK_8 = (short) 0x38;
+ short VK_8 = (short) 0x38;
/** See {@link #VK_0}. */
- public static final short VK_9 = (short) 0x39;
+ short VK_9 = (short) 0x39;
/** Constant for the ":" key. */
- public static final short VK_COLON = (short) 0x3A;
+ short VK_COLON = (short) 0x3A;
/** Constant for the semicolon key, ";" */
- public static final short VK_SEMICOLON = (short) 0x3B;
+ short VK_SEMICOLON = (short) 0x3B;
/** Constant for the equals key, "<" */
- public static final short VK_LESS = (short) 0x3C;
+ short VK_LESS = (short) 0x3C;
/** Constant for the equals key, "=" */
- public static final short VK_EQUALS = (short) 0x3D;
+ short VK_EQUALS = (short) 0x3D;
/** Constant for the equals key, ">" */
- public static final short VK_GREATER = (short) 0x3E;
+ short VK_GREATER = (short) 0x3E;
/** Constant for the equals key, "?" */
- public static final short VK_QUESTIONMARK = (short) 0x3F;
+ short VK_QUESTIONMARK = (short) 0x3F;
/** Constant for the equals key, "@" */
- public static final short VK_AT = (short) 0x40;
+ short VK_AT = (short) 0x40;
/**
* VK_A thru VK_Z are the same as Capital UTF16/ASCII 'A' thru 'Z' (0x41 -
* 0x5A)
*/
- public static final short VK_A = (short) 0x41;
+ short VK_A = (short) 0x41;
/** See {@link #VK_A}. */
- public static final short VK_B = (short) 0x42;
+ short VK_B = (short) 0x42;
/** See {@link #VK_A}. */
- public static final short VK_C = (short) 0x43;
+ short VK_C = (short) 0x43;
/** See {@link #VK_A}. */
- public static final short VK_D = (short) 0x44;
+ short VK_D = (short) 0x44;
/** See {@link #VK_A}. */
- public static final short VK_E = (short) 0x45;
+ short VK_E = (short) 0x45;
/** See {@link #VK_A}. */
- public static final short VK_F = (short) 0x46;
+ short VK_F = (short) 0x46;
/** See {@link #VK_A}. */
- public static final short VK_G = (short) 0x47;
+ short VK_G = (short) 0x47;
/** See {@link #VK_A}. */
- public static final short VK_H = (short) 0x48;
+ short VK_H = (short) 0x48;
/** See {@link #VK_A}. */
- public static final short VK_I = (short) 0x49;
+ short VK_I = (short) 0x49;
/** See {@link #VK_A}. */
- public static final short VK_J = (short) 0x4A;
+ short VK_J = (short) 0x4A;
/** See {@link #VK_A}. */
- public static final short VK_K = (short) 0x4B;
+ short VK_K = (short) 0x4B;
/** See {@link #VK_A}. */
- public static final short VK_L = (short) 0x4C;
+ short VK_L = (short) 0x4C;
/** See {@link #VK_A}. */
- public static final short VK_M = (short) 0x4D;
+ short VK_M = (short) 0x4D;
/** See {@link #VK_A}. */
- public static final short VK_N = (short) 0x4E;
+ short VK_N = (short) 0x4E;
/** See {@link #VK_A}. */
- public static final short VK_O = (short) 0x4F;
+ short VK_O = (short) 0x4F;
/** See {@link #VK_A}. */
- public static final short VK_P = (short) 0x50;
+ short VK_P = (short) 0x50;
/** See {@link #VK_A}. */
- public static final short VK_Q = (short) 0x51;
+ short VK_Q = (short) 0x51;
/** See {@link #VK_A}. */
- public static final short VK_R = (short) 0x52;
+ short VK_R = (short) 0x52;
/** See {@link #VK_A}. */
- public static final short VK_S = (short) 0x53;
+ short VK_S = (short) 0x53;
/** See {@link #VK_A}. */
- public static final short VK_T = (short) 0x54;
+ short VK_T = (short) 0x54;
/** See {@link #VK_A}. */
- public static final short VK_U = (short) 0x55;
+ short VK_U = (short) 0x55;
/** See {@link #VK_A}. */
- public static final short VK_V = (short) 0x56;
+ short VK_V = (short) 0x56;
/** See {@link #VK_A}. */
- public static final short VK_W = (short) 0x57;
+ short VK_W = (short) 0x57;
/** See {@link #VK_A}. */
- public static final short VK_X = (short) 0x58;
+ short VK_X = (short) 0x58;
/** See {@link #VK_A}. */
- public static final short VK_Y = (short) 0x59;
+ short VK_Y = (short) 0x59;
/** See {@link #VK_A}. */
- public static final short VK_Z = (short) 0x5A;
+ short VK_Z = (short) 0x5A;
/** Constant for the open bracket key, "[" */
- public static final short VK_OPEN_BRACKET = (short) 0x5B;
+ short VK_OPEN_BRACKET = (short) 0x5B;
/** Constant for the back slash key, "\" */
- public static final short VK_BACK_SLASH = (short) 0x5C;
+ short VK_BACK_SLASH = (short) 0x5C;
/** Constant for the close bracket key, "]" */
- public static final short VK_CLOSE_BRACKET = (short) 0x5D;
+ short VK_CLOSE_BRACKET = (short) 0x5D;
/** Constant for the "^" key. */
- public static final short VK_CIRCUMFLEX = (short) 0x5E;
+ short VK_CIRCUMFLEX = (short) 0x5E;
/** Constant for the "_" key */
- public static final short VK_UNDERSCORE = (short) 0x5F;
+ short VK_UNDERSCORE = (short) 0x5F;
/** Constant for the "`" key */
- public static final short VK_BACK_QUOTE = (short) 0x60;
+ short VK_BACK_QUOTE = (short) 0x60;
/**
* Small UTF/ASCII 'a' thru 'z' (0x61 - 0x7a) - Not used for keyCode /
@@ -298,86 +298,86 @@ public interface KeyboardJogampValues {
* See Unicode Collision for details.
*
*/
- public static final short VK_F1 = (short) (0x60 + 1);
+ short VK_F1 = (short) (0x60 + 1);
/** Constant for the F2 function key. See {@link #VK_F1}. */
- public static final short VK_F2 = (short) (0x60 + 2);
+ short VK_F2 = (short) (0x60 + 2);
/** Constant for the F3 function key. See {@link #VK_F1}. */
- public static final short VK_F3 = (short) (0x60 + 3);
+ short VK_F3 = (short) (0x60 + 3);
/** Constant for the F4 function key. See {@link #VK_F1}. */
- public static final short VK_F4 = (short) (0x60 + 4);
+ short VK_F4 = (short) (0x60 + 4);
/** Constant for the F5 function key. See {@link #VK_F1}. */
- public static final short VK_F5 = (short) (0x60 + 5);
+ short VK_F5 = (short) (0x60 + 5);
/** Constant for the F6 function key. See {@link #VK_F1}. */
- public static final short VK_F6 = (short) (0x60 + 6);
+ short VK_F6 = (short) (0x60 + 6);
/** Constant for the F7 function key. See {@link #VK_F1}. */
- public static final short VK_F7 = (short) (0x60 + 7);
+ short VK_F7 = (short) (0x60 + 7);
/** Constant for the F8 function key. See {@link #VK_F1}. */
- public static final short VK_F8 = (short) (0x60 + 8);
+ short VK_F8 = (short) (0x60 + 8);
/** Constant for the F9 function key. See {@link #VK_F1}. */
- public static final short VK_F9 = (short) (0x60 + 9);
+ short VK_F9 = (short) (0x60 + 9);
/** Constant for the F11 function key. See {@link #VK_F1}. */
- public static final short VK_F10 = (short) (0x60 + 10);
+ short VK_F10 = (short) (0x60 + 10);
/** Constant for the F11 function key. See {@link #VK_F1}. */
- public static final short VK_F11 = (short) (0x60 + 11);
+ short VK_F11 = (short) (0x60 + 11);
/** Constant for the F12 function key. See {@link #VK_F1}. */
- public static final short VK_F12 = (short) (0x60 + 12);
+ short VK_F12 = (short) (0x60 + 12);
/** Constant for the F13 function key. See {@link #VK_F1}. */
- public static final short VK_F13 = (short) (0x60 + 13);
+ short VK_F13 = (short) (0x60 + 13);
/** Constant for the F14 function key. See {@link #VK_F1}. */
- public static final short VK_F14 = (short) (0x60 + 14);
+ short VK_F14 = (short) (0x60 + 14);
/** Constant for the F15 function key. See {@link #VK_F1}. */
- public static final short VK_F15 = (short) (0x60 + 15);
+ short VK_F15 = (short) (0x60 + 15);
/** Constant for the F16 function key. See {@link #VK_F1}. */
- public static final short VK_F16 = (short) (0x60 + 16);
+ short VK_F16 = (short) (0x60 + 16);
/** Constant for the F17 function key. See {@link #VK_F1}. */
- public static final short VK_F17 = (short) (0x60 + 17);
+ short VK_F17 = (short) (0x60 + 17);
/** Constant for the F18 function key. See {@link #VK_F1}. */
- public static final short VK_F18 = (short) (0x60 + 18);
+ short VK_F18 = (short) (0x60 + 18);
/** Constant for the F19 function key. See {@link #VK_F1}. */
- public static final short VK_F19 = (short) (0x60 + 19);
+ short VK_F19 = (short) (0x60 + 19);
/** Constant for the F20 function key. See {@link #VK_F1}. */
- public static final short VK_F20 = (short) (0x60 + 20);
+ short VK_F20 = (short) (0x60 + 20);
/** Constant for the F21 function key. See {@link #VK_F1}. */
- public static final short VK_F21 = (short) (0x60 + 21);
+ short VK_F21 = (short) (0x60 + 21);
/** Constant for the F22 function key. See {@link #VK_F1}. */
- public static final short VK_F22 = (short) (0x60 + 22);
+ short VK_F22 = (short) (0x60 + 22);
/** Constant for the F23 function key. See {@link #VK_F1}. */
- public static final short VK_F23 = (short) (0x60 + 23);
+ short VK_F23 = (short) (0x60 + 23);
/** Constant for the F24 function key. See {@link #VK_F1}. */
- public static final short VK_F24 = (short) (0x60 + 24);
+ short VK_F24 = (short) (0x60 + 24);
/** Constant for the "{" key */
- public static final short VK_LEFT_BRACE = (short) 0x7B;
+ short VK_LEFT_BRACE = (short) 0x7B;
/** Constant for the "|" key */
- public static final short VK_PIPE = (short) 0x7C;
+ short VK_PIPE = (short) 0x7C;
/** Constant for the "}" key */
- public static final short VK_RIGHT_BRACE = (short) 0x7D;
+ short VK_RIGHT_BRACE = (short) 0x7D;
/** Constant for the "~" key, matching ASCII */
- public static final short VK_TILDE = (short) 0x7E;
+ short VK_TILDE = (short) 0x7E;
//
// Unicode: Non printable controls: [0x7F - 0x9F]
@@ -388,125 +388,125 @@ public interface KeyboardJogampValues {
/**
* Numeric keypad decimal separator key. Non printable UTF control.
*/
- public static final short VK_SEPARATOR = (short) 0x7F;
+ short VK_SEPARATOR = (short) 0x7F;
/**
* Numeric keypad VK_NUMPAD0 thru VK_NUMPAD9 are mapped to UTF control (0x80
* - 0x89). Non printable UTF control.
*/
- public static final short VK_NUMPAD0 = (short) 0x80;
+ short VK_NUMPAD0 = (short) 0x80;
/** See {@link #VK_NUMPAD0}. */
- public static final short VK_NUMPAD1 = (short) 0x81;
+ short VK_NUMPAD1 = (short) 0x81;
/** See {@link #VK_NUMPAD0}. */
- public static final short VK_NUMPAD2 = (short) 0x82;
+ short VK_NUMPAD2 = (short) 0x82;
/** See {@link #VK_NUMPAD0}. */
- public static final short VK_NUMPAD3 = (short) 0x83;
+ short VK_NUMPAD3 = (short) 0x83;
/** See {@link #VK_NUMPAD0}. */
- public static final short VK_NUMPAD4 = (short) 0x84;
+ short VK_NUMPAD4 = (short) 0x84;
/** See {@link #VK_NUMPAD0}. */
- public static final short VK_NUMPAD5 = (short) 0x85;
+ short VK_NUMPAD5 = (short) 0x85;
/** See {@link #VK_NUMPAD0}. */
- public static final short VK_NUMPAD6 = (short) 0x86;
+ short VK_NUMPAD6 = (short) 0x86;
/** See {@link #VK_NUMPAD0}. */
- public static final short VK_NUMPAD7 = (short) 0x87;
+ short VK_NUMPAD7 = (short) 0x87;
/** See {@link #VK_NUMPAD0}. */
- public static final short VK_NUMPAD8 = (short) 0x88;
+ short VK_NUMPAD8 = (short) 0x88;
/** See {@link #VK_NUMPAD0}. */
- public static final short VK_NUMPAD9 = (short) 0x89;
+ short VK_NUMPAD9 = (short) 0x89;
/**
* Numeric keypad decimal separator key. Non printable UTF control.
*/
- public static final short VK_DECIMAL = (short) 0x8A;
+ short VK_DECIMAL = (short) 0x8A;
/** Numeric keypad add key. Non printable UTF control. */
- public static final short VK_ADD = (short) 0x8B;
+ short VK_ADD = (short) 0x8B;
/** Numeric keypad subtract key. Non printable UTF control. */
- public static final short VK_SUBTRACT = (short) 0x8C;
+ short VK_SUBTRACT = (short) 0x8C;
/** Numeric keypad multiply key. Non printable UTF control. */
- public static final short VK_MULTIPLY = (short) 0x8D;
+ short VK_MULTIPLY = (short) 0x8D;
/** Numeric keypad divide key. Non printable UTF control. */
- public static final short VK_DIVIDE = (short) 0x8E;
+ short VK_DIVIDE = (short) 0x8E;
/** Constant for the DEL key, matching ASCII. Non printable UTF control. */
- public static final short VK_DELETE = (short) 0x93;
+ short VK_DELETE = (short) 0x93;
/** Numeric keypad num lock key. Non printable UTF control. */
- public static final short VK_NUM_LOCK = (short) 0x94;
+ short VK_NUM_LOCK = (short) 0x94;
/**
* Constant for the cursor- or numerical-pad left arrow key. Non
* printable UTF control.
*/
- public static final short VK_LEFT = (short) 0x95;
+ short VK_LEFT = (short) 0x95;
/**
* Constant for the cursor- or numerical-pad up arrow key. Non
* printable UTF control.
*/
- public static final short VK_UP = (short) 0x96;
+ short VK_UP = (short) 0x96;
/**
* Constant for the cursor- or numerical-pad right arrow key. Non
* printable UTF control.
*/
- public static final short VK_RIGHT = (short) 0x97;
+ short VK_RIGHT = (short) 0x97;
/**
* Constant for the cursor- or numerical pad down arrow key. Non
* printable UTF control.
*/
- public static final short VK_DOWN = (short) 0x98;
+ short VK_DOWN = (short) 0x98;
/** Constant for the Context Menu key. Non printable UTF control. */
- public static final short VK_CONTEXT_MENU = (short) 0x99;
+ short VK_CONTEXT_MENU = (short) 0x99;
/**
* Constant for the MS "Windows" function key.
* It is used for both the left and right version of the key.
*/
- public static final short VK_WINDOWS = (short) 0x9A;
+ short VK_WINDOWS = (short) 0x9A;
/** Constant for the Meta function key. */
- public static final short VK_META = (short) 0x9B;
+ short VK_META = (short) 0x9B;
/** Constant for the Help function key. */
- public static final short VK_HELP = (short) 0x9C;
+ short VK_HELP = (short) 0x9C;
/** Constant for the Compose function key. */
- public static final short VK_COMPOSE = (short) 0x9D;
+ short VK_COMPOSE = (short) 0x9D;
/** Constant for the Begin function key. */
- public static final short VK_BEGIN = (short) 0x9E;
+ short VK_BEGIN = (short) 0x9E;
/** Constant for the Stop function key. */
- public static final short VK_STOP = (short) 0x9F;
+ short VK_STOP = (short) 0x9F;
//
// Unicode: Printable [0x00A0 - 0xDFFF]
//
/** Constant for the inverted exclamation mark key. */
- public static final short VK_INVERTED_EXCLAMATION_MARK = (short) 0xA1;
+ short VK_INVERTED_EXCLAMATION_MARK = (short) 0xA1;
/** Constant for the Euro currency sign key. */
- public static final short VK_EURO_SIGN = (short) 0x20AC;
+ short VK_EURO_SIGN = (short) 0x20AC;
//
// Unicode: Private 0xE000 - 0xF8FF (Marked Non-Printable)
//
/* for Sun keyboards */
- public static final short VK_CUT = (short) 0xF879;
- public static final short VK_COPY = (short) 0xF87A;
- public static final short VK_PASTE = (short) 0xF87B;
- public static final short VK_UNDO = (short) 0xF87C;
- public static final short VK_AGAIN = (short) 0xF87D;
- public static final short VK_FIND = (short) 0xF87E;
- public static final short VK_PROPS = (short) 0xF87F;
+ short VK_CUT = (short) 0xF879;
+ short VK_COPY = (short) 0xF87A;
+ short VK_PASTE = (short) 0xF87B;
+ short VK_UNDO = (short) 0xF87C;
+ short VK_AGAIN = (short) 0xF87D;
+ short VK_FIND = (short) 0xF87E;
+ short VK_PROPS = (short) 0xF87F;
/* for input method support on Asian Keyboards */
@@ -514,61 +514,61 @@ public interface KeyboardJogampValues {
* Constant for the input method on/off key.
*/
/* Japanese PC 106 keyboard: kanji. Japanese Solaris keyboard: nihongo */
- public static final short VK_INPUT_METHOD_ON_OFF = (short) 0xF890;
+ short VK_INPUT_METHOD_ON_OFF = (short) 0xF890;
/**
* Constant for the Code Input function key.
*/
/* Japanese PC 106 keyboard - VK_ALPHANUMERIC + ALT: kanji bangou */
- public static final short VK_CODE_INPUT = (short) 0xF891;
+ short VK_CODE_INPUT = (short) 0xF891;
/**
* Constant for the Roman Characters function key.
*/
/* Japanese PC 106 keyboard: roumaji */
- public static final short VK_ROMAN_CHARACTERS = (short) 0xF892;
+ short VK_ROMAN_CHARACTERS = (short) 0xF892;
/**
* Constant for the All Candidates function key.
*/
/* Japanese PC 106 keyboard - VK_CONVERT + ALT: zenkouho */
- public static final short VK_ALL_CANDIDATES = (short) 0xF893;
+ short VK_ALL_CANDIDATES = (short) 0xF893;
/**
* Constant for the Previous Candidate function key.
*/
/* Japanese PC 106 keyboard - VK_CONVERT + SHIFT: maekouho */
- public static final short VK_PREVIOUS_CANDIDATE = (short) 0xF894;
+ short VK_PREVIOUS_CANDIDATE = (short) 0xF894;
/**
* Constant for the Alphanumeric function key.
*/
/* Japanese PC 106 keyboard: eisuu */
- public static final short VK_ALPHANUMERIC = (short) 0xF895;
+ short VK_ALPHANUMERIC = (short) 0xF895;
/**
* Constant for the Katakana function key.
*/
/* Japanese PC 106 keyboard: katakana */
- public static final short VK_KATAKANA = (short) 0xF896;
+ short VK_KATAKANA = (short) 0xF896;
/**
* Constant for the Hiragana function key.
*/
/* Japanese PC 106 keyboard: hiragana */
- public static final short VK_HIRAGANA = (short) 0xF897;
+ short VK_HIRAGANA = (short) 0xF897;
/**
* Constant for the Full-Width Characters function key.
*/
/* Japanese PC 106 keyboard: zenkaku */
- public static final short VK_FULL_WIDTH = (short) 0xF898;
+ short VK_FULL_WIDTH = (short) 0xF898;
/**
* Constant for the Half-Width Characters function key.
*/
/* Japanese PC 106 keyboard: hankaku */
- public static final short VK_HALF_WIDTH = (short) 0xF89A;
+ short VK_HALF_WIDTH = (short) 0xF89A;
/**
* Constant for the Japanese-Katakana function key.
@@ -576,7 +576,7 @@ public interface KeyboardJogampValues {
* input mode.
*/
/* Japanese Macintosh keyboard - VK_JAPANESE_HIRAGANA + SHIFT */
- public static final short VK_JAPANESE_KATAKANA = (short) 0xF89B;
+ short VK_JAPANESE_KATAKANA = (short) 0xF89B;
/**
* Constant for the Japanese-Hiragana function key.
@@ -584,7 +584,7 @@ public interface KeyboardJogampValues {
* input mode.
*/
/* Japanese Macintosh keyboard */
- public static final short VK_JAPANESE_HIRAGANA = (short) 0xF89C;
+ short VK_JAPANESE_HIRAGANA = (short) 0xF89C;
/**
* Constant for the Japanese-Roman function key.
@@ -592,19 +592,19 @@ public interface KeyboardJogampValues {
* input mode.
*/
/* Japanese Macintosh keyboard */
- public static final short VK_JAPANESE_ROMAN = (short) 0xF89D;
+ short VK_JAPANESE_ROMAN = (short) 0xF89D;
/**
* Constant for the locking Kana function key.
* This key locks the keyboard into a Kana layout.
*/
/* Japanese PC 106 keyboard with special Windows driver - eisuu + Control; Japanese Solaris keyboard: kana */
- public static final short VK_KANA_LOCK = (short) 0xF89F;
+ short VK_KANA_LOCK = (short) 0xF89F;
/**
* Constant for Keyboard became invisible, e.g. Android's soft keyboard Back
* button hit while keyboard is visible.
*/
- public static final short VK_KEYBOARD_INVISIBLE = (short) 0xF8FF;
+ short VK_KEYBOARD_INVISIBLE = (short) 0xF8FF;
}
diff --git a/core/src/main/java/it/cavallium/warppi/device/PIHardwareDisplay.java b/core/src/main/java/it/cavallium/warppi/device/PIHardwareDisplay.java
index b29326b9..ab052483 100644
--- a/core/src/main/java/it/cavallium/warppi/device/PIHardwareDisplay.java
+++ b/core/src/main/java/it/cavallium/warppi/device/PIHardwareDisplay.java
@@ -12,13 +12,12 @@ public class PIHardwareDisplay implements HardwareDisplay {
public void shutdown() {}
@Override
- public void setBrightness(double value) {
- if (Engine.getPlatform().getSettings().isDebugEnabled() == false) {
+ public void setBrightness(final double value) {
+ if (Engine.getPlatform().getSettings().isDebugEnabled() == false)
Engine.getPlatform().getGpio().pwmWrite(12, (int) Math.ceil(value * 1024f));
// SoftPwm.softPwmWrite(12, (int)(Math.ceil(brightness*10)));
- } else {
+ else
Engine.getPlatform().getConsoleUtils().out().println(1, "Brightness: " + value);
- }
}
}
diff --git a/core/src/main/java/it/cavallium/warppi/device/PIHardwareTouchDevice.java b/core/src/main/java/it/cavallium/warppi/device/PIHardwareTouchDevice.java
index 0acde74a..f91aad95 100644
--- a/core/src/main/java/it/cavallium/warppi/device/PIHardwareTouchDevice.java
+++ b/core/src/main/java/it/cavallium/warppi/device/PIHardwareTouchDevice.java
@@ -12,69 +12,65 @@ public class PIHardwareTouchDevice implements HardwareTouchDevice {
private final boolean invertXY, invertX, invertY;
- public PIHardwareTouchDevice(boolean invertXY, boolean invertX, boolean invertY) {
+ public PIHardwareTouchDevice(final boolean invertXY, final boolean invertX, final boolean invertY) {
this.invertXY = invertXY;
this.invertX = invertX;
this.invertY = invertY;
}
@Override
- public boolean onTouchStart(TouchStartEvent e) {
+ public boolean onTouchStart(final TouchStartEvent e) {
final Screen scr = Engine.INSTANCE.getHardwareDevice().getDisplayManager().getScreen();
boolean refresh = false;
- if (scr != null && scr.initialized && scr.onTouchStart(e)) {
+ if (scr != null && scr.initialized && scr.onTouchStart(e))
refresh = true;
- } else {
+ else {
//Default behavior
}
- if (refresh) {
+ if (refresh)
Engine.INSTANCE.getHardwareDevice().getDisplayManager().forceRefresh = true;
- }
return true;
}
@Override
- public boolean onTouchEnd(TouchEndEvent e) {
+ public boolean onTouchEnd(final TouchEndEvent e) {
final Screen scr = Engine.INSTANCE.getHardwareDevice().getDisplayManager().getScreen();
boolean refresh = false;
- if (scr != null && scr.initialized && scr.onTouchEnd(e)) {
+ if (scr != null && scr.initialized && scr.onTouchEnd(e))
refresh = true;
- } else {
+ else {
//Default behavior
}
- if (refresh) {
+ if (refresh)
Engine.INSTANCE.getHardwareDevice().getDisplayManager().forceRefresh = true;
- }
return true;
}
@Override
- public boolean onTouchCancel(TouchCancelEvent e) {
+ public boolean onTouchCancel(final TouchCancelEvent e) {
final Screen scr = Engine.INSTANCE.getHardwareDevice().getDisplayManager().getScreen();
boolean refresh = false;
- if (scr != null && scr.initialized && scr.onTouchCancel(e)) {
+ if (scr != null && scr.initialized && scr.onTouchCancel(e))
refresh = true;
- } else {
+ else {
//Default behavior
}
- if (refresh) {
+ if (refresh)
Engine.INSTANCE.getHardwareDevice().getDisplayManager().forceRefresh = true;
- }
return true;
}
@Override
- public boolean onTouchMove(TouchMoveEvent e) {
+ public boolean onTouchMove(final TouchMoveEvent e) {
final Screen scr = Engine.INSTANCE.getHardwareDevice().getDisplayManager().getScreen();
boolean refresh = false;
- if (scr != null && scr.initialized && scr.onTouchMove(e)) {
+ if (scr != null && scr.initialized && scr.onTouchMove(e))
refresh = true;
- } else {
+ else {
//Default behavior
}
- if (refresh) {
+ if (refresh)
Engine.INSTANCE.getHardwareDevice().getDisplayManager().forceRefresh = true;
- }
return true;
}
@@ -94,20 +90,18 @@ public class PIHardwareTouchDevice implements HardwareTouchDevice {
}
@Override
- public TouchPoint makePoint(long id, float x, float y, int screenWidth, int screenHeight, float radiusX,
- float radiusY, float force, float rotationAngle) {
+ public TouchPoint makePoint(final long id, float x, float y, final int screenWidth, final int screenHeight,
+ final float radiusX, final float radiusY, final float force, final float rotationAngle) {
if (getInvertedXY()) {
- double oldX = x;
- double oldY = y;
- x = (float) (oldY * ((double) screenWidth) / ((double) screenHeight));
- y = (float) (oldX * ((double) screenHeight) / ((double) screenWidth));
+ final double oldX = x;
+ final double oldY = y;
+ x = (float) (oldY * screenWidth / screenHeight);
+ y = (float) (oldX * screenHeight / screenWidth);
}
- if (getInvertedX()) {
+ if (getInvertedX())
x = screenWidth - x;
- }
- if (getInvertedY()) {
+ if (getInvertedY())
y = screenHeight - y;
- }
return new TouchPoint(id, x, y, radiusX, radiusY, force, rotationAngle);
}
}
diff --git a/core/src/main/java/it/cavallium/warppi/device/chip/ParallelToSerial.java b/core/src/main/java/it/cavallium/warppi/device/chip/ParallelToSerial.java
index 51f815c9..dfc74e6d 100644
--- a/core/src/main/java/it/cavallium/warppi/device/chip/ParallelToSerial.java
+++ b/core/src/main/java/it/cavallium/warppi/device/chip/ParallelToSerial.java
@@ -9,7 +9,7 @@ public class ParallelToSerial {
private final int QH;
private final int CLK;
- public ParallelToSerial(int SH_LD_pin, int CLK_INH_pin, int QH_pin, int CLK_pin) {
+ public ParallelToSerial(final int SH_LD_pin, final int CLK_INH_pin, final int QH_pin, final int CLK_pin) {
SH_LD = SH_LD_pin;
CLK_INH = CLK_INH_pin;
QH = QH_pin;
diff --git a/core/src/main/java/it/cavallium/warppi/device/chip/SerialToParallel.java b/core/src/main/java/it/cavallium/warppi/device/chip/SerialToParallel.java
index 56e53027..f5563280 100644
--- a/core/src/main/java/it/cavallium/warppi/device/chip/SerialToParallel.java
+++ b/core/src/main/java/it/cavallium/warppi/device/chip/SerialToParallel.java
@@ -7,16 +7,16 @@ public class SerialToParallel {
private final int SCK; //Shift register clock pin
private final int SER; //Serial data input
- public SerialToParallel(int RCK_pin, int SCK_pin, int SER_pin) {
+ public SerialToParallel(final int RCK_pin, final int SCK_pin, final int SER_pin) {
RCK = RCK_pin;
SCK = SCK_pin;
SER = SER_pin;
}
- public void write(boolean[] data) {
- if (data.length != 8) {
+ public void write(final boolean[] data) {
+ if (data.length != 8)
return;
- } else {
+ else {
Engine.getPlatform().getGpio().digitalWrite(RCK, Engine.getPlatform().getGpio().valueLow());
for (int i = 7; i >= 0; i--) {
diff --git a/core/src/main/java/it/cavallium/warppi/device/graphicengine/RAWFont.java b/core/src/main/java/it/cavallium/warppi/device/graphicengine/RAWFont.java
index 0b69f52f..fd7ca8de 100644
--- a/core/src/main/java/it/cavallium/warppi/device/graphicengine/RAWFont.java
+++ b/core/src/main/java/it/cavallium/warppi/device/graphicengine/RAWFont.java
@@ -31,7 +31,7 @@ public class RAWFont {
public int charIntCount;
public static final int intBits = 31;
- public void create(String name) {
+ public void create(final String name) {
try {
loadFont("/font_" + name + ".rft");
} catch (final IOException e) {
@@ -45,7 +45,7 @@ public class RAWFont {
int currentInt = 0;
int currentBit = 0;
for (int i = 0; i < charS; i++) {
- if (currentInt * intBits + currentBit >= (currentInt + 1) * intBits) {
+ if (currentInt * RAWFont.intBits + currentBit >= (currentInt + 1) * RAWFont.intBits) {
currentInt += 1;
currentBit = 0;
}
@@ -56,11 +56,11 @@ public class RAWFont {
int currentInt = 0;
int currentBit = 0;
for (int i = 0; i < charS; i++) {
- if (currentBit >= intBits) {
+ if (currentBit >= RAWFont.intBits) {
currentInt += 1;
currentBit = 0;
}
- chars32[charIndex * charIntCount + currentInt] = (chars32[charIndex * charIntCount + currentInt]) | ((currentChar[i] ? 1 : 0) << currentBit);
+ chars32[charIndex * charIntCount + currentInt] = chars32[charIndex * charIntCount + currentInt] | (currentChar[i] ? 1 : 0) << currentBit;
currentBit++;
}
}
@@ -69,12 +69,11 @@ public class RAWFont {
Object obj = new Object();
final WeakReference