Guest User

Untitled

a guest
Oct 19th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. package se.tund.game;
  2.  
  3. import se.tund.game.gui.Menu;
  4. import se.tund.game.gui.Screen;
  5. import se.tund.game.input.Input;
  6. import se.tund.game.settings.Settings;
  7.  
  8. public final class Game {
  9.  
  10. public static final int WIDTH = 400;
  11. public static final int HEIGHT = 280;
  12.  
  13. public Settings settings;
  14. public Screen screen;
  15. public Input input;
  16.  
  17. public Game() {
  18. }
  19.  
  20. private void initGL() {
  21. glMatrixMode(GL_PROJECTION);
  22. glLoadIdentity();
  23. glOrtho(0.0D, Display.getDisplayMode().getWidth(), 0.0D, Display.getDisplayMode().getHeight(), 1000D, 3000D);
  24. glMatrixMode(GL_MODELVIEW);
  25. glLoadIdentity();
  26. glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight());
  27. glDisable(GL_DEPTH_TEST);
  28. }
  29.  
  30. private void start() {
  31. try {
  32. Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
  33. Display.create();
  34. initGL();
  35. settings = new Settings(this);
  36. input = new Input(this);
  37. screen = new Menu(null);
  38. }
  39. catch (LWJGLException e) {
  40. e.printStackTrace();
  41. System.exit(0);
  42. }
  43. while (!Display.isCloseRequested()) {
  44. Display.update();
  45. input.poll();
  46. render();
  47. loop();
  48. }
  49. Display.destroy();
  50. }
  51.  
  52. public void render() {
  53. }
  54.  
  55. public void loop() {
  56. if (screen != null) {
  57. screen.updateScreen();
  58. screen.drawScreen(this);
  59. }
  60. }
  61.  
  62. public static void main(String[] args) {
  63. Game game = new Game();
  64. game.start();
  65. }
  66. }
Add Comment
Please, Sign In to add comment