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


Java Graphics.scale方法代碼示例

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


在下文中一共展示了Graphics.scale方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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:j-dong,項目名稱:trashjam2017,代碼行數:19,代碼來源:SelectTransition.java

示例2: 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 contiainer, Graphics g) {
	g.translate(320,240);
	g.scale(scale, scale);

	g.setColor(Color.red);
	for (int x=0;x<10;x++) {
		for (int y=0;y<10;y++) {
			g.fillRect(-500+(x*100), -500+(y*100), 80, 80);
		}
	}
	
	g.setColor(new Color(1,1,1,0.5f));
	g.fillRect(-320,-240,640,480);
	g.setColor(Color.white);
	g.drawRect(-320,-240,640,480);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:20,代碼來源:TransformTest.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:SkidJava,項目名稱:BaseClient,代碼行數: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 contiainer, Graphics g) {
   g.translate(320,240);
   
   g.translate( -camX * scale, -camY * scale);
   
         
   g.scale(scale, scale);

   g.setColor(Color.red);
   for (int x=0;x<10;x++) {
      for (int y=0;y<10;y++) {
         g.fillRect(-500+(x*100), -500+(y*100), 80, 80);
      }
   }
   
   g.setColor(new Color(1,1,1,0.5f));
   g.fillRect(-320,-240,640,480);
   g.setColor(Color.white);
   g.drawRect(-320,-240,640,480);
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:24,代碼來源:TransformTest2.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.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:SkidJava,項目名稱:BaseClient,代碼行數:24,代碼來源:SlickCallableTest.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) {
	g.drawString("Space to restart() animation", 100, 50);
	g.drawString("Til Limited animation: "+start, 100, 500);
	g.drawString("Hold 1 to move the manually animated", 100, 70);
	g.drawString("PingPong Frame:"+pingPong.getFrame(), 600, 70);
	
	g.scale(-1,1);
	animation.draw(-100,100);
	animation.draw(-200,100,36*4,65*4);
	if (start < 0) {
		limited.draw(-400,100,36*4,65*4);
	}
	manual.draw(-600,100,36*4,65*4);
	pingPong.draw(-700,100,36*2,65*2);
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:19,代碼來源:AnimationTest.java

示例7: 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) {
	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();
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:26,代碼來源:CanvasContainerTest.java

示例8: postRender

import org.newdawn.slick.Graphics; //導入方法依賴的package包/類
/**
 * @see org.newdawn.slick.state.transition.Transition#postRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
 */
public void postRender(StateBasedGame game, GameContainer container, Graphics g) throws SlickException {
	g.resetTransform();
	
	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();
	}
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:16,代碼來源:SelectTransition.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:j-dong,項目名稱:trashjam2017,代碼行數: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:j-dong,項目名稱:trashjam2017,代碼行數:17,代碼來源:TileMapTest.java

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

示例12: 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.setColor(Color.white);
	g.drawString("Red indicates a collision, green indicates no collision", 50, 420);
       g.drawString("White are the targets", 50, 435);

       g.pushTransform();
       g.translate(100,100);
       g.pushTransform();
       g.translate(-50,-50);
       g.scale(10, 10);
       g.setColor(Color.red);
       g.fillRect(0,0,5,5);
       g.setColor(Color.white);
       g.drawRect(0,0,5,5);
       g.popTransform();
       g.setColor(Color.green);
       g.fillRect(20,20,50,50);
       g.popTransform();
       
	g.setColor(Color.white);
	g.draw(rect);
	g.draw(circle);
	
	g.setColor(rect1.intersects(rect) ? Color.red : Color.green);
	g.draw(rect1);
	g.setColor(rect2.intersects(rect) ? Color.red : Color.green);
	g.draw(rect2);
       g.setColor(roundRect.intersects(rect) ? Color.red : Color.green);
       g.draw(roundRect);
	g.setColor(circle1.intersects(rect) ? Color.red : Color.green);
	g.draw(circle1);
	g.setColor(circle2.intersects(rect) ? Color.red : Color.green);
	g.draw(circle2);
	g.setColor(circle3.intersects(circle) ? Color.red : Color.green);
	g.fill(circle3);
	g.setColor(circle4.intersects(circle) ? Color.red : Color.green);
	g.draw(circle4);

       g.fill(roundRect2);
	g.setColor(Color.blue);
       g.draw(roundRect2);
	g.setColor(Color.blue);
	g.draw(new Circle(100,100,50));
	g.drawRect(50,50,100,100);
       
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:50,代碼來源:GeomTest.java


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