Fixed input parsing in Java playback example.
This commit is contained in:
@@ -100,7 +100,7 @@ public class Main
|
|||||||
for (int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
float[] posi = xpc.getPOSI(0);
|
float[] posi = xpc.getPOSI(0);
|
||||||
writer.write(String.format("%1$f , %2$f , %3$f , %4$f , %5$f , %6$f , %7$f\n",
|
writer.write(String.format("%1$f, %2$f, %3$f, %4$f, %5$f, %6$f, %7$f\n",
|
||||||
posi[0], posi[1], posi[2], posi[3], posi[4], posi[5], posi[6]));
|
posi[0], posi[1], posi[2], posi[3], posi[4], posi[5], posi[6]));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -119,6 +119,7 @@ public class Main
|
|||||||
{
|
{
|
||||||
try(Scanner reader = new Scanner(new FileReader(path)))
|
try(Scanner reader = new Scanner(new FileReader(path)))
|
||||||
{
|
{
|
||||||
|
reader.useDelimiter("[\\s\\r\\n,]+");
|
||||||
System.out.println("Starting playback...");
|
System.out.println("Starting playback...");
|
||||||
try (XPlaneConnect xpc = new XPlaneConnect())
|
try (XPlaneConnect xpc = new XPlaneConnect())
|
||||||
{
|
{
|
||||||
@@ -127,8 +128,8 @@ public class Main
|
|||||||
float[] posi = new float[7];
|
float[] posi = new float[7];
|
||||||
for (int i = 0; i < 7; ++i)
|
for (int i = 0; i < 7; ++i)
|
||||||
{
|
{
|
||||||
posi[i] = reader.nextFloat();
|
String s = reader.next();
|
||||||
reader.next(); // Read commas to skip them
|
posi[i] = Float.parseFloat(s);
|
||||||
}
|
}
|
||||||
reader.nextLine();
|
reader.nextLine();
|
||||||
xpc.sendPOSI(posi);
|
xpc.sendPOSI(posi);
|
||||||
|
|||||||
Reference in New Issue
Block a user