本文整理汇总了Java中org.darkstorm.minecraft.gui.component.ProgressBar类的典型用法代码示例。如果您正苦于以下问题:Java ProgressBar类的具体用法?Java ProgressBar怎么用?Java ProgressBar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProgressBar类属于org.darkstorm.minecraft.gui.component包,在下文中一共展示了ProgressBar类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SimpleProgressBarUI
import org.darkstorm.minecraft.gui.component.ProgressBar; //导入依赖的package包/类
public SimpleProgressBarUI(SimpleTheme theme) {
super(ProgressBar.class);
this.theme = theme;
foreground = theme.foreground.brighter();
background = new Color(64, 64, 128, 128 + 128 / 2);
}
示例2: WurstProgressBarUI
import org.darkstorm.minecraft.gui.component.ProgressBar; //导入依赖的package包/类
public WurstProgressBarUI(WurstTheme theme) {
super(ProgressBar.class);
this.theme = theme;
foreground = Color.LIGHT_GRAY;
background = new Color(128, 128, 128, 128 + 128 / 2);
}
示例3: SimpleProgressBarUI
import org.darkstorm.minecraft.gui.component.ProgressBar; //导入依赖的package包/类
public SimpleProgressBarUI(SimpleTheme theme) {
super(ProgressBar.class);
this.theme = theme;
foreground = Color.LIGHT_GRAY;
background = new Color(128, 128, 128, 128 + 128 / 2);
}
示例4: SimpleProgressBarUI
import org.darkstorm.minecraft.gui.component.ProgressBar; //导入依赖的package包/类
public SimpleProgressBarUI(SimpleTheme theme) {
super(ProgressBar.class);
this.theme = theme;
foreground = Color.LIGHT_GRAY;
background = new Color(128, 128, 128, 128 + 128 / 2);
}
示例5: renderComponent
import org.darkstorm.minecraft.gui.component.ProgressBar; //导入依赖的package包/类
@Override
protected void renderComponent(ProgressBar component) {
Rectangle area = component.getArea();
int fontSize = theme.getFontRenderer().FONT_HEIGHT;
FontRenderer fontRenderer = theme.getFontRenderer();
translateComponent(component, false);
glEnable(GL_BLEND);
glDisable(GL_CULL_FACE);
glDisable(GL_TEXTURE_2D);
RenderUtil.setColor(component.getBackgroundColor());
glLineWidth(0.9f);
glBegin(GL_LINE_LOOP);
{
glVertex2d(0, 0);
glVertex2d(area.width, 0);
glVertex2d(area.width, area.height);
glVertex2d(0, area.height);
}
glEnd();
double barPercentage = (component.getValue() - component.getMinimumValue()) / (component.getMaximumValue() - component.getMinimumValue());
RenderUtil.setColor(component.getForegroundColor());
glBegin(GL_QUADS);
{
glVertex2d(0, 0);
glVertex2d(area.width * barPercentage, 0);
glVertex2d(area.width * barPercentage, area.height);
glVertex2d(0, area.height);
}
glEnd();
glEnable(GL_TEXTURE_2D);
String content = null;
switch(component.getValueDisplay()) {
case DECIMAL:
content = String.format("%,.3f", component.getValue());
break;
case INTEGER:
content = String.format("%,d", Long.valueOf(Math.round(component.getValue())));
break;
case PERCENTAGE:
int percent = (int) Math.round((component.getValue() - component.getMinimumValue()) / (component.getMaximumValue() - component.getMinimumValue()) * 100D);
content = String.format("%d%%", percent);
default:
}
if(content != null) {
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR);
fontRenderer.drawString(content, component.getWidth() / 2 - fontRenderer.getStringWidth(content) / 2, component.getHeight() / 2 - fontSize / 2, RenderUtil.toRGBA(component.getForegroundColor()));
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
glEnable(GL_CULL_FACE);
glDisable(GL_BLEND);
translateComponent(component, true);
}
示例6: getDefaultComponentSize
import org.darkstorm.minecraft.gui.component.ProgressBar; //导入依赖的package包/类
@Override
protected Dimension getDefaultComponentSize(ProgressBar component) {
return new Dimension(100, 4 + theme.getFontRenderer().FONT_HEIGHT);
}
示例7: getInteractableComponentRegions
import org.darkstorm.minecraft.gui.component.ProgressBar; //导入依赖的package包/类
@Override
protected Rectangle[] getInteractableComponentRegions(ProgressBar component) {
return new Rectangle[0];
}
示例8: renderComponent
import org.darkstorm.minecraft.gui.component.ProgressBar; //导入依赖的package包/类
@Override
protected void renderComponent(ProgressBar component) {
Rectangle area = component.getArea();
int fontSize = theme.getFontRenderer().FONT_HEIGHT;
FontRenderer fontRenderer = theme.getFontRenderer();
translateComponent(component, false);
glEnable(GL_BLEND);
glDisable(GL_CULL_FACE);
glDisable(GL_TEXTURE_2D);
RenderUtil.setColor(component.getBackgroundColor());
glLineWidth(0.9f);
glBegin(GL_LINE_LOOP);
{
glVertex2d(0, 0);
glVertex2d(area.width, 0);
glVertex2d(area.width, area.height);
glVertex2d(0, area.height);
}
glEnd();
double barPercentage = (component.getValue() - component.getMinimumValue()) /
(component.getMaximumValue() - component.getMinimumValue());
RenderUtil.setColor(component.getForegroundColor());
glBegin(GL_QUADS);
{
glVertex2d(0, 0);
glVertex2d(area.width * barPercentage, 0);
glVertex2d(area.width * barPercentage, area.height);
glVertex2d(0, area.height);
}
glEnd();
glEnable(GL_TEXTURE_2D);
String content = null;
switch (component.getValueDisplay()) {
case DECIMAL:
content = String.format("%,.3f", component.getValue());
break;
case INTEGER:
content = String.format("%,d", Math.round(component.getValue()));
break;
case PERCENTAGE:
int percent = (int) Math.round((component.getValue() - component.getMinimumValue()) /
(component.getMaximumValue() - component.getMinimumValue()) * 100D);
content = String.format("%d%%", percent);
default:
}
if (content != null) {
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR);
fontRenderer.drawString(content, component.getWidth() / 2 - fontRenderer.getStringWidth(content) / 2,
component.getHeight() / 2 - fontSize / 2, RenderUtil.toRGBA(component.getForegroundColor()));
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
glEnable(GL_CULL_FACE);
glDisable(GL_BLEND);
translateComponent(component, true);
}
示例9: getDefaultComponentSize
import org.darkstorm.minecraft.gui.component.ProgressBar; //导入依赖的package包/类
@Override
protected Dimension getDefaultComponentSize(ProgressBar component) {
return new Dimension(100, 4 + theme.getFontRenderer().FONT_HEIGHT);
}
示例10: getInteractableComponentRegions
import org.darkstorm.minecraft.gui.component.ProgressBar; //导入依赖的package包/类
@Override
protected Rectangle[] getInteractableComponentRegions(ProgressBar component) {
return new Rectangle[0];
}