示例#1
0
  public void onCreate() {
    brightness = 150;

    released = true;

    GL.setRender3D(true);

    AL.setMasterVolume(0.1f);

    map = new Map();

    camera = new Camera();
    camera.setMaxPitch(90);
    camera.setMinPitch(-90);
    camera.setCameraMode(Camera.XZ_ONLY);

    player = new Player(2, 2, 2, 1, 1, 1, map);
    player.attachCamera(camera);

    Gun pistol = new Pistol(map);
    pistol.addAmmo(2500);
    pistol.reload(false);

    player.addGun(pistol, true);

    player.move(0, 9, 0);

    font =
        new Font(
            "res/images/font/font.png",
            26,
            4,
            new char[] {
              'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q',
                  'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
              'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q',
                  'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
              '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '_', '-', '+', '=', '~', '`', '!',
                  '@', '#', '$', '%', '^', '&', '*', '(', ')',
              '?', '>', '<', ';', ':', '\'', '"', '{', '}', '[', ']', '\\', '|', ',', '.', '/', ' ',
                  ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '
            });

    grass = new Texture("res/images/grass.png");

    GL.initLighting();
    GL.setShadeModel(GL.SMOOTH);

    GL.setAmbientLighti(brightness, brightness, brightness);
    GL.setLightProperties();

    GL.addSpecular(GL.LIGHT0, new Point(0.35f, 0.35f, 0.35f));
    //		GL.addSpecular(GL.LIGHT1, new Point(01.0f, 01.0f, 01.0f));
    //
    //		GL.setShadeModel(GL.SMOOTH);
    //
    //		GL.addLight(new Vector(0, 0, -1), 15);

    //		frameBufferId = GL.genFrameBuffer();

    texture = new Texture(0);

    GL.enablePolygonAntialiasing();
    //		GL.initBasicLights();
  }