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


Java Graphics.resetTransform方法代碼示例

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


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

示例1: preRender

import org.newdawn.slick.Graphics; //導入方法依賴的package包/類
/**
 * @see org.newdawn.slick.state.transition.Transition#preRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
 */
public void preRender(StateBasedGame game, GameContainer container,
		Graphics g) throws SlickException {
	if (moveBackDone) {
		g.translate(xp1,yp1);
		g.scale(scale1, scale1);
		g.setClip((int) xp1,(int) yp1,(int) (scale1*container.getWidth()),(int) (scale1*container.getHeight()));
		prev.render(container, game, g);
		g.resetTransform();
		g.clearClip();
	}
	
	g.translate(xp2,yp2);
	g.scale(scale2, scale2);
	g.setClip((int) xp2,(int) yp2,(int) (scale2*container.getWidth()),(int) (scale2*container.getHeight()));
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:19,代碼來源:SelectTransition.java

示例2: 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

示例3: 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.scale(zoom,zoom);
		g.translate(x, y);
		g.scale(0.3f,0.3f);
		//renderer[0].render(g);
		g.scale(1/0.3f,1/0.3f);
		g.translate(400, 0);
		//renderer[1].render(g);
		g.translate(100, 300);
		g.scale(0.7f,0.7f);
		//renderer[2].render(g);
		g.scale(1/0.7f,1/0.7f);
		
		g.scale(0.5f,0.5f);
		g.translate(-1100, -380);
		renderer[3].render(g);
		g.scale(1/0.5f,1/0.5f);
		
//		g.translate(280, 100);
//		g.scale(0.5f,0.5f);
//		renderer[4].render(g);
		
		g.resetTransform();
	}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:28,代碼來源:InkscapeTest.java

示例4: 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.scale(2,2);
	g.fillRect(0, 0, 800, 600, back, 0, 0);
	g.resetTransform();
	
	g.drawImage(image,100,100);
	image.draw(100,200,80,200);
	
	font.drawString(100,200,"Text Drawn before the callable");
	
	SlickCallable callable = new SlickCallable() {
		protected void performGLOperations() throws SlickException {
			renderGL();
		}
	};
	callable.call();
	
	homer.draw(450,250,80,200);
	font.drawString(150,300,"Text Drawn after the callable");
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:24,代碼來源:SlickCallableTest.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) {
	g.drawString("R - Toggle Rotationg",10,50);
	g.drawImage(image1, 100, 236);
	g.drawImage(image2, 600, 236);
	
	g.translate(0, -150);
	g.rotate(400, 300, ang);
	g.texture(shape, image2);
	g.texture(shape, image1, fill);
	g.resetTransform();
	
	g.translate(0, 150);
	g.rotate(400, 300, ang);
	g.texture(poly, image2);
	g.texture(poly, image1, fill);
	g.resetTransform();
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:21,代碼來源:GradientImageTest.java

示例6: 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) {
	for (int i=0;i<100;i++) {
		g.translate(1,1);
		system.render();
	}
	g.resetTransform();
	g.drawString("Press space to toggle blending mode", 200, 500);
	g.drawString("Particle Count: "+(system.getParticleCount()*100), 200, 520);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:13,代碼來源:ParticleTest.java

示例7: render

import org.newdawn.slick.Graphics; //導入方法依賴的package包/類
/**
 * Render the current frame of the animation.
 * @param g The graphics context used for drawing.
 * @param position The position to render the animation at.
 * @param size The size to override the size of the image with.
 */
public void render(Graphics g, Pair<Float> position, Pair<Float> size) {
	Image image = getImage();
	if(image != null) {
		float tlx = position.x - (size.x / 2);
		float tly = position.y - (size.y / 2);
		g.drawImage(image, 
					tlx, tly, (tlx + size.x), (tly + size.y), 
					srcPos.x, srcPos.y, (srcPos.x + srcSize.x), (srcPos.y + srcSize.y));
		g.resetTransform();
	}
}
 
開發者ID:packetpirate,項目名稱:Generic-Zombie-Shooter-Redux,代碼行數:18,代碼來源:Animation.java

示例8: 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 {
	String text = "abc";
	font.drawString(610,100,text);
	
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glEnable(GL11.GL_ALPHA_TEST);
	GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.5f);
	font.drawString(610,150,text);
	GL11.glDisable(GL11.GL_ALPHA_TEST);
	GL11.glEnable(GL11.GL_BLEND);
	
	g.translate(-50,-130);
	g.scale(10,10);
	font.drawString(0,0,text);

	GL11.glDisable(GL11.GL_BLEND);
	GL11.glEnable(GL11.GL_ALPHA_TEST);
	GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.5f);
	font.drawString(0,26,text);
	GL11.glDisable(GL11.GL_ALPHA_TEST);
	GL11.glEnable(GL11.GL_BLEND);
	
	g.resetTransform();
	g.setColor(Color.lightGray);
	g.drawString("Original Size on Sheet", 620, 210);
	g.drawString("10x Scale Up", 40, 575);
	
	g.setColor(Color.darkGray);
	g.drawRect(40, 40, 560,530);
	g.drawRect(610, 105, 150,100);

	g.setColor(Color.white);
	g.drawString("512x512 Font Sheet", 620, 300);
	g.drawString("NEHE Charset", 620, 320);
	g.drawString("4096x4096 (8x) Source Image", 620, 340);
	g.drawString("ScanSize = 20", 620, 360);
}
 
開發者ID:IngSW-unipv,項目名稱:Progetto-C,代碼行數:42,代碼來源:DistanceFieldTest.java

示例9: 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) {
	rocket.draw((int) r,100);
	runner.draw(250,250);
	g.scale(1.2f,1.2f);
	runner.draw(250,250);
	g.scale(1.2f,1.2f);
	runner.draw(250,250);
	g.resetTransform();
	
	g.rotate(670, 470, ang);
	sheet.getSprite("floppy").draw(600,400);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:16,代碼來源:PackedSheetTest.java

示例10: 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) {
	map.render(10, 10, 4,4,15,15);
	
	g.scale(0.35f,0.35f);
	map.render(1400, 0);
	g.resetTransform();
	
	g.drawString("map name: " + mapName, 10, 500);
	g.drawString("monster difficulty: " + monsterDifficulty, 10, 550);
	
	g.drawString("non existing map property: " + nonExistingMapProperty, 10, 525);
	g.drawString("non existing layer property: " + nonExistingLayerProperty, 10, 575);
}
 
開發者ID:IngSW-unipv,項目名稱:Progetto-C,代碼行數:17,代碼來源:TileMapTest.java

示例11: 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.drawRect(0,0,image.getWidth(),image.getHeight());
	image.draw(0,0);
	image.draw(500,0,200,100);
	scaleMe.draw(500,100,200,100);
	scaled.draw(400,500);
	Image flipped = scaled.getFlippedCopy(true, false);
	flipped.draw(520,500);
	Image flipped2 = flipped.getFlippedCopy(false, true);
	flipped2.draw(520,380);
	Image flipped3 = flipped2.getFlippedCopy(true, false);
	flipped3.draw(400,380);
	
	for (int i=0;i<3;i++) {
		subImage.draw(200+(i*30),300);
	}
	
	g.translate(500, 200);
	g.rotate(50, 50, rot);
	g.scale(0.3f,0.3f);
	image.draw();
	g.resetTransform();
       
       rotImage.setRotation(rot);
       rotImage.draw(100, 200);
}
 
開發者ID:IngSW-unipv,項目名稱:Progetto-C,代碼行數:30,代碼來源:ImageTest.java

示例12: 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

示例13: 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

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