當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。