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


Java Drawable.getRightWidth方法代码示例

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


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

示例1: EmptyDrawable

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入方法依赖的package包/类
/** Creates a new empty drawable with the same sizing information as the specified drawable. */
public EmptyDrawable(Drawable drawable) {
	leftWidth = drawable.getLeftWidth();
	rightWidth = drawable.getRightWidth();
	topHeight = drawable.getTopHeight();
	bottomHeight = drawable.getBottomHeight();
	minWidth = drawable.getMinWidth();
	minHeight = drawable.getMinHeight();
}
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:10,代码来源:EmptyDrawable.java

示例2: calculatePositionAndValue

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入方法依赖的package包/类
boolean calculatePositionAndValue(float x, float y) {
    final Drawable bg = style.background;

    float value;
    float oldPosition = progressPos;

    if (vertical) {
        float height = getHeight() - bg.getTopHeight() - bg.getBottomHeight();
        progressPos = y - bg.getBottomHeight();
        value = min + (max - min) * (progressPos / height);
        progressPos = Math.max(0, progressPos);
        progressPos = Math.min(height, progressPos);
    } else {
        float width = getWidth() - bg.getLeftWidth() - bg.getRightWidth();
        progressPos = x - bg.getLeftWidth();
        value = min + (max - min) * (progressPos / width);
        progressPos = Math.max(0, progressPos);
        progressPos = Math.min(width, progressPos);
    }

    float oldValue = value;
    boolean valueSet = setValue(value);
    if (value == oldValue) {
        progressPos = oldPosition;
    }
    return valueSet;
}
 
开发者ID:varFamily,项目名称:cocos-ui-libgdx,代码行数:28,代码来源:ProgressBar.java

示例3: isTextFitTextField

import com.badlogic.gdx.scenes.scene2d.utils.Drawable; //导入方法依赖的package包/类
/** Checks if the text could fit the current textField's width. */
public static boolean isTextFitTextField(VisTextField textField, String text) {
    float availableWidth = textField.getWidth();
    Drawable fieldBg = textField.getStyle().background;
    if (fieldBg != null) {
        availableWidth = availableWidth - fieldBg.getLeftWidth() - fieldBg.getRightWidth();
    }
    BitmapFont font = textField.getStyle().font;
    return isTextFitWidth(font, availableWidth, text);
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:11,代码来源:Scene2dUtils.java

示例4: 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.getRightWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。