コード例 #1
0
ファイル: Bdx.java プロジェクト: colepram/bdx
 public static void dispose() {
   modelBatch.dispose();
   spriteBatch.dispose();
   frameBuffer.dispose();
   tempBuffer.dispose();
   shaderProvider.dispose();
   for (ShaderProgram s : Bdx.matShaders.values()) {
     s.dispose();
   }
 }
コード例 #2
0
ファイル: Bdx.java プロジェクト: colepram/bdx
  public static void resize(int width, int height) {
    spriteBatch.getProjectionMatrix().setToOrtho2D(0, 0, width, height);

    if (frameBuffer != null) frameBuffer.dispose();
    if (tempBuffer != null) tempBuffer.dispose();

    frameBuffer =
        new RenderBuffer(
            spriteBatch); // Have to recreate all render buffers and adjust the projection matrix as
                          // the window size has changed
    tempBuffer = new RenderBuffer(spriteBatch);
    for (Scene scene : scenes) {

      if (scene.lastFrameBuffer != null) scene.lastFrameBuffer.dispose();

      scene.lastFrameBuffer = new RenderBuffer(null);
    }
  }
コード例 #3
0
ファイル: Bdx.java プロジェクト: colepram/bdx
  public static void init() {
    time = 0;
    profiler = new Profiler();
    display = new Display();
    scenes = new ArrayListScenes();
    sounds = new Sounds();
    music = new Music();
    mouse = new Mouse();
    gamepads = new ArrayListNamed<Gamepad>();

    for (int i = 0; i < Controllers.getControllers().size; i++) {
      gamepads.add(new Gamepad(i));
    }

    imaps = new InputMaps();
    keyboard = new Keyboard();
    fingers = new ArrayList<Finger>();
    components = new ArrayList<Component>();
    matShaders = new HashMap<String, ShaderProgram>();

    allocatedFingers = new ArrayList<Finger>();
    for (int i = 0; i < 10; ++i) {
      allocatedFingers.add(new Finger(i));
    }

    Gdx.input.setInputProcessor(new GdxProcessor(keyboard, mouse, allocatedFingers, gamepads));

    com.badlogic.gdx.graphics.glutils.ShaderProgram.pedantic = false;

    shaderProvider = new BDXShaderProvider();
    modelBatch = new ModelBatch(shaderProvider);
    spriteBatch = new SpriteBatch();
    spriteBatch.setBlendFunction(Gdx.gl.GL_SRC_ALPHA, Gdx.gl.GL_ONE_MINUS_SRC_ALPHA);
    frameBuffer = new RenderBuffer(spriteBatch);
    tempBuffer = new RenderBuffer(spriteBatch);
    advancedLightingOn = true;
  }