本文整理汇总了Java中de.dakror.gamesetup.GameFrame.getHeight方法的典型用法代码示例。如果您正苦于以下问题:Java GameFrame.getHeight方法的具体用法?Java GameFrame.getHeight怎么用?Java GameFrame.getHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.dakror.gamesetup.GameFrame
的用法示例。
在下文中一共展示了GameFrame.getHeight方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawTooltip
import de.dakror.gamesetup.GameFrame; //导入方法依赖的package包/类
@Override
public void drawTooltip(int x, int y, Graphics2D g) {
if (!(Game.currentGame.getActiveLayer() instanceof WorldHUDLayer)) return;
String tooltip = type.getDescription();
String timer = "Dauer: " + Assistant.formatSeconds(timeleft);
int width = g.getFontMetrics(g.getFont().deriveFont(30f)).stringWidth(tooltip) + 35;
int w2 = g.getFontMetrics(g.getFont().deriveFont(27f)).stringWidth(timer) + 35;
width = w2 > width ? w2 : width;
ArrayList<Resource> filled = value.getFilled();
int height = 90 + filled.size() * 30;
int x1 = x;
int y1 = y - 80;
if (x1 + width > Game.getWidth()) x1 -= (x1 + width) - GameFrame.getWidth();
if (y1 + height > Game.getHeight()) y1 -= (y1 + height) - GameFrame.getHeight();
Helper.drawShadow(x1, y1, width, height, g);
Helper.drawString(tooltip, x1 + 15, y1 + 40, g, 30);
Helper.drawString(timer, x1 + 20, y1 + 70, g, 27);
for (int i = 0; i < filled.size(); i++) {
Assistant.drawResource(value, filled.get(i), x1 + 20, y1 + 80 + i * 30, 25, 30, g);
}
}
示例2: drawTooltip
import de.dakror.gamesetup.GameFrame; //导入方法依赖的package包/类
@Override
public void drawTooltip(int x, int y, Graphics2D g) {
int width = 150;
int height = TroopType.values().length * 30 + 70;
int x1 = x;
int y1 = y;
if (x1 + width > GameFrame.getWidth()) x1 -= (x1 + width) - GameFrame.getWidth();
if (y1 + height > GameFrame.getHeight()) y1 -= (y1 + height) - GameFrame.getHeight();
Helper.drawShadow(x1, y1, width, height, g);
Helper.drawString("Truppen", x1 + 20, y1 + 40, g, 35);
for (int i = 0; i < TroopType.values().length; i++) {
Resource r = TroopType.values()[i].getType();
Assistant.drawResource(CityLayer.resources, r, x1 + 20, y1 + i * 30 + 50, 30, 30, g);
}
}
示例3: init
import de.dakror.gamesetup.GameFrame; //导入方法依赖的package包/类
@Override
public void init() {
TextButton cnc = new TextButton(GameFrame.getWidth() / 2 - TextButton.WIDTH, (GameFrame.getHeight() - height) / 2 + height - 15 - TextButton.HEIGHT, "Abbruch");
if (eventNo != null) cnc.addClickEvent(eventNo);
cnc.addClickEvent(new ClickEvent() {
@Override
public void trigger() {
GameFrame.currentFrame.removeLayer(Confirm.this);
}
});
components.add(cnc);
TextButton ok = new TextButton(GameFrame.getWidth() / 2, (GameFrame.getHeight() - height) / 2 + height - 15 - TextButton.HEIGHT, "Ok");
if (eventYes != null) ok.addClickEvent(eventYes);
ok.addClickEvent(new ClickEvent() {
@Override
public void trigger() {
GameFrame.currentFrame.removeLayer(Confirm.this);
}
});
components.add(ok);
}
示例4: drawTooltip
import de.dakror.gamesetup.GameFrame; //导入方法依赖的package包/类
@Override
public void drawTooltip(int x, int y, Graphics2D g) {
int width = g.getFontMetrics(g.getFont().deriveFont(30f)).stringWidth(r.getName()) + 30;
int height = 64;
int x1 = x;
int y1 = y;
if (x1 + width > GameFrame.getWidth()) x1 -= (x1 + width) - GameFrame.getWidth();
if (y1 + height > GameFrame.getHeight()) y1 -= (y1 + height) - GameFrame.getHeight();
Helper.drawShadow(x1, y1, width, height, g);
Helper.drawString(r.getName(), x1 + 15, y1 + 40, g, 30);
}
示例5: drawTooltip
import de.dakror.gamesetup.GameFrame; //导入方法依赖的package包/类
@Override
public void drawTooltip(int x, int y, Graphics2D g) {
if (tooltip != null) {
int width = g.getFontMetrics(g.getFont().deriveFont(30f)).stringWidth(tooltip) + 30;
int height = 64;
int x1 = x;
int y1 = y;
if (x1 + width > GameFrame.getWidth()) x1 -= (x1 + width) - GameFrame.getWidth();
if (y1 + height > GameFrame.getHeight()) y1 -= (y1 + height) - GameFrame.getHeight();
Helper.drawShadow(x1, y1, g.getFontMetrics(g.getFont().deriveFont(30f)).stringWidth(tooltip) + 30, height, g);
Helper.drawString(tooltip, x1 + 15, y1 + 40, g, 30);
}
}
示例6: draw
import de.dakror.gamesetup.GameFrame; //导入方法依赖的package包/类
@Override
public void draw(Graphics2D g) {
drawModality(g);
int x = (GameFrame.getWidth() - width) / 2;
int y = (GameFrame.getHeight() - height) / 2;
if (height == 0) {
height = 20 + Helper.getLineCount(text, width - 30, g, 30) * 30 + TextButton.HEIGHT + 50;
components.clear();
init();
}
Helper.drawContainer(x, y, width, height, true, false, g);
Helper.drawHorizontallyCenteredStringWrapped(text, x, width, y + 45, width - 30, g, 30);
drawComponents(g);
}
示例7: init
import de.dakror.gamesetup.GameFrame; //导入方法依赖的package包/类
@Override
public void init() {
TextButton ok = new TextButton((GameFrame.getWidth() - TextButton.WIDTH) / 2, (GameFrame.getHeight() - height) / 2 + height - 15 - TextButton.HEIGHT, "Ok");
if (event != null) ok.addClickEvent(event);
ok.addClickEvent(new ClickEvent() {
@Override
public void trigger() {
GameFrame.currentFrame.removeLayer(Alert.this);
}
});
components.add(ok);
}