Commit e6423ad7 authored by Jeffrey Phillips Freeman's avatar Jeffrey Phillips Freeman 💥
Browse files

Added a main entry point for all the examples.

parent 2bcf1ac9
......@@ -76,7 +76,7 @@
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.syncleus.aparapi</groupId>
......@@ -88,6 +88,16 @@
<build>
<defaultGoal>package</defaultGoal>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<mainClass>com.syncleus.aparapi.examples.All</mainClass>
<arguments>
<argument>com.syncleus.aparapi.executionMode=GPU</argument>
</arguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
......
/**
* This product currently only contains code developed by authors
* of specific components, as identified by the source code files.
*
* Since product implements StAX API, it has dependencies to StAX API
* classes.
*
* For additional credits (generally to people who reported problems)
* see CREDITS file.
*/
package com.syncleus.aparapi.examples;
import java.util.Scanner;
public class All {
public static void main(String[] _args) {
System.out.println("Select which example to run:");
System.out.println(" 1) Game of Life");
System.out.println();
Scanner in = new Scanner(System.in);
boolean running = true;
while(running)
{
System.out.print("Enter your selection, or q/Q to quit: ");
if( in.hasNextLine() )
{
String line = in.nextLine();
running = selected(line);
System.out.println();
}
else
try {
Thread.sleep(100);
}
catch(InterruptedException ex) {
return;
}
}
}
private static boolean selected(String line)
{
if( line.toUpperCase().equals("Q") )
return false;
switch(line)
{
case "1":
com.syncleus.aparapi.examples.life.Main.main(null);
break;
default:
System.out.println("Invalid selection.");
}
return true;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment