本文整理汇总了Java中de.dakror.gamesetup.GameFrame.getImage方法的典型用法代码示例。如果您正苦于以下问题:Java GameFrame.getImage方法的具体用法?Java GameFrame.getImage怎么用?Java GameFrame.getImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.dakror.gamesetup.GameFrame
的用法示例。
在下文中一共展示了GameFrame.getImage方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: 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
}
示例4: 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);
}
示例5: 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
}
示例6: IconButton
import de.dakror.gamesetup.GameFrame; //导入方法依赖的package包/类
public IconButton(int x, int y, int width, int height, String img) {
this(x, y, width, height, GameFrame.getImage(img));
}
示例7: drawOutline
import de.dakror.gamesetup.GameFrame; //导入方法依赖的package包/类
public static void drawOutline(int x, int y, int width, int height, boolean doubled, Graphics2D g) {
BufferedImage gui = GameFrame.getImage("gui/gui.png");
int cornerSize = (doubled) ? 24 : 19;
int lineThickness = (doubled) ? 17 : 12;
int lineHeight = (doubled) ? 55 : 59;
int lineWidth = (doubled) ? 73 : 74;
// x1 y1 y2 x2
int[] c = (doubled) ? new int[] { 856, 189, 294, 978 } : new int[] { 865, 398, 498, 982 };
int[] m = (doubled) ? new int[] { 893, 227, 301, 985 } : new int[] { 899, 428, 505, 989 };
drawImage(gui, x, y, cornerSize, cornerSize, c[0], c[1], cornerSize, cornerSize, g); // lt
for (int i = 0; i < (width - cornerSize * 2) / lineWidth; i++)
drawImage(gui, x + cornerSize + i * lineWidth, y, lineWidth, lineThickness, m[0], c[1], lineWidth, lineThickness, g); // mt
drawImage(gui, x + cornerSize + (width - cornerSize * 2) / lineWidth * lineWidth, y, (width - cornerSize * 2) % lineWidth, lineThickness, m[0], c[1],
((width - cornerSize * 2) % lineWidth), lineThickness, g);
drawImage(gui, x + width - cornerSize, y, cornerSize, cornerSize, c[3], c[1], cornerSize, cornerSize, g); // rt
for (int i = 0; i < (height - cornerSize * 2) / lineHeight; i++)
drawImage(gui, x, y + cornerSize + i * lineHeight, lineThickness, lineHeight, c[0], m[1], lineThickness, lineHeight, g); // ml
drawImage(gui, x, y + cornerSize + (height - cornerSize * 2) / lineHeight * lineHeight, lineThickness, (height - cornerSize * 2) % lineHeight, c[0], m[1], lineThickness,
((height - cornerSize * 2) % lineHeight), g);
for (int i = 0; i < (height - cornerSize * 2) / lineHeight; i++)
drawImage(gui, x + width - lineThickness, y + cornerSize + i * lineHeight, lineThickness, lineHeight, m[3], m[1], lineThickness, lineHeight, g); // mr
drawImage(gui, x + width - lineThickness, y + cornerSize + (height - cornerSize * 2) / lineHeight * lineHeight, lineThickness, (height - cornerSize * 2) % lineHeight, m[3],
m[1], lineThickness, ((height - cornerSize * 2) % lineHeight), g);
drawImage(gui, x, y + height - cornerSize, cornerSize, cornerSize, c[0], c[2], cornerSize, cornerSize, g); // lb
for (int i = 0; i < (width - cornerSize * 2) / lineWidth; i++)
drawImage(gui, x + cornerSize + i * lineWidth, y + height - lineThickness, lineWidth, lineThickness, m[0], m[2], lineWidth, lineThickness, g); // mb
drawImage(gui, x + cornerSize + (width - cornerSize * 2) / lineWidth * lineWidth, y + height - lineThickness, (width - cornerSize * 2) % lineWidth, lineThickness, m[0], m[2],
((width - cornerSize * 2) % lineWidth), lineThickness, g);
drawImage(gui, x + width - cornerSize, y + height - cornerSize, cornerSize, cornerSize, c[3], c[2], cornerSize, cornerSize, g); // rb
}