Created
September 10, 2011 06:18
-
-
Save chrisyco/1208003 to your computer and use it in GitHub Desktop.
LWJGL test
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
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