当前位置: 首页>>代码示例>>Java>>正文


Java Drawable.draw方法代码示例

本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.utils.Drawable.draw方法的典型用法代码示例。如果您正苦于以下问题:Java Drawable.draw方法的具体用法?Java Drawable.draw怎么用?Java Drawable.draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.scenes.scene2d.utils.Drawable的用法示例。


在下文中一共展示了Drawable.draw方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fillRoundedRect

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入方法依赖的package包/类
@Override
public void fillRoundedRect(float x, float y, float w, float h, int cornerRadius) {
    Drawable drawable = getRoundedRectDrawable(cornerRadius);
    Color originalColor = null;

    ensureSpriteBatchOpen();
    if (brushType == BrushType.COLOR) {
        originalColor = spriteBatch.getColor();
        Color color = getAlphaMultiplied(colorBrush);
        spriteBatch.setColor(color);
        freeColor(color);
    }

    drawable.draw(spriteBatch, x, viewportSize.y - y - h, w, h);

    if (originalColor != null) {
        spriteBatch.setColor(originalColor);
    }
}
 
开发者ID:alexpana,项目名称:kreativity-ui,代码行数:20,代码来源:KrLwjgl3Renderer.java

示例2: drawGap

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入方法依赖的package包/类
private void drawGap(int i, Batch batch) {
    Drawable headerGap;
    if (i == selectedIndex) {
        //current active
        headerGap = style.activeBorderRight;
    } else if (i == selectedIndex - 1) {
        //next active
        headerGap = style.activeBorderLeft;
    } else {
        headerGap = style.inactiveBorder;
    }
    if (headerGap != null) {
        headerGap.draw(
            batch,
            getX() + headerWidth * (i + 1) + headersLeftOffset + i * headersBetweenOffset,
            getY() + contentHeight,
            headersBetweenOffset,
            getHeight() - contentHeight
        );
    }
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:22,代码来源:TabPane.java

示例3: drawBackground

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入方法依赖的package包/类
protected void drawBackground(Batch batch, float parentAlpha, float x, float y) {

        Drawable background = this.getBackground();

        if (background == null) return;
        Color color = getColor();

        // restore alpha if item disabled, draw background never with alpha
        if (!this.mIsEnabled)
            parentAlpha *= 4f;

        batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
        background.draw(batch, x, y, getWidth(), getHeight());
    }
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:15,代码来源:MenuItem.java

示例4: draw

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入方法依赖的package包/类
@Override public void draw(Batch batch, float parentAlpha) {
    if (selectedIndex == -1)
        return;
    validate();
    Color color = getColor();
    batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
    drawContentBackground(batch);
    drawLeftBorder(batch);
    drawRightBorder(batch);

    for (int i = 0; i < headers.size; i++) {
        if (i != headers.size - 1)
            drawGap(i, batch);
        Drawable headerBackground;
        if (selectedIndex == i) {
            headerBackground = style.active;
        } else {
            headerBackground = style.inactive;
        }
        if (headerBackground != null) {
            headerBackground.draw(
                batch,
                getX() + headerWidth * i + headersLeftOffset + i * headersBetweenOffset - 0.5f,
                getY() + contentHeight,
                headerWidth + 1f,
                getHeight() - contentHeight
            );
        }
    }
    super.draw(batch, parentAlpha);
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:32,代码来源:TabPane.java

示例5: drawRightBorder

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入方法依赖的package包/类
private void drawRightBorder(Batch batch) {
    Drawable rightBorder;
    if (selectedIndex == headers.size - 1) {
        rightBorder = style.activeBorderRightEdge;
    } else {
        rightBorder = style.inactiveBorderRightEdge;
    }

    if (rightBorder != null) {
        float x = getX() + getWidth() - headersRightOffset;
        float y = getY() + contentHeight;
        rightBorder.draw(batch, x, y, headersRightOffset, getHeight() - contentHeight);
    }
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:15,代码来源:TabPane.java

示例6: drawLeftBorder

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入方法依赖的package包/类
private void drawLeftBorder(Batch batch) {
    Drawable leftBorder;
    if (selectedIndex == 0) {
        leftBorder = style.activeBorderLeftEdge;
    } else {
        leftBorder = style.inactiveBorderLeftEdge;
    }
    if (leftBorder != null) {
        leftBorder.draw(batch, getX(), getY() + contentHeight, headersLeftOffset, getHeight() - contentHeight);
    }
}
 
开发者ID:ratrecommends,项目名称:dice-heroes,代码行数:12,代码来源:TabPane.java

示例7: drawBackground

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入方法依赖的package包/类
private void drawBackground(Batch batch, float parentAlpha) {

        Color color = batch.getColor();
        batch.setColor(1, 1, 1, 1);
        //draw frame
        Drawable frame = null;
        switch (state) {
            case COMPASS:
                frame = style.frameCompasAlign;
                break;
            case USER:
                frame = style.frameUserRotate;
                break;
            case NORTH:
                frame = style.frameNorthOrient;
                break;
        }

        if (frame != null) {
            frame.draw(batch, rec_frame.getX(), rec_frame.getY(), rec_frame.getWidth(), rec_frame.getHeight());
        }

        oldTransform.set(batch.getTransformMatrix());

        //draw scale
        if (style.scale != null) {
            tmp.set(oldTransform);
            tmp.mul(transform_scale);
            batch.setTransformMatrix(tmp);
            style.scale.draw(batch, rec_scale.getX(), rec_scale.getY(), rec_scale.getWidth(), rec_scale.getHeight());
        }

        //draw arrow
        if (style.arrow != null) {
            tmp.set(oldTransform);
            tmp.mul(transform_arrow);
            batch.setTransformMatrix(tmp);
            style.arrow.draw(batch, rec_arrow.getX(), rec_arrow.getY(), rec_arrow.getWidth(), rec_arrow.getHeight());
        }

        batch.setTransformMatrix(oldTransform);
        batch.setColor(color);
    }
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:44,代码来源:Compass.java

示例8: draw

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入方法依赖的package包/类
@Override
public void draw(Batch batch, float parentAlpha) {
    ProgressBarStyle style = this.style;
    final Drawable bg = style.background;
    final Drawable knobBefore = style.progress;

    Color color = getColor();
    float x = getX();
    float y = getY();
    float width = getWidth();
    float height = getHeight();
    float value = getVisualValue();

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

    if (vertical) {
        bg.draw(batch, x + (int) ((width - bg.getMinWidth()) * 0.5f), y, bg.getMinWidth(), height);

        float progressPosHeight = height - (bg.getTopHeight() + bg.getBottomHeight());
        if (min != max) {
            progressPos = (value - min) / (max - min) * progressPosHeight;
            progressPos = Math.max(0, progressPos);
            progressPos = Math.min(progressPosHeight, progressPos) + bg.getBottomHeight();
        }

        if (knobBefore != null) {
            knobBefore.draw(batch, x + (int) ((width - knobBefore.getMinWidth()) * 0.5f), y, knobBefore.getMinWidth(),
                (int) progressPos);
        }
    } else {
        bg.draw(batch, x, y + (int) ((height - bg.getMinHeight()) * 0.5f), width, bg.getMinHeight());

        float progressPosWidth = width - (bg.getLeftWidth() + bg.getRightWidth());
        if (min != max) {
            progressPos = (value - min) / (max - min) * progressPosWidth;
            progressPos = Math.max(0, progressPos);
            progressPos = Math.min(progressPosWidth, progressPos) + bg.getLeftWidth();
        }

        if (knobBefore != null) {
            knobBefore.draw(batch, x, y + (int) ((height - knobBefore.getMinHeight()) * 0.5f), (int) progressPos,
                knobBefore.getMinHeight());
        }
    }
    super.draw(batch, parentAlpha);
}
 
开发者ID:varFamily,项目名称:cocos-ui-libgdx,代码行数:47,代码来源:ProgressBar.java


注:本文中的com.badlogic.gdx.scenes.scene2d.utils.Drawable.draw方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。