本文整理汇总了Java中org.newdawn.slick.gui.GUIContext类的典型用法代码示例。如果您正苦于以下问题:Java GUIContext类的具体用法?Java GUIContext怎么用?Java GUIContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GUIContext类属于org.newdawn.slick.gui包,在下文中一共展示了GUIContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import org.newdawn.slick.gui.GUIContext; //导入依赖的package包/类
@Override
public void render(GUIContext container, Graphics g) throws SlickException {
g.setClip((int) x, (int) y, width, height);
// background
g.setColor(COLOR_BG);
g.fillRect(x, y, width, height);
// render states
if (!stateChangeProgress.isFinished()) {
// blend states
float t = stateChangeProgress.getValue();
if (state == State.CREATE_USER)
t = 1f - t;
renderUserSelect(g, t);
renderUserCreate(g, 1f - t);
} else if (state == State.USER_SELECT)
renderUserSelect(g, globalAlpha);
else if (state == State.CREATE_USER)
renderUserCreate(g, globalAlpha);
g.clearClip();
}
示例2: TSTextButton
import org.newdawn.slick.gui.GUIContext; //导入依赖的package包/类
public TSTextButton(GUIContext container, Engine parent, TSBooleanSupplier onState,
int x, int y, String text, Font font, Color textColor,
Color boxFillColor, Color boxBorderColor, int padding, int alignX,
int alignY){
super(container, x, y);
this.text = text;
this.font = font;
this.textColor = textColor;
this.boxFillColor = boxFillColor;
this.boxBorderColor = boxBorderColor;
borderPadding = padding;
this.alignX = alignX;
this.alignY = alignY;
this.parent = parent;
this.onState = onState;
}
示例3: render
import org.newdawn.slick.gui.GUIContext; //导入依赖的package包/类
@Override
public void render(GUIContext container, Graphics g) throws SlickException {
//Render container
g.fill(contents, sf);
//Render buttons
speedUp.render(container, g);
speedDown.render(container, g);
pause.render(container, g);
restart.render(container, g);
euler.render(container, g);
hemisphere.render(container, g);
close.render(container, g);
}
示例4: TSFocusButton
import org.newdawn.slick.gui.GUIContext; //导入依赖的package包/类
public TSFocusButton(GUIContext container, TSMouseFocusable parent, int x1,
int y1, int x2, int y2, Color boxFillColor, Color boxBorderColor){
super(container, x1, y1, x2, y2);
this.boxFillColor = boxFillColor;
this.boxBorderColor = boxBorderColor;
this.parent = parent;
}
示例5: TSBoxLabel
import org.newdawn.slick.gui.GUIContext; //导入依赖的package包/类
public TSBoxLabel(GUIContext container, TSComponent item,
Color boxFillColor, Color boxBorderColor, int borderPadding){
super(container, 0, 0, 0, 0, item);
this.borderPadding = borderPadding;
this.boxFillColor = boxFillColor;
this.boxBorderColor = boxBorderColor;
}
示例6: TSTextLabel
import org.newdawn.slick.gui.GUIContext; //导入依赖的package包/类
public TSTextLabel(GUIContext container, int x, int y, String text,
Font font, Color textColor, int alignX, int alignY){
super(container, x, y, 0, 0);
this.text = text;
this.font = font;
this.textColor = textColor;
this.alignX = alignX;
this.alignY = alignY;
}
示例7: TSFocusTextButton
import org.newdawn.slick.gui.GUIContext; //导入依赖的package包/类
public TSFocusTextButton(GUIContext container, TSMouseFocusable parent,
int x, int y, String text, Font font, Color textColor,
Color boxFillColor, Color boxBorderColor, int padding, int alignX,
int alignY){
super(container, parent, x, y, 0, 0, boxFillColor, boxBorderColor);
this.text = text;
this.font = font;
this.textColor = textColor;
borderPadding = padding;
this.alignX = alignX;
this.alignY = alignY;
}
示例8: NPCGui
import org.newdawn.slick.gui.GUIContext; //导入依赖的package包/类
public NPCGui(GUIContext c, int x, int y) {
this.x = x;
this.y = y;
this.c = c;
background = RessourceManager.loadImage("npcgui.png");
scrollbox = new InventoryScrollBoxComponent(c, RessourceManager.loadImage("scrollbox1.png"), x+16, y+160);
}
示例9: render
import org.newdawn.slick.gui.GUIContext; //导入依赖的package包/类
@Override
public void render(GUIContext c, Graphics g) {
if (elements == null) return;
/* Hintergrund rendern */
super.render(c, g);
/* Strings werden gezeichnet */
for (int i=0; i<elements.size();i++) {
// textoffset und position (i) verschiebt nach unten (positiv), offset nach oben (negativ)
int tempOffsetY = textoffsetY - offset + i*16;
int tempOffsetX = textoffsetX;
int tempX = getX() + tempOffsetX;
int tempY = getY() + tempOffsetY;
/* Ausgew�hltes Element blau hinterlegen */
if (i==selected) {
// halb-tranzparentes schwarz
g.setColor(new Color(0f,0f,0f,0.5f));
g.fillRect(tempX, tempY , getWidth() - 2*textoffsetX, 16);
// wei�
g.setColor(new Color(1f,1f,1f,1f));
}
/* Auch unten ist die Grenze 1*textoffset weiter oben */
if (tempOffsetY + textoffsetY < getHeight()) {
String drawString = elements.get(i).getScreenName();
if (elements.get(i).getQuantity() > 1)
drawString += " x" + elements.get(i).getQuantity();
g.drawString(drawString, tempX, tempY);
}
}
// �berlappende Elemente verdecken
foreground.draw(getX(), getY());
}
示例10: SlickButton
import org.newdawn.slick.gui.GUIContext; //导入依赖的package包/类
public SlickButton(GUIContext container, Image image, int x, int y, int width, int height,
ComponentListener listener) {
super(container, image, x, y, width, height, listener);
}
示例11: render
import org.newdawn.slick.gui.GUIContext; //导入依赖的package包/类
@Override
public void render(GUIContext gameContainer, Graphics g) {
super.render(gameContainer, g);
g.setColor(Color.black);
g.drawString(text, getX() + 20, getY() + 20);
}
示例12: render
import org.newdawn.slick.gui.GUIContext; //导入依赖的package包/类
@Override
public void render(GUIContext container, Graphics g) throws SlickException {
// update animation
long time = container.getTime();
if (lastUpdateTime > 0) {
int delta = (int) (time - lastUpdateTime);
expandProgress.update((expanded) ? delta : -delta * 2);
}
this.lastUpdateTime = time;
// get parameters
Input input = container.getInput();
int idx = getIndexAt(input.getMouseX(), input.getMouseY());
float t = expandProgress.getValue();
if (expanded)
t = AnimationEquation.OUT_CUBIC.calc(t);
// background and border
Color oldGColor = g.getColor();
float oldLineWidth = g.getLineWidth();
final int cornerRadius = 6;
g.setLineWidth(1f);
g.setColor((idx == -1) ? highlightColor : backgroundColor);
g.fillRoundRect((int) x, (int) y, width, baseHeight, cornerRadius);
g.setColor(borderColor);
g.drawRoundRect((int) x, (int) y, width, baseHeight, cornerRadius);
if (expanded || t >= 0.0001) {
float oldBackgroundAlpha = backgroundColor.a;
backgroundColor.a *= t;
g.setColor(backgroundColor);
g.fillRoundRect((int) x, (int) (y + offsetY), width, (height - offsetY) * t, cornerRadius);
backgroundColor.a = oldBackgroundAlpha;
}
if (idx >= 0 && t >= 0.9999) {
g.setColor(highlightColor);
float yPos = y + offsetY + (offsetY * idx);
int yOff = 0, hOff = 0;
if (idx == 0 || idx == items.length - 1) {
g.fillRoundRect((int) x, (int) yPos, width, offsetY, cornerRadius);
if (idx == 0)
yOff = cornerRadius;
hOff = cornerRadius;
}
g.fillRect((int) x, (int) (yPos + yOff), width, offsetY - hOff);
}
g.setColor(oldGColor);
g.setLineWidth(oldLineWidth);
// text
chevronDown.draw(x + width - chevronDown.getWidth() - width * CHEVRON_X, y + (baseHeight - chevronDown.getHeight()) / 2f, chevronDownColor);
fontNormal.drawString(x + (width * 0.03f), y + (fontNormal.getPaddingTop() + fontNormal.getPaddingBottom()) / 2f, itemNames[itemIndex], textColor);
float oldTextAlpha = textColor.a;
textColor.a *= t;
if (expanded || t >= 0.0001) {
for (int i = 0; i < itemNames.length; i++) {
Font f = (i == itemIndex) ? fontSelected : fontNormal;
if (i == idx && t >= 0.999)
chevronRight.draw(x, y + offsetY + (offsetY * i) + (offsetY - chevronRight.getHeight()) / 2f, chevronRightColor);
f.drawString(x + chevronRight.getWidth(), y + offsetY + (offsetY * i * t), itemNames[i], textColor);
}
}
textColor.a = oldTextAlpha;
}
示例13: TextButton
import org.newdawn.slick.gui.GUIContext; //导入依赖的package包/类
public TextButton(GUIContext container, String text, int x, int y, Font font) {
this(container, text, x, y, font != null ? font.getWidth(text) : container.getDefaultFont().getWidth(text), font != null ? font
.getHeight(text) : container.getDefaultFont().getHeight(text));
this.font = font != null ? font : container.getDefaultFont();
this.mouseOverFont = this.font;
}
示例14: render
import org.newdawn.slick.gui.GUIContext; //导入依赖的package包/类
/**
* @see org.newdawn.slick.gui.AbstractComponent#render(org.newdawn.slick.gui.GUIContext,
* org.newdawn.slick.Graphics)
*/
public void render(GUIContext container, Graphics g) {
if (font != null)
g.setFont(font);
g.drawString(text, this.getX(), this.getY());
}
示例15: TSBoxMenu
import org.newdawn.slick.gui.GUIContext; //导入依赖的package包/类
public TSBoxMenu(GUIContext container, Color boxFillColor,
Color boxBorderColor){
this(container, 0, 0, boxFillColor, boxBorderColor);
}