Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2013
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. public class Main {
  2. private long lastframe;
  3. private Camera cam;
  4.  
  5. public Main() {
  6. init();
  7. run();
  8. cleanup();
  9. }
  10.  
  11. public void init() {
  12. try {
  13. Display.setDisplayMode(new DisplayMode(800, 600));
  14. Display.create();
  15. } catch (LWJGLException e) {
  16. e.printStackTrace();
  17. System.exit(0);
  18. }
  19.  
  20. Camera.init(0, 0, 0, 0, 0, 0, 70, Display.getWidth()/Display.getHeight(), 0.00000001f, 100);
  21.  
  22. Game.init();
  23. }
  24.  
  25. public void run() {
  26. while (!Display.isCloseRequested()) {
  27. long time = ((Sys.getTime() * 1000) / Sys.getTimerResolution());
  28. int delta = (int) (time - lastframe);
  29. lastframe = time;
  30.  
  31. Game.update(delta);
  32.  
  33. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
  34.  
  35. Game.render();
  36. cam.useTraits();
  37.  
  38. Display.update();
  39. Display.sync(60);
  40.  
  41. }
  42. }
  43.  
  44. public void cleanup() {
  45. Display.destroy();
  46. }
  47.  
  48. public static void main(String[] args) {
  49. new Main();
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement