Rylius

LD22 'Framework'

Dec 16th, 2011
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // LD22.java
  2. // inserted into main
  3. System.setProperty("org.lwjgl.librarypath",
  4.         new File(new File(System.getProperty("user.dir"), "native"),
  5.         LWJGLUtil.getPlatformName()).getAbsolutePath());
  6. System.setProperty("net.java.games.input.librarypath",
  7.         System.getProperty("org.lwjgl.librarypath"));
  8. AppGameContainer app = null;
  9. try {
  10.     app = new AppGameContainer(new LD22Warmup());
  11.     app.setDisplayMode(800, 600, false);
  12.     app.setTargetFrameRate(60);
  13.     app.setShowFPS(true);
  14.     app.start();
  15. } catch (SlickException ex) {
  16.     System.exit(1);
  17. }
  18.  
  19. // Game.java
  20. // + versions for Music and Sound
  21. public static Image image(String file) {
  22.     String path = basepath + "/graphics/";
  23.     try {
  24.         return new Image(path + file + ".png");
  25.     } catch (Exception ex) {
  26.         System.err.println("ERROR: Failed to open image '" + file + "'");
  27.         // avoid endless recursion
  28.         if (!file.equals("missing")) {
  29.             return image("missing");
  30.         }
  31.     }
  32.     return null;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment