これからLWJGLのチュートリアルを見ながらGroovyとProcessingに書き換えていく
一回目はこの動画
build.gradleを書く
build.gradle
apply plugin: 'idea'
apply plugin: 'groovy'
apply plugin: 'application'
def defaultEncoding = 'UTF-8'
def jdkVersion = '1.7'
def localJars = fileTree(dir: 'lib', includes: ['*.jar'])
sourceCompatibility = jdkVersion
targetCompatibility = jdkVersion
repositories {
mavenCentral()
}
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.1.7'
compile localJars
}
compileGroovy {
groovyOptions.encoding = defaultEncoding
}
idea {
project {
jdkName = jdkVersion
languageLevel = jdkVersion
}
}
Processingのjarをコピー
プロジェクト直下のlibディレクトリにダウンロードしたProcessingのcore/libraryから以下のjarをコピー
- core.jar
- gluegen-rt.jar
- gluegen-rt-natives-windows-amd64.jar
- jogl-all.jar
- jogl-all-natives-windows-amd64.jar
コードを書く
DisplayTest.groovy
package episode001
import groovy.swing.SwingBuilder
import processing.core.PApplet
import javax.swing.JFrame
class DisplayTest extends PApplet {
def void setup() {
}
def void draw() {
background(0, 0, 0)
}
def static void main(args) {
def display = new DisplayTest()
new SwingBuilder().frame(
title: 'Episode 1 – Display Test',
defaultCloseOperation: JFrame.EXIT_ON_CLOSE,
size: [640, 480], show: true) {
widget(display)
}
display.init()
}
}