当前位置: 首页>>代码示例>>Java>>正文


Java Graphics.clear方法代码示例

本文整理汇总了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());
	}
}
 
开发者ID:packetpirate,项目名称:Generic-Zombie-Shooter-Redux,代码行数:26,代码来源:LoadingState.java

示例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);
        }
    }
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:10,代码来源:Credits.java

示例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);
}
 
开发者ID:packetpirate,项目名称:Generic-Zombie-Shooter-Redux,代码行数:14,代码来源:MenuState.java

示例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);
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:7,代码来源:GameOver.java

示例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);
}
 
开发者ID:packetpirate,项目名称:Generic-Zombie-Shooter-Redux,代码行数:50,代码来源:GameState.java


注:本文中的org.newdawn.slick.Graphics.clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。