CosPlay comes with a number of built-in ready to play games:
CosPlay also comes with many examples for each functional area. The source code for these examples is shipped with the project (see org.cosplay.examples
package) and can be also found on GitHub.
If you have CosPlay project in IDE you can review the source code and run each example right from IDE. Each example is a simple Scala application with the main(...)
method. The easiest way to run examples from the command line is to use SBT or Maven. First, clone and build the CosPlay Git repository (this needs to be done only once):
# One-time Git clone & build: $ git clone https://github.com/nivanov/cosplay.git $ cd cosplay $ sbt package
# One-time Git clone & build: $ git clone https://github.com/nivanov/cosplay.git $ cd cosplay $ mvn package
SBT & Maven
CosPlay comes with support for both SBT and Maven builds. Running examples and built-in games via SBT will automatically use terminal emulator since both SBT and CosPlay use JLine library and SBT therefor uses Java process fork to launch the examples and games. If you want to run directly in the terminal console using pure text-mode - use Maven method instead.
Assuming you are in cosplay
folder use the following table to run examples:
Example | |
---|---|
# Will launch using terminal emulator. $ sbt "project cosplay; runMain org.cosplay.examples.animation.CPAnimationExample" # Will launch in the same terminal console. $ mvn -f modules/cosplay exec:java -P ex:animation | |
# Will launch using terminal emulator. $ sbt "project cosplay; runMain org.cosplay.examples.camera.CPCameraExample" # Will launch in the same terminal console. $ mvn -f modules/cosplay exec:java -P ex:camera | |
# Will launch using terminal emulator. $ sbt "project cosplay; runMain org.cosplay.examples.image.CPImageFormatsExample" # Will launch in the same terminal console. $ mvn -f modules/cosplay exec:java -P ex:image_formats | |
# Will launch using terminal emulator. $ sbt "project cosplay; runMain org.cosplay.examples.image.CPImageCarouselExample" # Will launch in the same terminal console. $ mvn -f modules/cosplay exec:java -P ex:image_carousel | |
# Will launch using terminal emulator. $ sbt "project cosplay; runMain org.cosplay.examples.fonts.CPFontsExample" # Will launch in the same terminal console. $ mvn -f modules/cosplay exec:java -P ex:fonts | |
# Will launch using terminal emulator. $ sbt "project cosplay; runMain org.cosplay.examples.particle.CPParticleExample" # Will launch in the same terminal console. $ mvn -f modules/cosplay exec:java -P ex:particle | |
# Will launch using terminal emulator. $ sbt "project cosplay; runMain org.cosplay.examples.shader.CPShaderExample" # Will launch in the same terminal console. $ mvn -f modules/cosplay exec:java -P ex:shader | |
# Will launch using terminal emulator. $ sbt "project cosplay; runMain org.cosplay.examples.shader.CPSlideShaderExample" # Will launch in the same terminal console. $ mvn -f modules/cosplay exec:java -P ex:slide_shader | |
# Will launch using terminal emulator. $ sbt "project cosplay; runMain org.cosplay.examples.textinput.CPTextInputExample" # Will launch in the same terminal console. $ mvn -f modules/cosplay exec:java -P ex:textinput | |
# Will launch using terminal emulator. $ sbt "project cosplay; runMain org.cosplay.examples.tilemapper.CPTileMapperExample" # Will launch in the same terminal console. $ mvn -f modules/cosplay exec:java -P ex:tilemapper | |
# Will launch using terminal emulator. $ sbt "project cosplay; runMain org.cosplay.examples.sound.CPSoundExample" # Will launch in the same terminal console. $ mvn -f modules/cosplay exec:java -P ex:sound | |
# Will launch using terminal emulator. $ sbt "project cosplay; runMain org.cosplay.examples.video.CPVideoExample" # Will launch in the same terminal console. $ mvn -f modules/cosplay exec:java -P ex:video | |
# Will launch using terminal emulator. $ sbt "project cosplay; runMain org.cosplay.examples.layout.CPLayoutExample" # Will launch in the same terminal console. $ mvn -f modules/cosplay exec:java -P ex:layout | |
# Will launch using terminal emulator. $ sbt "project cosplay; runMain org.cosplay.examples.dialog.CPDialogExample" # Will launch in the same terminal console. $ mvn -f modules/cosplay exec:java -P ex:dialog | |
# Will launch using terminal emulator. $ sbt "project cosplay; runMain org.cosplay.examples.listbox.CPListBoxExample" # Will launch in the same terminal console. $ mvn -f modules/cosplay exec:java -P ex:listbox |