當前位置: 首頁>>代碼示例>>Java>>正文


Java Graphics.setLineWidth方法代碼示例

本文整理匯總了Java中org.newdawn.slick.Graphics.setLineWidth方法的典型用法代碼示例。如果您正苦於以下問題:Java Graphics.setLineWidth方法的具體用法?Java Graphics.setLineWidth怎麽用?Java Graphics.setLineWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.newdawn.slick.Graphics的用法示例。


在下文中一共展示了Graphics.setLineWidth方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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) {
	
	g.rotate(400, 300, ang);
	g.fill(rect, gradient);
	g.fill(round, gradient);
	g.fill(poly, gradient2);
	g.fill(center, gradient4);

	g.setAntiAlias(true);
	g.setLineWidth(10);
	g.draw(round2, gradient2);
	g.setLineWidth(2);
	g.draw(poly, gradient);
	g.setAntiAlias(false);
	
	g.fill(center, gradient4);
	g.setAntiAlias(true);
	g.setColor(Color.black);
	g.draw(center);
	g.setAntiAlias(false);
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:25,代碼來源:GradientTest.java

示例2: render

import org.newdawn.slick.Graphics; //導入方法依賴的package包/類
/**
	 * @see org.newdawn.slick.Game#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
	 */
	public void render(GameContainer container, Graphics g) throws SlickException {
		g.setAntiAlias(antialias);
		g.setLineWidth(50);
		g.setColor(Color.red);
		g.draw(path);
		
//		g.setColor(Color.red);
//		TextureImpl.bindNone();
//		g.setLineWidth(width);
//		g.setAntiAlias(true);
//		for (int i=0;i<10;i++) {
//			g.translate(35,35);
//			g.draw(polygon);
//		}
//		g.translate(-350,-350);
//		
//		g.setColor(Color.white);
//		g.setLineWidth(1);
//		g.setAntiAlias(false);
//		g.draw(polygon);
	}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:25,代碼來源:LineRenderTest.java

示例3: render

import org.newdawn.slick.Graphics; //導入方法依賴的package包/類
@Override
public void render(Graphics g, long cTime) {
	// Render all projectiles.
	projectiles.stream().filter(p -> p.isAlive(cTime)).forEach(p -> p.render(g, cTime));
	
	// Render the turret base.
	Image base = AssetManager.getManager().getImage(Turret.TURRET_IMAGE).getSubImage(0, 0, 48, 48);
	if(base != null) g.drawImage(base, (position.x - 24.0f), (position.y - 24.0f));
	
	// Render the sentry's laser sight.
	float facing = theta;
	float dist = ((target != null) && target.isAlive(cTime)) ? Math.min(Turret.FIRING_RANGE, Calculate.Distance(position, target.getPosition())) : Turret.FIRING_RANGE;
	g.setColor(Turret.TURRET_LASER);
	g.setLineWidth(2.0f);
	g.drawLine(position.x, position.y, 
			   (position.x + ((float)Math.cos(facing) * dist)), 
			   (position.y + ((float)Math.sin(facing) * dist)));
	g.setLineWidth(1.0f);
	
	// Render the rotated turret head.
	Image head = AssetManager.getManager().getImage(Turret.TURRET_IMAGE).getSubImage(48, 0, 48, 48);
	if(head != null) {
		g.rotate(position.x, position.y, (float)Math.toDegrees(theta + (float)(Math.PI / 2)));
		g.drawImage(head, (position.x - 24.0f), (position.y - 24.0f));
		g.resetTransform();
	}
}
 
開發者ID:packetpirate,項目名稱:Generic-Zombie-Shooter-Redux,代碼行數:28,代碼來源:Turret.java

示例4: render

import org.newdawn.slick.Graphics; //導入方法依賴的package包/類
@Override
public void render(Graphics g, long cTime) {
	super.render(g, cTime);
	
	// Render the barrier if this is the host node.
	if(host && (other != null)) {
		g.setColor(LaserNode.BARRIER_COLOR);
		g.setLineWidth(LaserNode.BARRIER_WIDTH);
		g.drawLine(position.x, position.y, 
				   other.getPosition().x, other.getPosition().y);
		g.setLineWidth(1.0f);
	}
}
 
開發者ID:packetpirate,項目名稱:Generic-Zombie-Shooter-Redux,代碼行數:14,代碼來源:LaserNode.java

示例5: 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.setLineWidth方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。