当前位置: 首页>>代码示例>>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;未经允许,请勿转载。