Created
July 12, 2010 10:20
-
-
Save koyachi/472326 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 2010-07-12 koyachi | |
// | |
// Processing by Scala without SPDE | |
// | |
// [Reference] | |
// Processing + LL on JRE | |
// http://d.hatena.ne.jp/dewdrop/20070506/p5r | |
// http://d.hatena.ne.jp/dewdrop/20070513/p5r | |
// http://blog.tkmr.org/tatsuya/show/327-jruby-irb-proce55ing | |
// http://hysysk.blogspot.com/2007/11/jython-p51.html | |
// http://hysysk.blogspot.com/2007/11/jython-p52.html | |
// http://d.hatena.ne.jp/koyachi/20080206/1202225831 | |
// | |
// JFrame | |
// http://download.oracle.com/docs/cd/E17476_01/javase/1.5.0/docs/api/javax/swing/JFrame.html | |
// http://download.oracle.com/docs/cd/E17409_01/javase/tutorial/uiswing/components/frame.html | |
// | |
// SPDE + emacs + applescript | |
// http://voqn.blogspot.com/2010/05/spdescalaprocessingemacsapplescriptelis.html | |
// SPDE | |
// http://www.scala-lang.org/node/3391 | |
import processing.core.PApplet | |
import javax.swing.JFrame | |
class Sketch() extends PApplet { | |
override def setup() : Unit = { | |
size(400, 400) | |
background(255) | |
noStroke | |
} | |
override def draw() : Unit = { | |
for (i <- 0 to 30) { | |
fill(random(255), random(255), random(255)) | |
rect(random(width), random(height), 10, 10) | |
} | |
} | |
override def mousePressed() : Unit = { | |
background(255) | |
} | |
} | |
var frame = new JFrame("Sketch") | |
var applet = new Sketch | |
frame.getContentPane().add(applet) | |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) | |
applet.init | |
frame.pack | |
frame.setVisible(true) | |
while (true) { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment