LoginSignup
1
1

More than 5 years have passed since last update.

[GroovyとProcessing] 環境構築とウィンドウの表示

Posted at

これから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()
    }
}

grocessingGL001.png

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1