本文整理匯總了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);
}