Java 类com.badlogic.gdx.graphics.g2d.Batch 实例源码

项目:KyperBox    文件:GameObject.java   
@Override
public void draw(Batch batch, float parentAlpha) {
    if (sprite != null && !sprite.isEmpty() && !sprite.equals(NO_SPRITE)) {
        Sprite render = layer.getGameSprite(sprite);
        render.setPosition(MathUtils.round(getX()), MathUtils.round(getY()));
        render.setRotation(getRotation());
        render.setAlpha(getColor().a * parentAlpha);
        render.setOrigin(getOriginX(), getOriginY());
        render.setColor(getColor());
        render.setSize(getWidth(), getHeight());
        render.setScale(getScaleX(), getScaleY());
        render.setFlip(flip_x, flip_y);
        render.draw(batch);
    }
    super.draw(batch, parentAlpha);
}
项目:libgdx_ui_editor    文件:EditingZone.java   
public void drawBg(Batch batch, float parentAlpha) {
    batch.end();
    Gdx.gl.glLineWidth(1.0f);
    Gdx.gl.glEnable(GL20.GL_BLEND);
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

    shapeRenderer.setProjectionMatrix(getStage().getCamera().combined);
    Matrix4 matrix = batch.getTransformMatrix();
    shapeRenderer.setTransformMatrix(matrix);

    shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
    BG.a = parentAlpha;
    shapeRenderer.setColor(BG);
    shapeRenderer.rect(getX(), getY(), getWidth(), getHeight());
    shapeRenderer.end();

    Gdx.gl.glDisable(GL20.GL_BLEND);
    batch.begin();
    batch.setColor(Color.WHITE.r, Color.WHITE.g, Color.WHITE.b, Color.WHITE.a * parentAlpha);
}
项目:NoRiskNoFun    文件:GameObjectMap.java   
@Override
public void draw (Batch batch, float parentAlpha) {
    batch.end();

    Gdx.gl.glLineWidth(10);

    for (PolygonRegion region : polygonRegions) {

        this.batch.begin();
        this.batch.draw(region, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        this.batch.end();

        Polyline line = new Polyline(region.getVertices());
        line.setScale(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

        shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
        shapeRenderer.setProjectionMatrix(batch.getProjectionMatrix());
        shapeRenderer.setColor(Color.BROWN);
        shapeRenderer.polyline(line.getTransformedVertices());
        shapeRenderer.end();
    }

    batch.begin();
}
项目:school-game    文件:StoneBarrier.java   
@Override
public void render(Batch batch, float deltaTime)
{
    if (body == null) return;

    batch.draw(bigStone,                                    // TextureRegion
            position.x - bigStone.getRegionWidth() / 2,     // Offset to the X position (character center)
            position.y,                                     // Y position is at the foots
            bigStone.getRegionWidth() / 2,                  // Origin X (important for flipping)
            bigStone.getRegionHeight(),                     // Origin Y
            bigStone.getRegionWidth(),                      // Width
            bigStone.getRegionHeight(),                     // Height
            1f,                                             // Scale X (-1 to flip)
            1f,                                             // Scale Y
            0f);                                            // Rotation
}
项目:KyperBox    文件:ParticleSystem.java   
@Override
    public void preDraw(Batch batch, float parentAlpha) {
//      boolean last_additive = pre_draws.size > 0?containsAdditive(pre_draws.first()):false;

        for (int i = 0; i < pre_draws.size; i++) {
            PooledEffect pe = pre_draws.get(i);

//          boolean contains_additive = containsAdditive(pe);
//          if(last_additive&&!contains_additive) {
//              batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
//          }
//          last_additive = contains_additive;

            pe.draw(batch);

        }

        batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    }
项目:TH902    文件:CircularDrawingStatic.java   
@Override
public void draw(Batch batch, float parentAlpha) {
    shaderProgram = batch.getShader();
    texture.bind();
    System.arraycopy(initialVertices, 0, operatedVertices, 0, initialVertices.length);
    for (int i=6; i<initialVertices.length; i+=9)
        operatedVertices[i] = parentAlpha * getColor().a;
    mesh.setVertices(operatedVertices);
    mat4_trans.setToRotation(0, 0, 1, getRotation());
    mesh.transform(mat4_trans);
    mat4_trans.setToTranslationAndScaling(getX(), getY(), 0, getWidth() / 2f, -getHeight() / 2f, 1);
    mesh.transform(mat4_trans);
    Gdx.gl.glEnable(GL20.GL_BLEND);
       Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    mesh.render(shaderProgram, GL20.GL_TRIANGLE_FAN);
}
项目:Klooni1010    文件:ThemeCard.java   
@Override
public void draw(Batch batch, float parentAlpha) {
    final float x = getX(), y = getY();

    batch.setColor(theme.background);
    batch.draw(background, x, y, getWidth(), getHeight());

    // Avoid drawing on the borders by adding +1 cell padding
    for (int i = 0; i < colorsUsed.length; ++i) {
        for (int j = 0; j < colorsUsed[i].length; ++j) {
            Cell.draw(theme.cellTexture, theme.getCellColor(colorsUsed[i][j]), batch,
                    x + cellSize * (j + 1), y + cellSize * (i + 1), cellSize);
        }
    }

    super.draw(batch, parentAlpha);
}
项目:KyperBox    文件:ParticleSystem.java   
@Override
    public void postDraw(Batch batch, float parentAlpha) {
//      boolean last_additive = post_draws.size > 0?containsAdditive(post_draws.first()):false;
        for (int i = 0; i < post_draws.size; i++) {
            PooledEffect pe = post_draws.get(i);
//          boolean contains_additive = containsAdditive(pe);
//          if(last_additive&&!contains_additive) {
//              batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
//          }
//          last_additive = contains_additive;

            pe.draw(batch);
        }

        batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);

    }
项目:Klooni1010    文件:EffectCard.java   
@Override
public void draw(Batch batch, float parentAlpha) {
    final float x = getX(), y = getY();

    batch.setColor(Klooni.theme.background);
    batch.draw(background, x, y, getWidth(), getHeight());

    // Avoid drawing on the borders by adding +1 cell padding
    board.pos.set(x + cellSize * 1, y + cellSize * 1);

    // Draw only if effects are done, i.e. not showcasing
    if (board.effectsDone())
        board.draw(batch);

    super.draw(batch, parentAlpha);
}
项目:Klooni1010    文件:EffectCard.java   
@Override
public boolean showcase(Batch batch, float yDisplacement) {
    board.pos.y += yDisplacement;

    // If no effect is running
    if (board.effectsDone()) {
        // And we want to create a new one
        if (needCreateEffect) {
            // Clear at cells[1][1], the center one
            board.clearAll(1, 1, effect);
            needCreateEffect = false;
        } else {
            // Otherwise, the previous effect finished, so return false because we're done
            // We also want to draw the next time so set the flag to true
            setRandomPiece();
            needCreateEffect = true;
            return false;
        }
    }

    board.draw(batch);
    return true;
}
项目:KyperBox    文件:ScrollingBackground.java   
@Override
public void draw(Batch batch, float parentAlpha) {
    if (background != null) {
        // draw background
        if (size > 1) {
            for (int i = 0; i < size; i++) {
                y = (i % (size / 3)) + yoff;
                x = (i / (size / 3)) + xoff;
                x_check = pos_x + (getWidth() * x);
                y_check = pos_y + (getHeight() * y);
                batch.draw(background, MathUtils.floor(getX() + x_check),MathUtils.floor( getY() + y_check), getWidth(), getHeight());
            }
        } else {
            batch.draw(background, MathUtils.floor(getX() + pos_x), MathUtils.floor(getY() + pos_y), getWidth(), getHeight());
        }

    }
    super.draw(batch, parentAlpha);
}
项目:Klooni1010    文件:SpinEffect.java   
@Override
public void draw(Batch batch) {
    age += Gdx.graphics.getDeltaTime();

    final float progress = age * INV_LIFETIME;
    final float currentSize = Interpolation.pow2In.apply(size, 0, progress);
    final float currentRotation = Interpolation.sine.apply(0, TOTAL_ROTATION, progress);

    final Matrix4 original = batch.getTransformMatrix().cpy();
    final Matrix4 rotated = batch.getTransformMatrix();

    final float disp =
            + 0.5f * (size - currentSize) // the smaller, the more we need to "push" to center
            + currentSize * 0.5f; // center the cell for rotation

    rotated.translate(pos.x + disp, pos.y + disp, 0);
    rotated.rotate(0, 0, 1, currentRotation);
    rotated.translate(currentSize * -0.5f, currentSize * -0.5f, 0); // revert centering for rotation

    batch.setTransformMatrix(rotated);
    Cell.draw(color, batch, 0, 0, currentSize);
    batch.setTransformMatrix(original);
}
项目:Klooni1010    文件:EvaporateEffect.java   
@Override
public void draw(Batch batch) {
    vanishElapsed += Gdx.graphics.getDeltaTime();

    // Update the size as we fade away
    final float progress = vanishElapsed * INV_LIFETIME;
    vanishSize = Interpolation.fade.apply(size, 0, progress);

    // Fade away depending on the time
    vanishColor.set(vanishColor.r, vanishColor.g, vanishColor.b, 1.0f - progress);

    // Ghostly fade upwards, by doing a lerp from our current position to the wavy one
    pos.x = MathUtils.lerp(
            pos.x,
            originalX + MathUtils.sin(randomOffset + vanishElapsed * 3f) * driftMagnitude,
            0.3f
    );
    pos.y += UP_SPEED * Gdx.graphics.getDeltaTime();

    Cell.draw(vanishColor, batch, pos.x, pos.y, vanishSize);
}
项目:Klooni1010    文件:WaterdropEffect.java   
@Override
public void draw(Batch batch) {
    final float dt = Gdx.graphics.getDeltaTime();
    fallSpeed += fallAcceleration * dt;
    pos.y -= fallSpeed * dt;

    cellColor.set(
            cellColor.r, cellColor.g, cellColor.b,
            Math.max(cellColor.a - COLOR_SPEED * dt, 0.0f)
    );
    dropColor.set(
            cellColor.r, cellColor.g, cellColor.b,
            Math.min(dropColor.a + COLOR_SPEED * dt, 1.0f)
    );

    Cell.draw(cellColor, batch, pos.x, pos.y, cellSize);
    Cell.draw(dropTexture, dropColor, batch, pos.x, pos.y, cellSize);

    final Vector3 translation = batch.getTransformMatrix().getTranslation(new Vector3());
    dead = translation.y + pos.y + dropTexture.getHeight() < 0;
}
项目:Klooni1010    文件:VanishEffect.java   
@Override
public void draw(Batch batch) {
    vanishElapsed += Gdx.graphics.getDeltaTime();

    // vanishElapsed might be < 0 (delay), so clamp to 0
    float progress = Math.min(1f,
            Math.max(vanishElapsed, 0f) / vanishLifetime);

    // If one were to plot the elasticIn function, they would see that the slope increases
    // a lot towards the end- a linear interpolation between the last size + the desired
    // size at 20% seems to look a lot better.
    vanishSize = MathUtils.lerp(
            vanishSize,
            Interpolation.elasticIn.apply(cell.size, 0, progress),
            0.2f
    );

    float centerOffset = cell.size * 0.5f - vanishSize * 0.5f;
    Cell.draw(vanishColor, batch, cell.pos.x + centerOffset, cell.pos.y + centerOffset, vanishSize);
}
项目:bobbybird    文件:BouncingImage.java   
public void draw (Batch batch, float parentAlpha) {
    validate();

    Color color = getColor();
    batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);

    float x = getX();
    float y = getY() + floatAction.getValue();
    float scaleX = getScaleX();
    float scaleY = getScaleY();

    if (drawable instanceof TransformDrawable) {
        float rotation = getRotation();
        if (scaleX != 1 || scaleY != 1 || rotation != 0) {
            ((TransformDrawable)drawable).draw(batch, x + imageX, y + imageY, getOriginX() - imageX, getOriginY() - imageY,
                imageWidth, imageHeight, scaleX, scaleY, rotation);
            return;
        }
    }
    if (drawable != null) drawable.draw(batch, x + imageX, y + imageY, imageWidth * scaleX, imageHeight * scaleY);
}
项目:FlappySpinner    文件:Tube.java   
@Override
public void draw(Batch batch, float parentAlpha) {
    super.draw(batch, parentAlpha);
    float deltaSpeed = Gdx.graphics.getDeltaTime() * Constants.TUBE_SPEED;

    batch.draw(topTubeTexture,
            topTubeBody.getPosition().x  - Constants.TUBE_WIDTH/2 + deltaSpeed,
            topTubeBody.getPosition().y - Constants.TUBE_HEIGHT/2,
            Constants.TUBE_WIDTH,
            Constants.TUBE_HEIGHT);

    batch.draw(bottomTubeTexture,
            bottomTubeBody.getPosition().x - Constants.TUBE_WIDTH/2 + deltaSpeed,
            bottomTubeBody.getPosition().y - Constants.TUBE_HEIGHT/2 ,
            Constants.TUBE_WIDTH,
            Constants.TUBE_HEIGHT);
}
项目:Mindustry    文件:GridImage.java   
public void draw(Batch batch, float alpha){
    TextureRegion blank = Draw.region("white");

    float xspace = (getWidth() / imageWidth);
    float yspace = (getHeight() / imageHeight);
    float s = 1f;

    for(int x = 0; x <= imageWidth; x ++){
        batch.draw(blank, (int)(getX() + xspace * x - s), getY() - s, 2, getHeight()+ (x == imageWidth ? 1: 0));
    }

    for(int y = 0; y <= imageHeight; y ++){
        batch.draw(blank, getX() - s, (int)(getY() + y * yspace - s), getWidth(), 2);
    }
}
项目:Mindustry    文件:BorderImage.java   
@Override
public void draw(Batch batch, float alpha){
    super.draw(batch, alpha);

    float scaleX = getScaleX();
    float scaleY = getScaleY();

    Draw.color(Colors.get("accent"));
    Draw.thick(Unit.dp.scl(thickness));
    Draw.linerect(x + imageX, y + imageY, imageWidth * scaleX, imageHeight * scaleY);
    Draw.reset();
}
项目:alquran-alkarem    文件:GozaTap.java   
@Override
    public void draw(Batch batch, float parentAlpha) {

// TODO Auto-generated method stub
        x = (joza_page_no_width+sorah_tanzel_width+ayat_widht)+sorah_tab_book_mark_width*3  ;
        y = book.parts_scroll_pane.getScrollY()+Gdx.graphics.getHeight()-((tab_height*no+tab_pading_height*(no-1)));

        Goza_name_sprite.setPosition(x, y);
        Goza_name_sprite.setOriginCenter();
        Goza_name_sprite.setScale(.95f);
        Goza_name_sprite.draw(batch);
        no_of_surah.set_position(x+joza_name_width,text_y_deferance+ y);
        no_of_surah.draw(batch, parentAlpha);
    }
