Open and run the game
A Java (or any kind of) application can be invoked directly from within RTflow using the post-generate command setting in the code generation settings dialog. The post-generate command specifies an executable file, a batch file or a system command to be executed after code generation. For example, the post-generate command can be a batch file that first compiles the generated Java file and then runs the compiled Java application.
- In RTflow, open the project Examples/Thrust/Thrust.spp under the application folder.
- Choose Project:Settings... to open the Project Settings dialog and click the Code Generation tab. Notice that the batch file buildandrun.bat has been specified under Post-Generate Command. This batch file has the following contents:
javac -sourcepath src -d classes src\rtflow\*.java src\thrust\*.java
java -classpath classes thrust.Main
- Close the dialog without changing anything.
- Choose Project:Generate Code or press F10. RTflow will generate Java code from the model, and then the above batch file will be executed. As a result, a window with the running game will appear. Use the left and right cursor keys to turn your ship clockwise and counterclockwise, respectively, and use the down cursor key to thrust. Use the space key to fire. Notice that you can only have one bullet in the air at a time, so you have to wait until it disappears before you can fire again.