/** Initialise the GL context */
  protected void initGL() {
    Log.info("Starting display " + width + "x" + height);
    String extensions = GL11.glGetString(GL11.GL_EXTENSIONS);

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_LIGHTING);

    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    GL11.glClearDepth(1);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glViewport(0, 0, width, height);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    if (input == null) {
      input = new Input(height);
    }
    input.init(height);
    input.removeListener(lastGame);
    input.addListener(game);
    lastGame = game;
  }
  /** Initialise the GL context */
  protected void initGL() {
    Log.info("Starting display " + width + "x" + height);
    GL.initDisplay(width, height);

    if (input == null) {
      input = new Input(height);
    }
    input.init(height);
    // no need to remove listeners?
    // input.removeAllListeners();
    if (game instanceof InputListener) {
      input.removeListener((InputListener) game);
      input.addListener((InputListener) game);
    }

    if (graphics != null) {
      graphics.setDimensions(getWidth(), getHeight());
    }
    lastGame = game;
  }
Esempio n. 3
0
 /**
  * Create a new input with the height of the screen
  *
  * @param height The height of the screen
  */
 public Input(int height) {
   init(height);
 }