项目:Cubes    文件:SlotActor.java   
public static void drawText(Batch batch, float x, float y, ItemStack itemStack) {
  if (itemStack == null || itemStack.item.getStackCountMax() == 1) return;
  BitmapFontCache cache = Fonts.smallHUD.getCache();
  cache.clear();
  GlyphLayout layout = cache.addText(Integer.toString(itemStack.count), x, y, 32f, Align.right, false);
  cache.translate(0, layout.height);
  cache.draw(batch);
}
项目:school-game    文件:Rabbit.java   
@Override
public void render(Batch batch, float deltaTime)
{
    if (body == null) return;

    Color oldColor = batch.getColor();

    batch.setColor(1f, (health + 5)/10f, (health + 5)/10f, 1f);

    Vector2 pos = body.getPosition();
    pos.scl(Physics.PPM);

    float scaleX = 1f;

    animationTime += deltaTime;


    batch.draw(rabbit,                                      // TextureRegion (front, back, side)
            pos.x - rabbit.getRegionWidth() / 2,           // Offset to the X position (character center)
            pos.y,                                          // Y position is at the foots
            rabbit.getRegionWidth() / 2,                   // Origin X (important for flipping)
            rabbit.getRegionHeight(),                      // Origin Y
            rabbit.getRegionWidth(),                       // Width
            rabbit.getRegionHeight(),                      // Height
            scaleX,                                         // Scale X (-1 to flip)
            1f,                                             // Scale Y
            0f);                                            // Rotation

    batch.setColor(oldColor);
}
项目:alquran-alkarem    文件:SorahTab.java   
@Override
    public void draw(Batch batch, float parentAlpha) {

        // TODO Auto-generated method stub
        x = sorah_page_no_width+(sorah_tanzel_width-width)/2 ;
        y = book.sorah_scroll_pane.getScrollY()+Gdx.graphics.getHeight()-((tab_height*no+tab_pading_height*(no-1)));
        Goza_name_sprite.setPosition(x, y);
        Goza_name_sprite.setOriginCenter();
        Goza_name_sprite.setScale(.7f);
        Goza_name_sprite.draw(batch);
        surah_page_no.set_position(0,text_y_deferance+ y);
        surah_page_no.draw(batch, parentAlpha);
}
项目:Climatar    文件:DrawableMap.java   
@Override
    public void draw(Batch batch, float parentAlpha) {
        camera.update();
        Matrix4 projection = batch.getProjectionMatrix();

//      batch.end();

//      Gdx.gl.glViewport((int) frame.x, (int) frame.y, (int) frame.width, (int) frame.height);
//      batch.setProjectionMatrix(camera.combined);
//      batch.begin();

        tint.a = parentAlpha;
        batch.setColor(tint);
        batch.draw(terrain, getX(), getY(), getWidth(), getHeight());

        // draw nation layers
        if (visibilityLookup.get(Nation.FIRE))
            batch.draw(fire, getX(), getY(), getWidth(), getHeight());
        if (visibilityLookup.get(Nation.WATER))
            batch.draw(water, getX(), getY(), getWidth(), getHeight());
        if (visibilityLookup.get(Nation.EARTH))
            batch.draw(earth, getX(), getY(), getWidth(), getHeight());
        if (visibilityLookup.get(Nation.AIR))
            batch.draw(air, getX(), getY(), getWidth(), getHeight());

//      batch.end();
//      batch.setProjectionMatrix(projection);
//      batch.begin();
//      Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    }
项目:penguins-in-space    文件:TutorialView.java   
public TutorialView(Batch batch, TutorialPresenter.ViewHandler controller) {
    super(batch);
    this.controller = controller;
    table.addAction(Actions.alpha(0));
    addActor(table);
    init();
}
项目:alquran-alkarem    文件:GameActor.java   
@Override
public void draw(Batch batch, float parentAlpha) {
    // TODO Auto-generated method stub
    if(enable_draw){
        if(enable_rotate){
            actor_Sprite.rotate(rotate_angle);
        }
        if(is_me_live){
            scale = scale+(up_or_down_scale?.002f:-.002f);
            actor_Sprite.setScale(scale);
            if(scale>1.1){
                up_or_down_scale =false;
            }else if(scale<1){
                up_or_down_scale = true;
            }
        }

            if(enable_grade){
                r =((0f+((1-(0/*Game.sky.get_day_ritio()*/))*1f)));
                b=r;
                g=r; 
                actor_Sprite.setColor(r, g, b, alpha);

        }
actor_Sprite.draw(batch);
    }
}
项目:penguins-in-space    文件:MultiplayerMenuView.java   
public MultiplayerMenuView(Batch batch, MpMenuPresenter.ViewHandler controller) {
    super(batch);
    this.controller = controller;
    buttons.add(quickGame);
    buttons.add(invitePlayers);
    buttons.add(hostGame);
    buttons.add(back);
    setListeners();
}
项目:alquran-alkarem    文件:PageTap.java   
@Override
public void draw(Batch batch, float parentAlpha) {
    // TODO Auto-generated method stub
    super.draw(batch, parentAlpha);
    x =0  ;
    y = book.select_page_pane.getScrollY()+Gdx.graphics.getHeight()-((tab_height*no+tab_pading_height*(no)));
    pading_sprite.setPosition(x, y);
    pading_sprite.draw(batch);
}
项目:penguins-in-space    文件:ScoreView.java   
public ScoreView(Batch batch, ScorePresenter.ViewHandler controller) {
    super(batch);
    this.controller = controller;
    table.addAction(Actions.alpha(0));
    addActor(table);
    table.setFillParent(true);
}
项目:penguins-in-space    文件:MainView.java   
public MainView(Batch batch, MainMenuPresenter.ViewHandler controller) {
    super(batch);
    this.controller = controller;
    buttons.add(play);
    buttons.add(multiplayer);
    buttons.add(settings);
    buttons.add(achievements);
    buttons.add(highscore);
    buttons.add(tutorial);
    buttons.add(quit);
    setListeners();
}
项目:penguins-in-space    文件:GamepadButton.java   
@Override
    public void draw(Batch batch, float parentAlpha) {
        super.draw(batch, parentAlpha);
        Color c = getColor();
        batch.setColor(c.r, c.g, c.b, c.a * parentAlpha);
        touchButton.draw(batch, getX(), getY(), getWidth(), getHeight());
//        shapeRenderer.setProjectionMatrix(batch.getProjectionMatrix());
//        shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
//        float radius = Math.min(getWidth(), getHeight()) / 2;
//        shapeRenderer.circle(getX() + radius, getY() + radius, radius);
//        shapeRenderer.end();
    }
项目:school-game    文件:Crystal.java   
@Override
public void render(Batch batch, float deltaTime)
{
    batch.draw(crystal,                                     // TextureRegion (front, back, side)
            position.x - crystal.getRegionWidth() / 2,      // Offset to the X position (character center)
            position.y + 20,                                // Y position is at the foots
            crystal.getRegionWidth() / 2,                   // Origin X (important for flipping)
            crystal.getRegionHeight(),                      // Origin Y
            crystal.getRegionWidth(),                       // Width
            crystal.getRegionHeight(),                      // Height
            1f,                                             // Scale X (-1 to flip)
            1f,                                             // Scale Y
            0f);
}
项目:conquest    文件:City.java   
@Override
public void draw(Batch batch, float parentAlpha) {
    if (!isVisible()) return;

    Color color = getColor();
    batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
    batch.draw(texture, getX() - 10, getY() - 10);
}
项目:TH902    文件:CircularProgress.java   
public void draw(Batch batch, float parentAlpha) {
    Gdx.gl.glEnable(GL20.GL_BLEND);
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    Gdx.gl.glDepthMask(false);
    int n = 3 + (int) (8F * this.percent);
    if (n > 10) {
        n = 10;
    }
    float vertices[] = new float[n * 5];
    float x = getX();
    float y = getY();
    float fColor = getColor().toFloatBits();
    int idx = 0;;

    for (int j = 0; j < n - 1; j++) {
        vertices[0 + j * 5] = x + this.vertices[j * 5];
        vertices[1 + j * 5] = y + this.vertices[1 + j * 5];
        vertices[2 + j * 5] = fColor;
        vertices[3 + j * 5] = this.vertices[3 + j * 5];
        vertices[4 + j * 5] = this.vertices[4 + j * 5];
        idx += 5;
    }
    if (this.last != null) {
        vertices[idx + 0] = x + this.last.x;
        vertices[idx + 1] = y + this.last.y;
        vertices[idx + 2] = fColor;
        Vector2 uv = getUV(this.region, this.last.x, this.last.y);
        vertices[idx + 3] = uv.x;
        vertices[idx + 4] = uv.y;

    }
    this.region.getTexture().bind();
    this.mesh.setVertices(vertices, 0, vertices.length);
    this.mesh.render(this.shader, GL20.GL_TRIANGLE_FAN, 0, n);
    Gdx.gl.glDepthMask(true);

}
项目:Tower-Defense-Galaxy    文件:PauseWindow.java   
@Override
public void draw(Batch batch, float parentAlpha) {
    //Reset spritebatch after alpha action
    Color color = batch.getColor();
    super.draw(batch, parentAlpha);
    batch.setColor(color);
}
项目:alquran-alkarem    文件:SorahTab.java   
@Override
public void draw(Batch batch, float parentAlpha) {
    // TODO Auto-generated method stub
    x = sorah_page_no_width+sorah_tanzel_width+sorah_tab_book_mark_width*3 ;
    y = book.sorah_scroll_pane.getScrollY()+tab_height/2+Gdx.graphics.getHeight()-((tab_height*no+tab_pading_height*(no-1)));
    ayat_sprite.setPosition(x, y);
    ayat_no_text.set_position(x, text_y_deferance+y);
    ayat_sprite.setOriginCenter();
    ayat_sprite.setScale(.7f);
    ayat_sprite.draw(batch);
    ayat_no_text.draw(batch, parentAlpha);
    super.draw(batch, parentAlpha);
}
项目:Tower-Defense-Galaxy    文件:TabSelector.java   
@Override
public void draw(Batch batch, float parentAlpha) {
    for(int i = 0; i < slotNum; i++)
        if(icons[i] != null) {
            if (isVertical)
                batch.draw(icons[i], getX(), getY() + getHeight() / slotNum * i, getWidth(), getHeight() / slotNum);
            else
                batch.draw(icons[i], getX() + getWidth() / slotNum * i,getY(), getWidth() / slotNum, getHeight());
        }
    if(isVertical)
        batch.draw(selection, getX(), getY() + getHeight() / slotNum * slot, getWidth(), getHeight() / slotNum);
    else
        batch.draw(selection, getX() + getWidth() / slotNum * slot, getY(), getWidth() / slotNum, getHeight());
    }
项目:Cubes_2    文件:SlotActor.java   
public static void drawText(Batch batch, float x, float y, ItemStack itemStack) {
  if (itemStack == null || itemStack.item.getStackCountMax() == 1) return;
  BitmapFontCache cache = Fonts.smallHUD.getCache();
  cache.clear();
  GlyphLayout layout = cache.addText(Integer.toString(itemStack.count), x, y, 32f, Align.right, false);
  cache.translate(0, layout.height);
  cache.draw(batch);
}
项目:Cubes_2    文件:HotbarActor.java   
public void draw(Batch batch, float x, float y, float width, float height) {

      for (int i = 0; i < 9; i++) {
        if (i == playerInventory.hotbarSelected) {
          batch.draw(hotbarSelected, x + (48f * i), y, 48f, 48f);
        } else {
          batch.draw(hotbar, x + (48f * i), y, 48f, 48f);
        }
        if (playerInventory.itemStacks[i] != null) {
          TextureRegion region = playerInventory.itemStacks[i].getTextureRegion();
          batch.draw(region, x + (48f * i) + 8f, y + 8f, 32f, 32f);
          SlotActor.drawText(batch, x + (48f * i) + 8f, y + 8f, playerInventory.itemStacks[i]);
        }
      }
    }
项目:Cubes_2    文件:IntegerSetting.java   
@Override
public void draw(Batch batch, float parentAlpha) {
  super.draw(batch, parentAlpha);
  BitmapFontCache cache = Fonts.hud.getCache();
  cache.clear();
  GlyphLayout layout = cache.addText(String.format(format, getValue()), getX(), getY(), getWidth(), Align.center, false);
  cache.translate(0, (layout.height / 2) + (getHeight() / 2));
  cache.draw(batch);
}