本文整理汇总了Java中org.newdawn.slick.Graphics.clear方法的典型用法代码示例。如果您正苦于以下问题:Java Graphics.clear方法的具体用法?Java Graphics.clear怎么用?Java Graphics.clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.newdawn.slick.Graphics
的用法示例。
在下文中一共展示了Graphics.clear方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import org.newdawn.slick.Graphics; //导入方法依赖的package包/类
@Override
public void render(GameContainer gc, StateBasedGame game, Graphics g) throws SlickException {
g.resetTransform();
g.clear();
float lw = 400.0f;
float lh = 50.0f;
float lx = (Globals.WIDTH / 2) - (lw / 2);
float ly = (Globals.HEIGHT / 2) - (lh / 2);
float loadWidth = lw * percentLoaded;
g.setColor(new Color(0x808080));
g.fillRect(lx, ly, lw, lh);
g.setColor(new Color(0x9B2111));
g.fillRect(lx, ly, loadWidth, lh);
g.setColor(Color.white);
g.drawRect(lx, ly, lw, lh);
g.setColor(Color.white);
UnicodeFont uni = assets.getFont("PressStart2P-Regular_large");
if(uni != null) {
g.setFont(uni);
FontUtils.drawCenter(uni, "Loading...", ((Globals.WIDTH / 2) - 200), (int)(ly - uni.getLineHeight() - 10), (int)lw, g.getColor());
}
}
示例2: render
import org.newdawn.slick.Graphics; //导入方法依赖的package包/类
@Override
public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
g.clear();
for (CreditLine line : creditLines) {
if (line.start <= curTime && curTime <= line.end) {
g.drawString(line.text, line.x, line.y);
}
}
}
示例3: render
import org.newdawn.slick.Graphics; //导入方法依赖的package包/类
@Override
public void render(GameContainer gc, StateBasedGame game, Graphics g) throws SlickException {
Image background = assets.getImage("GZS_Background02");
g.resetTransform();
g.clear();
if(background != null) g.drawImage(background, 0.0f, 0.0f, Globals.WIDTH, Globals.HEIGHT, 0.0f, 0.0f, background.getWidth(), background.getHeight());
gameStart.render(g);
credits.render(g);
exit.render(g);
}
示例4: render
import org.newdawn.slick.Graphics; //导入方法依赖的package包/类
@Override
public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
g.clear();
g.drawString("GAME OVER", 10, 10);
g.drawString("Press ENTER to try again", 10, 50);
}
示例5: render
import org.newdawn.slick.Graphics; //导入方法依赖的package包/类
@Override
public void render(GameContainer gc, StateBasedGame game, Graphics g) throws SlickException {
Player player = Globals.player;
g.resetTransform();
g.clear();
Image background = assets.getImage("GZS_Background6");
g.drawImage(background, 0.0f, 0.0f, Globals.WIDTH, Globals.HEIGHT, 0.0f, 0.0f, background.getWidth(), background.getHeight());
player.render(g, time);
Iterator<Entry<String, Entity>> it = entities.entrySet().iterator();
while(it.hasNext()) {
Map.Entry<String, Entity> pair = (Map.Entry<String, Entity>) it.next();
pair.getValue().render(g, time);
}
/*
// Draw the "shadow layer".
g.clearAlphaMap();
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
g.setDrawMode(Graphics.MODE_ALPHA_MAP);
g.setColor(new Color(1.0f, 1.0f, 1.0f, 0.85f));
g.fillRect(0.0f, 0.0f, Globals.WIDTH, Globals.HEIGHT);
AssetManager.getManager().getImage("GZS_LightAlphaMap").drawCentered(Globals.player.getPosition().x, Globals.player.getPosition().y);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
g.setDrawMode(Graphics.MODE_ALPHA_BLEND);
g.setColor(Color.black);
g.fillRect(0.0f, 0.0f, Globals.WIDTH, Globals.HEIGHT);
g.setDrawMode(Graphics.MODE_NORMAL);*/
hud.render(g, player, time);
if(paused) {
g.setColor(Color.white);
int w = GameState.FONT_PAUSE.getWidth("Paused");
int h = GameState.FONT_PAUSE.getHeight();
FontUtils.drawCenter(GameState.FONT_PAUSE, "Paused",
((Globals.WIDTH / 2) - (w / 2)), ((Globals.HEIGHT / 2) - (h / 2)), w);
}
if(consoleOpen) console.render(g, time);
}