Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package se.tund.game;
- import se.tund.game.gui.Menu;
- import se.tund.game.gui.Screen;
- import se.tund.game.input.Input;
- import se.tund.game.settings.Settings;
- public final class Game {
- public static final int WIDTH = 400;
- public static final int HEIGHT = 280;
- public Settings settings;
- public Screen screen;
- public Input input;
- public Game() {
- }
- private void initGL() {
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0.0D, Display.getDisplayMode().getWidth(), 0.0D, Display.getDisplayMode().getHeight(), 1000D, 3000D);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight());
- glDisable(GL_DEPTH_TEST);
- }
- private void start() {
- try {
- Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
- Display.create();
- initGL();
- settings = new Settings(this);
- input = new Input(this);
- screen = new Menu(null);
- }
- catch (LWJGLException e) {
- e.printStackTrace();
- System.exit(0);
- }
- while (!Display.isCloseRequested()) {
- Display.update();
- input.poll();
- render();
- loop();
- }
- Display.destroy();
- }
- public void render() {
- }
- public void loop() {
- if (screen != null) {
- screen.updateScreen();
- screen.drawScreen(this);
- }
- }
- public static void main(String[] args) {
- Game game = new Game();
- game.start();
- }
- }
Add Comment
Please, Sign In to add comment