Skip to content

@chrisyco /Frangipani.scala
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
LWJGL test
object Frangipani {
// Add path to native libraries
val jarName = getClass.getProtectionDomain.getCodeSource.getLocation.getPath
val nativeDir = new File(new File(jarName).getParent, "natives").getPath
System.setProperty("org.lwjgl.librarypath", nativeDir)
def start() {
// Initialize the display
try {
Display.setDisplayMode(new DisplayMode(800, 600))
Display.create()
} catch {
case e: LWJGLException => {
e.printStackTrace()
System.exit(1)
}
}
// Call the loop
try {
loop()
} finally {
Display.destroy()
}
}
def loop() {
while(!Display.isCloseRequested) {
while(Keyboard.next()) {
println("Key pressed!") // Never reaches this part!
}
// Blank the screen
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_STENCIL_BUFFER_BIT)
Display.update()
Display.sync(60)
}
}
def main(args: Array[String]) {
start()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.