示例#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
 public void draw(
     TextureRegion tr,
     float width,
     float height,
     float origX,
     float origY,
     float x,
     float y,
     float rot,
     Color tint) {
   setTint(tint);
   if (tr instanceof TextureAtlas.AtlasRegion) {
     myTextureChecker.onReg((TextureAtlas.AtlasRegion) tr);
   } else {
     throw new AssertionError("Unexpected texture class");
   }
   mySpriteBatch.draw(tr, x - origX, y - origY, origX, origY, width, height, 1, 1, rot);
 }
示例#3
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);
    }
  }
示例#4
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;
  }
示例#5
0
 private void setTint(Color tint) {
   mySpriteBatch.setColor(tint);
 }
示例#6
0
 public void end() {
   myTextureChecker.onEnd();
   mySpriteBatch.end();
 }
示例#7
0
 public void begin() {
   mySpriteBatch.begin();
 }
示例#8
0
 public void setMtx(Matrix4 mtx) {
   mySpriteBatch.setProjectionMatrix(mtx);
 }
示例#9
0
 public void setAdditive(boolean additive) {
   int dstFunc = additive ? GL20.GL_ONE : GL20.GL_ONE_MINUS_SRC_ALPHA;
   mySpriteBatch.setBlendFunction(GL20.GL_SRC_ALPHA, dstFunc);
 }
示例#10
0
 public void dispose() {
   mySpriteBatch.dispose();
   myFont.dispose();
 }