本文整理汇总了Java中de.dakror.gamesetup.GameFrame类的典型用法代码示例。如果您正苦于以下问题:Java GameFrame类的具体用法?Java GameFrame怎么用?Java GameFrame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GameFrame类属于de.dakror.gamesetup包,在下文中一共展示了GameFrame类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
开发者ID:Dakror,项目名称:Arise,代码行数:26,代码来源:Transfer.java
示例2: draw
import de.dakror.gamesetup.GameFrame; //导入依赖的package包/类
@Override
public void draw(Graphics2D g) {
AffineTransform old = g.getTransform();
AffineTransform at = g.getTransform();
at.translate(x, y);
g.setTransform(at);
for (int i = 0; i < Math.ceil(width / (float) CHUNKSIZE); i++)
for (int j = 0; j < Math.ceil(height / (float) CHUNKSIZE); j++)
if (new Rectangle(0, 0, Game.getWidth(), Game.getHeight()).intersects(new Rectangle(minX + i * CHUNKSIZE + x, minY + j * CHUNKSIZE + y, CHUNKSIZE, CHUNKSIZE)))
g.drawImage(chunk, minX + i * CHUNKSIZE, minY + j * CHUNKSIZE, null);
Component hovered = null;
for (Component c : components) {
if (!new Rectangle(0, 0, Game.getWidth(), Game.getHeight()).intersects(new Rectangle(c.getX() + x, c.getY() + y, c.getWidth(), c.getHeight()))) continue;
c.draw(g);
if (c.state == 2) hovered = c;
}
if (hovered != null) hovered.drawTooltip(GameFrame.currentFrame.mouse.x, GameFrame.currentFrame.mouse.y, g);
g.setTransform(old);
}
开发者ID:Dakror,项目名称:Arise,代码行数:26,代码来源:World.java
示例3: 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);
}
}
开发者ID:Dakror,项目名称:Arise,代码行数:18,代码来源:ArmyLabel.java
示例4: draw
import de.dakror.gamesetup.GameFrame; //导入依赖的package包/类
@Override
public void draw(Graphics2D g) {
g.drawImage(cache, 0, 0, null);
if (selectedBuilding != null) {
int width = 300, height = 200;
Helper.drawContainer(Game.getWidth() - width, Game.getHeight() - height, width, height, true, false, g);
}
Component hovered = null;
for (Component c : components) {
c.draw(g);
if (c.state == 2) hovered = c;
}
if (selectedBuilding != null) selectedBuilding.getGuiContainer().draw(g);
if (hovered != null && Game.currentGame.getActiveLayer() instanceof CityHUDLayer) hovered.drawTooltip(GameFrame.currentFrame.mouse.x, GameFrame.currentFrame.mouse.y, g);
}
开发者ID:Dakror,项目名称:Arise,代码行数:18,代码来源:CityHUDLayer.java
示例5: draw
import de.dakror.gamesetup.GameFrame; //导入依赖的package包/类
@Override
public void draw(Graphics2D g) {
int ty = state == 0 ? 124 : (state == 1 ? 202 : 280);
if (toggle) {
ty = selected ? 202 : 124;
}
if (!enabled) ty = 358;
Helper.drawImage(GameFrame.getImage("gui/gui.png"), x, y, width, height, 12, ty, WIDTH, HEIGHT, g);
Color c = g.getColor();
if (!enabled) g.setColor(Color.gray);
else g.setColor(Color.white);
if (toggle && selected) g.setColor(Color.decode("#7cde6a"));
Helper.drawHorizontallyCenteredString(text, x, width, y + height / 2 + shiftY, g, size);
g.setColor(c);
}
开发者ID:Dakror,项目名称:GameSetup,代码行数:22,代码来源:TextButton.java
示例6: drawContainer
import de.dakror.gamesetup.GameFrame; //导入依赖的package包/类
public static void drawContainer(int x, int y, int width, int height, boolean doubled, boolean wood, boolean shadow, Graphics2D g) {
if (shadow) drawShadow(x - 10, y - 10, width + 20, height + 20, g);
Image image = GameFrame.getImage(wood ? "gui/wood.png" : "gui/paper.png");
Shape oldClip = g.getClip();
g.setClip(x, y, width, height);
for (int i = x; i < x + width; i += 512) {
for (int j = y; j < y + height; j += 512) {
g.drawImage(image, i, j, GameFrame.w);
}
}
g.setClip(oldClip);
drawOutline(x, y, width, height, doubled, g);
}
开发者ID:Dakror,项目名称:GameSetup,代码行数:17,代码来源:Helper.java
示例7: drawProgressBar
import de.dakror.gamesetup.GameFrame; //导入依赖的package包/类
/**
* @param percent 0 - 1
*/
public static void drawProgressBar(int x, int y, int width, float percent, String color, Graphics2D g) {
Image filling = GameFrame.getImage("gui/bar/Bar-" + color + ".png");
Image base = GameFrame.getImage("gui/bar/BarBase.png");
drawImage(base, x, y, 6, 23, 0, 0, 6, 23, g);
drawImage(base, x + width - 6, y, 6, 23, 7, 0, 6, 23, g);
for (int i = x + 6; i < x + width - 6; i++)
drawImage(base, i, y, 1, 23, 6, 0, 1, 23, g);
int fillWidth = (int) ((width - 12) * percent);
if (percent > 0) drawImage(filling, x, y, 6, 23, 0, 0, 6, 23, g);
if (percent == 1) drawImage(filling, x + width - 6, y, 6, 23, 7, 0, 6, 23, g);
for (int i = x + 6; i < x + 6 + fillWidth; i++)
drawImage(filling, i, y, 1, 23, 6, 0, 1, 23, g);
}
开发者ID:Dakror,项目名称:GameSetup,代码行数:21,代码来源:Helper.java
示例8: 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);
}
开发者ID:Dakror,项目名称:GameSetup,代码行数:23,代码来源:Confirm.java
示例9: draw
import de.dakror.gamesetup.GameFrame; //导入依赖的package包/类
@Override
public void draw(Graphics2D g) {
drawModality(g);
Helper.drawContainer(GameFrame.getWidth() / 2 - 310, Game.getHeight() / 2 - 125, 620, 250, true, false, g);
Helper.drawHorizontallyCenteredString("Bezahlung", Game.getWidth(), Game.getHeight() / 2 - 75, g, 40);
Helper.drawHorizontallyCenteredString("Das Bauen deiner Waffe kostet", Game.getWidth(), Game.getHeight() / 2 - 50, g, 20);
Color c = g.getColor();
if (Game.money >= costs) g.setColor(Color.darkGray);
else g.setColor(Color.decode("#660a0a"));
Helper.drawHorizontallyCenteredString(costs == 0 ? "Nichts" : costs + "$", Game.getWidth(), Game.getHeight() / 2 + 20, g, 80);
g.setColor(c);
drawComponents(g);
}
开发者ID:Dakror,项目名称:SpamWars,代码行数:18,代码来源:PurchaseWeaponLayer.java
示例10: 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);
}
开发者ID:Dakror,项目名称:Arise,代码行数:14,代码来源:ResourceLabel.java
示例11: drawBuildingStage
import de.dakror.gamesetup.GameFrame; //导入依赖的package包/类
public static void drawBuildingStage(int x, int y, Building b, Graphics2D g) {
BufferedImage tile = GameFrame.getImage("world/buildingStage.png");
int width = b.bw * 32;
int height = b.bh * 32;
int size = 32;
Helper.drawImage(tile, x, y, size, size, 0, 0, size, size, g); // lt
Helper.drawImage(tile, x + width - size, y, size, size, size * 2, 0, size, size, g); // rt
Helper.drawImage(tile, x, y + height - size, size, size, 0, size * 2, size, size, g); // lb
Helper.drawImage(tile, x + width - size, y + height - size, size, size, size * 2, size * 2, size, size, g); // rb
for (int i = size; i <= width - size * 2; i += size)
Helper.drawImage(tile, x + i, y, size, size, size, 0, size, size, g);// t
for (int i = size; i <= width - size * 2; i += size)
Helper.drawImage(tile, x + i, y + height - size, size, size, size, size * 2, size, size, g); // b
for (int i = size; i <= height - size * 2; i += size)
Helper.drawImage(tile, x, y + i, size, size, 0, size, size, size, g); // l
for (int i = size; i <= height - size * 2; i += size)
Helper.drawImage(tile, x + width - size, y + i, size, size, size * 2, size, size, size, g); // r
for (int i = size; i <= width - size * 2; i += size)
for (int j = size; j <= height - size * 2; j += size)
Helper.drawImage(tile, x + i, y + j, size, size, size, size, size, size, g); // m
}
开发者ID:Dakror,项目名称:Arise,代码行数:29,代码来源:Assistant.java
示例12: draw
import de.dakror.gamesetup.GameFrame; //导入依赖的package包/类
@Override
public void draw(Graphics2D g) {
Image img = GameFrame.getImage("gui/gui.png");
if (horizontal) {
Helper.drawImage2(img, x, y, 7, height, 794, 72, 7, 20, g);
Helper.drawImage2(img, x + width - 7, y, 7, height, 994, 72, 7, 20, g);
for (int i = 0; i < (width - 14) / 193; i++)
Helper.drawImage2(img, x + 7 + i * 193, y, 193, height, 801, 72, 193, 20, g);
Helper.drawImage2(img, x + 7 + (width - 14) / 193 * 193, y, (width - 14) % 193, height, 801, 72, (width - 14) % 193, 20, g);
if (enabled) Helper.drawImage2(img, (int) (x + sliderPos - 5), y - (38 - height) / 2, 20, 35, 889, 16, 25, 44, g);
} else {
AffineTransform old = g.getTransform();
AffineTransform at = g.getTransform();
at.rotate(Math.toRadians(90), x + HEIGHT / 2, y + HEIGHT / 2);
g.setTransform(at);
Helper.drawImage2(img, x, y, 7, width, 794, 72, 7, 20, g);
Helper.drawImage2(img, x + height - 7, y, 7, width, 994, 72, 7, 20, g);
for (int i = 0; i < (height - 14) / 193; i++)
Helper.drawImage2(img, x + 7 + i * 193, y, 193, width, 801, 72, 193, 20, g);
Helper.drawImage2(img, x + 7 + (height - 14) / 193 * 193, y, (height - 14) % 193, width, 801, 72, (height - 14) % 193, 20, g);
if (enabled) Helper.drawImage2(img, (int) (x + sliderPos - 5), y - (38 - width) / 2, 20, 35, 889, 16, 25, 44, g);
g.setTransform(old);
}
String displayString = ((title != null) ? title + ": " : "") + ((integerMode) ? (value) + "" : value);
if (customTitles.containsKey(value)) displayString = customTitles.get(value);
Helper.drawHorizontallyCenteredString(displayString, x, width, y - 5, g, 30);
}
开发者ID:Dakror,项目名称:GameSetup,代码行数:36,代码来源:Slider.java
示例13: draw
import de.dakror.gamesetup.GameFrame; //导入依赖的package包/类
@Override
public void draw(Graphics2D g) {
int tx = 138;
if (state == 2) tx = 183;
if (!enabled) tx = 228;
Helper.drawImage(GameFrame.getImage("gui/gui.png"), x, y, width, height, tx, selected ? 47 : 3, WIDTH, HEIGHT, g);
}
开发者ID:Dakror,项目名称:GameSetup,代码行数:9,代码来源:Checkbox.java
示例14: drawComponents
import de.dakror.gamesetup.GameFrame; //导入依赖的package包/类
protected void drawComponents(Graphics2D g) {
Component hovered = null;
for (Component c : components) {
c.draw(g);
if (c.state == 2) hovered = c;
}
if (hovered != null) hovered.drawTooltip(GameFrame.currentFrame.mouse.x, GameFrame.currentFrame.mouse.y, g);
}
开发者ID:Dakror,项目名称:GameSetup,代码行数:9,代码来源:Container.java
示例15: 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);
}
}
开发者ID:Dakror,项目名称:GameSetup,代码行数:16,代码来源:IconButton.java
示例16: draw
import de.dakror.gamesetup.GameFrame; //导入依赖的package包/类
@Override
public void draw(Graphics2D g) {
int ty = this.ty + MARGIN * state;
if (!enabled) ty = this.ty + MARGIN * 3;
Helper.drawImage(GameFrame.getImage("gui/gui.png"), x, y, width, height, tx, ty, width, height, g);
}
开发者ID:Dakror,项目名称:GameSetup,代码行数:9,代码来源:ArrowButton.java
示例17: drawShadow
import de.dakror.gamesetup.GameFrame; //导入依赖的package包/类
public static void drawShadow(int x, int y, int width, int height, Graphics2D g) {
BufferedImage shadow = GameFrame.getImage("gui/shadow.png");
int size = 32;
if (width == height && width < 64) {
g.drawImage(shadow, x, y, width, height, GameFrame.w);
return;
} else if (height < 64) {
shadow = toBufferedImage(shadow.getScaledInstance(height * 3 / 2, height * 3 / 2, Image.SCALE_FAST));
size = height / 2;
}
drawImage(shadow, x, y, size, size, 0, 0, size, size, g); // lt
drawImage(shadow, x + width - size, y, size, size, size * 2, 0, size, size, g); // rt
drawImage(shadow, x, y + height - size, size, size, 0, size * 2, size, size, g); // lb
drawImage(shadow, x + width - size, y + height - size, size, size, size * 2, size * 2, size, size, g); // rb
for (int i = x + size; i <= x + width - size * 2; i += size)
drawImage(shadow, i, y, size, size, size, 0, size, size, g);// t
drawImage(shadow, x + width - size - (width - size * 2) % size, y, (width - size * 2) % size, size, size, 0, (width - size * 2) % size, size, g);
for (int i = x + size; i <= x + width - size * 2; i += size)
drawImage(shadow, i, y + height - size, size, size, size, size * 2, size, size, g); // b
drawImage(shadow, x + width - size - (width - size * 2) % size, y + height - size, (width - size * 2) % size, size, size, size * 2, (width - size * 2) % size, size, g);
for (int i = y + size; i <= y + height - size * 2; i += size)
drawImage(shadow, x, i, size, size, 0, size, size, size, g); // l
drawImage(shadow, x, y + height - size - (height - size * 2) % size, size, (height - size * 2) % size, 0, size, size, (height - size * 2) % size, g);
for (int i = y + size; i <= y + height - size * 2; i += size)
drawImage(shadow, x + width - size, i, size, size, size * 2, size, size, size, g); // r
drawImage(shadow, x + width - size, y + height - size - (height - size * 2) % size, size, (height - size * 2) % size, size * 2, size, size, (height - size * 2) % size, g);
drawImage(shadow, x + size, y + size, width - size * 2, height - size * 2, size, size, size, size, g); // m
}
开发者ID:Dakror,项目名称:GameSetup,代码行数:36,代码来源:Helper.java
示例18: 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);
}
开发者ID:Dakror,项目名称:GameSetup,代码行数:16,代码来源:Confirm.java
示例19: drawModality
import de.dakror.gamesetup.GameFrame; //导入依赖的package包/类
public static void drawModality(Graphics2D g) {
Composite c = g.getComposite();
Color o = g.getColor();
g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));
g.setColor(Color.black);
g.fillRect(0, 0, GameFrame.getWidth(), GameFrame.getHeight());
g.setColor(o);
g.setComposite(c);
}
开发者ID:Dakror,项目名称:GameSetup,代码行数:10,代码来源:Layer.java
示例20: 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);
}
开发者ID:Dakror,项目名称:GameSetup,代码行数:13,代码来源:Alert.java
注:本文中的de.dakror.gamesetup.GameFrame类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论