Created
December 4, 2012 01:36
-
-
Save kimukou/4199737 to your computer and use it in GitHub Desktop.
PlayNTest.groovy
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
// see http://ontaikikou.blogspot.jp/2012/08/groovyplayn.html | |
// http://stackoverflow.com/questions/11846023/unable-to-run-playn-sample-project-compile-errors | |
// not run | |
// depends of -Djava.library.path=target/lwjgl/natives/macos-x | |
@GrabResolver(name='forplay', root='http://forplay.googlecode.com/svn/mavenrepo',m2Compatible='true') | |
@Grab(group='com.googlecode.playn', module='playn-core', version='1.4') | |
@Grab(group='com.googlecode.playn', module='playn-java', version='1.4') | |
@Grab(group='com.samskivert', module='pythagoras', version='1.3.1') | |
@Grab(group='org.lwjgl.lwjgl', module='lwjgl', version='2.8.4') | |
@Grab(group='jlayer', module='mp3spi', version='1.9.5') | |
//@Grab(group='de.huxhorn.sulky', module='de.huxhorn.sulky.3rdparty.jlayer', version='1.0') | |
import playn.core.* | |
import playn.java.* | |
import org.lwjgl.opengl.Display | |
class PlayNTestMain { | |
static GameTest tester | |
PlayNTestMain(){ | |
tester = new GameTest() | |
} | |
public static void main(String[] args){ | |
PlayNTestMain testMain = new PlayNTestMain() | |
assert testMain.tester != null | |
JavaPlatform platform = JavaPlatform.register() | |
platform.assets().setPathPrefix("playntest/resources") | |
// ウインドウサイズの設定 | |
platform.graphics().setSize(1024, 860) | |
// タイトルの設定 | |
platform.setTitle("Game Test") | |
// Display.setIcon() | |
PlayN.setPlatform(platform) | |
// PlayN.platformは初期状態ではNullなので明示的にsetする必要がある | |
assert PlayN.platform != null | |
PlayN.run(testMain.tester) | |
} | |
} | |
// GameTestクラス | |
import playn.core.* | |
class GameTest implements Game{ | |
GameTest(){ | |
; | |
} | |
@Override | |
public void init(){ | |
Image image = PlayN.assets().getImage("images/sample1.jpg") | |
Layer layer = PlayN.graphics().createImageLayer(image) | |
PlayN.graphics().rootLayer().add(layer) | |
} | |
@Override | |
public void paint(float alpha) { | |
} | |
@Override | |
public void update(float delta) { | |
} | |
@Override | |
public int updateRate() { | |
return 25 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment