Jun 12, 2012

Getting Started with Scala + Processing

Scala is awesome. Processing is awesome library for digital design and for creating visualizations. After some researches, I feel that using Scala + Processing + IntelliJ is the best combination for writing rapid high performance visualization hacks. Here is an example that I like for a nice swarm simulation that was done using processing (from http://muehlseife.blogspot.com/search/label/swarm)

Since every swarm simulation needs to start for somewhere, here is a quick start tutorial for getting started with scala, processing and IntelliJ:
  1. Download and install IntelliJ Community Edition (free)
  2. Launch IntelliJ and install Scala plugin from edit -> settings -> plugins -> browse repositories -> Search for scala
  3. Download scala (zip archive) and extract it (C:\scala-2.9.2 would be great!)
  4. Create a new project in IntelliJ and add Scala as a Facet, insert "C:\scala-2.9.2" in the scala distribution input.
  5. Right click on src > new scala object "HelloWorld". Copy-paste the hello world example from scala official site and run your first scala application.
  6. (Bonus1) Enable scala syntax highlighting (click on the yellow square on bottom-right), I don't know why but it's still not enabled by default.
  7. (Bonus2) - to make scala compilation super fast you can go to Project Structure > Facets > Scala and choose "Use project FSC" (Fast scala compiler)
  8. Download processing from http://processing.org/download/  and extract it (C:\processing-1.5.1 would be great!)
  9. In intelliJ go to project structure > Libraries > click on the "+" and add C:\processing-1.5.1\lib
  10. Finally, here is a simple template to run scala + processing
  11. (Bonus 3) Full screen is supported by adding "--present" as argument: PApplet.main(Array[String]("--present","ScalaProcessingExample"))

1 comment: