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


Java Graphics.fillRoundRect方法代码示例

本文整理汇总了Java中org.newdawn.slick.Graphics.fillRoundRect方法的典型用法代码示例。如果您正苦于以下问题:Java Graphics.fillRoundRect方法的具体用法?Java Graphics.fillRoundRect怎么用?Java Graphics.fillRoundRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.newdawn.slick.Graphics的用法示例。


在下文中一共展示了Graphics.fillRoundRect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showSunCollected

import org.newdawn.slick.Graphics; //导入方法依赖的package包/类
/**
 * Draw sun collected
 * @param gc	GameContainer
 * @param sbg	StateBasedGame
 * @param g	Graphics
 * @throws SlickException
 */
public static void showSunCollected(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
	float iconPosX = 10 * PZGUI.getResolutionRateWidth();
	float iconPosY = 5  * PZGUI.getResolutionRateHeight();
	float iconW = 80 * PZGUI.getResolutionRateWidth();
	float iconH = 80 * PZGUI.getResolutionRateHeight();

	float textPosX = 120 * PZGUI.getResolutionRateWidth();
	float textPosY = 22  * PZGUI.getResolutionRateHeight();

	float posX = 60 * PZGUI.getResolutionRateWidth();
	float posY = 20 * PZGUI.getResolutionRateHeight();
	float W = 150 * PZGUI.getResolutionRateWidth();
	float H = 45  * PZGUI.getResolutionRateHeight();

	g.setColor(new Color(0, 0, 0, 150));
	g.fillRoundRect(posX, posY, W, H, 20);
	SunUI.drawIcon(iconPosX, iconPosY, iconW, iconH);

	sunView.render(textPosX, textPosY, SunUI.getSunCollected().toString(), Color.white);
	g.setColor(new Color(255, 255, 255));
}
 
开发者ID:hungthuanmk,项目名称:HCMIU_PlantsAndZombies,代码行数:29,代码来源:PlayUI.java

示例2: render

import org.newdawn.slick.Graphics; //导入方法依赖的package包/类
/**
	 * Render Seeds area
	 * @param gc GameContainer
	 * @param sbg StateBasedGame
	 * @param g	Graphics
	 */
	public static void render(GameContainer gc, StateBasedGame sbg, Graphics g) {
		for (int i=0; i<seed.size() && i<8; i++) {
			if (seed.get(i) != null) {
				x = PlayUI.getSeedZonePosX();
				y = PlayUI.getSeedZonePosY();
				w = PlayUI.getSeedZoneW();
				h = PlayUI.getSeedZoneH();
				seed.get(i).getImg().draw(  x, y + i*h, w, h );
//				g.drawString(""+seed.get(i).getPrice(), x + w * 0.71f, y + i*h + h*0.7f);
				if (seed.get(i).getPrice() > SunUI.getSunCollected()) {
					g.setColor(new Color(1,1,1,100));
					g.fillRoundRect(x, y + i*h, w, h, 5);
				}	
			}
		}
		for (int i=0; i<seed.size() && i<8; i++) {
			if (seed.get(i) != null) {
				x = PlayUI.getSeedZonePosX();
				y = PlayUI.getSeedZonePosY();
				w = PlayUI.getSeedZoneW();
				h = PlayUI.getSeedZoneH();
				if (seed.get(i).getPrice() > SunUI.getSunCollected())
					cost.render(x + w * 0.594f, y + i*h + h*0.5f, (seed.get(i).getPrice()<100 ? "   " : "") + seed.get(i).getPrice().toString(), new Color(180, 180, 180));
				else
					cost.render(x + w * 0.594f, y + i*h + h*0.5f, (seed.get(i).getPrice()<100 ? "   " : "") + seed.get(i).getPrice().toString(), new Color(245, 245, 245));
					
			}
		}
	}
 
开发者ID:hungthuanmk,项目名称:HCMIU_PlantsAndZombies,代码行数:36,代码来源:SeedUI.java

示例3: render

import org.newdawn.slick.Graphics; //导入方法依赖的package包/类
/**
 * @see org.newdawn.slick.BasicGame#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
 */
public void render(GameContainer container, Graphics g) throws SlickException {
	g.setColor(Color.white);
	
	g.setAntiAlias(true);
	for (int x=0;x<360;x+=10) {
		g.drawLine(700,100,(int) (700+(Math.cos(Math.toRadians(x))*100)),
						   (int) (100+(Math.sin(Math.toRadians(x))*100)));
	}
	g.setAntiAlias(false);
	
	g.setColor(Color.yellow);
	g.drawString("The Graphics Test!", 300, 50);
	g.setColor(Color.white);
	g.drawString("Space - Toggles clipping", 400, 80);
	g.drawString("Frame rate capped to 100", 400, 120);
	
	if (clip) {
		g.setColor(Color.gray);
		g.drawRect(100,260,400,100);
		g.setClip(100,260,400,100);
	}

	g.setColor(Color.yellow);
	g.translate(100, 120);
	g.fill(poly);
	g.setColor(Color.blue);
	g.setLineWidth(3);
	g.draw(poly);
	g.setLineWidth(1);
	g.translate(0, 230);
	g.draw(poly);
	g.resetTransform();
	
	g.setColor(Color.magenta);
	g.drawRoundRect(10, 10, 100, 100, 10);
	g.fillRoundRect(10, 210, 100, 100, 10);
	
	g.rotate(400, 300, ang);
	g.setColor(Color.green);
	g.drawRect(200,200,200,200);
	g.setColor(Color.blue);
	g.fillRect(250,250,100,100);

	g.drawImage(image, 300,270);
	
	g.setColor(Color.red);
	g.drawOval(100,100,200,200);
	g.setColor(Color.red.darker());
	g.fillOval(300,300,150,100);
	g.setAntiAlias(true);
	g.setColor(Color.white);
	g.setLineWidth(5.0f);
	g.drawOval(300,300,150,100);
	g.setAntiAlias(true);
	g.resetTransform();
	
	if (clip) {
		g.clearClip();
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:64,代码来源:GraphicsTest.java


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