You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead of throwing an exception early on, this makes it possible to test all other parts of sketches that make light use of the IO library. A warning is printed once after startup for those environments.
This was tested on OS X against all examples that come with the IO library. Note: x86 and x64 are technically supported platforms. If a user on those prefers to use simulation instead, it is necessary to call NativeInterface.alwaysSimulate() before any other IO library function.
Copy file name to clipboardExpand all lines: java/libraries/io/src/processing/io/NativeInterface.java
+14-3Lines changed: 14 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -26,17 +26,28 @@
26
26
publicclassNativeInterface {
27
27
28
28
protectedstaticbooleanloaded = false;
29
+
protectedstaticbooleanalwaysSimulate = false;
29
30
30
31
publicstaticvoidloadLibrary() {
31
32
if (!loaded) {
32
-
if (!"Linux".equals(System.getProperty("os.name"))) {
33
-
thrownewRuntimeException("The Processing I/O library is only supported on Linux");
33
+
if (isSimulated()) {
34
+
System.err.println("The Processing I/O library is not supported on this platform. Instead of values from actual hardware ports, your sketch will only receive stand-in values that allow you to test the remainder of its functionality.");
0 commit comments