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


Java Graphics類代碼示例

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


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

示例1: 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:IngSW-unipv,項目名稱:Progetto-C,代碼行數:25,代碼來源:LineRenderTest.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.setColor(Color.gray);
	drawMarker(g, p1);
	drawMarker(g, p2);
	g.setColor(Color.red);
	drawMarker(g, c1);
	drawMarker(g, c2);
	
	g.setColor(Color.black);
	g.draw(curve);
	g.fill(curve);
	
	g.draw(poly);
	g.fill(poly);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:19,代碼來源:CurveTest.java

示例3: 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 {
	prev.render(container, game, g);
	
	MaskUtil.defineMask();
	for (int i=0;i<blobs.size();i++) {
		((Blob) blobs.get(i)).render(g);
	}
	MaskUtil.finishDefineMask();

	MaskUtil.drawOnMask();
	if (background != null) {
		Color c = g.getColor();
		g.setColor(background);
		g.fillRect(0,0,container.getWidth(),container.getHeight());
		g.setColor(c);
	}
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:22,代碼來源:BlobbyTransition.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) {
       g.drawString("left shift down: "+lshift, 100, 240);
       g.drawString("right shift down: "+rshift, 100, 260);
       g.drawString("space down: "+space, 100, 280); 
       
	g.setColor(Color.white);
	g.drawString(message, 10, 50);
	g.drawString(""+container.getInput().getMouseY(), 10, 400);
	g.drawString("Use the primary gamepad to control the blob, and hit a gamepad button to change the color", 10, 90);

	for (int i=0;i<lines.size();i++) {
		Line line = (Line) lines.get(i);
		line.draw(g);
	}
	
	g.setColor(cols[index]);
	g.fillOval((int) x, (int) y, 50, 50);
	g.setColor(Color.yellow);
	g.fillRect(50,200+ypos,40,40);
}
 
開發者ID:IngSW-unipv,項目名稱:Progetto-C,代碼行數:24,代碼來源:InputTest.java

示例5: createGraphics

import org.newdawn.slick.Graphics; //導入依賴的package包/類
/** 
 * Create an underlying graphics context for the given image
 * 
 * @param image The image we want to render to
 * @return The graphics context created
 * @throws SlickException
 */
private static Graphics createGraphics(Image image) throws SlickException {
	init();
	
	if (fbo) {
		try {
			return new FBOGraphics(image);
		} catch (Exception e) {
			fbo = false;
			Log.warn("FBO failed in use, falling back to PBuffer");
		}
	}
	
	if (pbuffer) {
		if (pbufferRT) {
			return new PBufferGraphics(image);
		} else {
			return new PBufferUniqueGraphics(image);
		}
	}
	
	throw new SlickException("Failed to create offscreen buffer even though the card reports it's possible");
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:30,代碼來源:GraphicsFactory.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 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:j-dong,項目名稱:trashjam2017,代碼行數:20,代碼來源:TransformTest.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 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:IngSW-unipv,項目名稱:Progetto-C,代碼行數:24,代碼來源:TransformTest2.java

示例8: 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("The OGG loop is now streaming from the file, woot.",100,60);
	g.drawString("Press space for sound effect (OGG)",100,100);
	g.drawString("Press P to pause/resume music (XM)",100,130);
	g.drawString("Press E to pause/resume engine sound (WAV)",100,190);
	g.drawString("Press enter for charlie (WAV)",100,160);
	g.drawString("Press C to change music",100,210);
	g.drawString("Press B to burp (AIF)",100,240);
	g.drawString("Press + or - to change global volume of music", 100, 270);
	g.drawString("Press Y or X to change individual volume of music", 100, 300);
	g.drawString("Press N or M to change global volume of sound fx", 100, 330);
	g.setColor(Color.blue);
	g.drawString("Global Sound Volume Level: " + container.getSoundVolume(), 150, 390);
	g.drawString("Global Music Volume Level: " + container.getMusicVolume(), 150, 420);
	g.drawString("Current Music Volume Level: " + music.getVolume(), 150, 450);
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:21,代碼來源:SoundTest.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) {
	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:IngSW-unipv,項目名稱:Progetto-C,代碼行數:26,代碼來源:CanvasContainerTest.java

示例10: StateBasedGame

import org.newdawn.slick.Graphics; //導入依賴的package包/類
/**
 * Create a new state based game
 * 
 * @param name The name of the game
 */
public StateBasedGame(String name) {
	this.title = name;
	
	currentState = new BasicGameState() {
		public int getID() {
			return -1;
		}
		public void init(GameContainer container, StateBasedGame game) throws SlickException {
		}
		public void render(StateBasedGame game, Graphics g) throws SlickException {
		}
		public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException {
		}
		public void render(GameContainer container, StateBasedGame game, Graphics g) throws SlickException {
		}
	};
}
 
開發者ID:IngSW-unipv,項目名稱:Progetto-C,代碼行數:23,代碼來源:StateBasedGame.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.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:j-dong,項目名稱:trashjam2017,代碼行數:21,代碼來源:GradientImageTest.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) {
	this.g = g;
	
	image.draw(100,100);
	g.setColor(Color.white);
	g.drawString("Move mouse over test image", 200, 20);
	g.setColor(read[0]);
	g.drawString(read[0].toString(), 100,300);
	g.setColor(read[1]);
	g.drawString(read[1].toString(), 150,320);
	g.setColor(read[2]);
	g.drawString(read[2].toString(), 200,340);
	g.setColor(read[3]);
	g.drawString(read[3].toString(), 250,360);
	if (read[4] != null) {
		g.setColor(read[4]);
		g.drawString("On image: "+read[4].toString(), 100,250);
	}
	if (read[5] != null) {
		g.setColor(Color.white);
		g.drawString("On screen: "+read[5].toString(), 100,270);
	}
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:27,代碼來源:ImageReadTest.java

示例13: 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:IngSW-unipv,項目名稱:Progetto-C,代碼行數:19,代碼來源:SelectTransition.java

示例14: 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:IngSW-unipv,項目名稱:Progetto-C,代碼行數:28,代碼來源:InkscapeTest.java

示例15: 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.green);
    
    for(int i=0;i<shapes.size();i++) {
        g.fill((Shape)shapes.get(i));
    }
    g.fill(randomShape);
    g.setColor(Color.black);
    g.setAntiAlias(true);
    g.draw(randomShape);
    g.setAntiAlias(false);
    
    g.setColor(Color.white);
    g.drawString("keys", 10, 300);
    g.drawString("wasd - move rectangle", 10, 315);
    g.drawString("WASD - resize rectangle", 10, 330);
    g.drawString("tgfh - move rounded rectangle", 10, 345);
    g.drawString("TGFH - resize rounded rectangle", 10, 360);
    g.drawString("ry - resize corner radius on rounded rectangle", 10, 375);
    g.drawString("ikjl - move ellipse", 10, 390);
    g.drawString("IKJL - resize ellipse", 10, 405);
    g.drawString("Arrows - move circle", 10, 420);
    g.drawString("Page Up/Page Down - resize circle", 10, 435);
    g.drawString("numpad 8546 - move polygon", 10, 450);
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:29,代碼來源:ShapeTest.java


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