当前位置: 首页>>代码示例>>Java>>正文


Java Color类代码示例

本文整理汇总了Java中org.newdawn.slick.Color的典型用法代码示例。如果您正苦于以下问题:Java Color类的具体用法?Java Color怎么用?Java Color使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Color类属于org.newdawn.slick包,在下文中一共展示了Color类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: render

import org.newdawn.slick.Color; //导入依赖的package包/类
/**
 * @see org.newdawn.slick.Game#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
 */
public void render(GameContainer container, Graphics g) {
	g.setColor(Color.white);

	String text = "This is UnicodeFont!\nIt rockz. Kerning: T,";
	unicodeFont.drawString(10, 33, text);
	// unicodeFont.drawString(10, 33, text, Color.red, 8, 19);
	g.setColor(Color.red);
	g.drawRect(10, 33, unicodeFont.getWidth(text), unicodeFont.getLineHeight());
	g.setColor(Color.blue);
	int yOffset = unicodeFont.getYOffset(text);
	g.drawRect(10, 33 + yOffset, unicodeFont.getWidth(text), unicodeFont.getHeight(text) - yOffset);

	// font.drawString(10, 73, "\u6880\u6881\u6882 (...) \u6883\u6884\u6885\u6886\u6887 hi?");

	unicodeFont.addGlyphs("[email protected]!#!#$%___--");
	// Cypriot Syllabary glyphs (Everson Mono font): \uD802\uDC02\uD802\uDC03\uD802\uDC12 == 0x10802, 0x10803, s0x10812
	// g.drawLine(0, container.getHeight() - 512, container.getWidth(), container.getHeight() - 512);
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-C,代码行数:22,代码来源:UnicodeFontTest.java

示例2: render

import org.newdawn.slick.Color; //导入依赖的package包/类
/**
 * Game loop render
 */
public void render() {
	Color.white.bind();
	texture.bind(); // or GL11.glBind(texture.getTextureID());
	
	GL11.glBegin(GL11.GL_QUADS);
		GL11.glTexCoord2f(0,0);
		GL11.glVertex2f(100,100);
		GL11.glTexCoord2f(1,0);
		GL11.glVertex2f(100+texture.getTextureWidth(),100);
		GL11.glTexCoord2f(1,1);
		GL11.glVertex2f(100+texture.getTextureWidth(),100+texture.getTextureHeight());
		GL11.glTexCoord2f(0,1);
		GL11.glVertex2f(100,100+texture.getTextureHeight());
	GL11.glEnd();
	
	font.drawString(150, 300, "HELLO LWJGL WORLD", Color.yellow);
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-C,代码行数:21,代码来源:TestUtils.java

示例3: preRender

import org.newdawn.slick.Color; //导入依赖的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: init

import org.newdawn.slick.Color; //导入依赖的package包/类
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
	this.container = container;
	
	SpriteSheet sheet = new SpriteSheet("testdata/homeranim.png", 36, 65);
	animation = new Animation();
	for (int i=0;i<8;i++) {
		animation.addFrame(sheet.getSprite(i,0), 150);
	}
	limited = new Animation();
	for (int i=0;i<8;i++) {
		limited.addFrame(sheet.getSprite(i,0), 150);
	}
	limited.stopAt(7);
	manual = new Animation(false);
	for (int i=0;i<8;i++) {
		manual.addFrame(sheet.getSprite(i,0), 150);
	}
	pingPong = new Animation(sheet, 0,0,7,0,true,150,true);
	pingPong.setPingPong(true);
	container.getGraphics().setBackground(new Color(0.4f,0.6f,0.6f));
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-C,代码行数:25,代码来源:AnimationTest.java

示例5: fire

import org.newdawn.slick.Color; //导入依赖的package包/类
@Override
public void fire(Player player, Pair<Float> position, float theta, long cTime) {
	Color color = getProjectile().getColor();
	float velocity = getProjectile().getVelocity();
	float width = getProjectile().getWidth();
	float height = getProjectile().getHeight();
	long lifespan = getProjectile().getLifespan();
	Particle particle = new Particle(color, position, velocity, theta,
									 0.0f, new Pair<Float>(width, height), 
									 lifespan, cTime);
	Turret turret = new Turret(particle);
	projectiles.add(turret);
	
	ammoInClip--;
	lastFired = cTime;
	
	fireSound.play();
}
 
开发者ID:packetpirate,项目名称:Generic-Zombie-Shooter-Redux,代码行数:19,代码来源:SentryWeapon.java

示例6: drawInUse

import org.newdawn.slick.Color; //导入依赖的package包/类
public final void drawInUse(int DrawX, int DrawY, int DrawX2, int DrawY2,
		int SrcX, int SrcY, int SrcX2, int SrcY2)
{
	if (CurrentTexture > 0)
	{
		if (slickGame.g != null)
		{
			if (Blending == false)
			{
				slickResources.images[CurrentTexture].drawEmbedded(DrawX,
						DrawY, DrawX2, DrawY2, SrcX, SrcY, SrcX2, SrcY2,
						Color.white);
			}
			else
			{
				slickResources.images[CurrentTexture].drawEmbedded(DrawX,
						DrawY, DrawX2, DrawY2, SrcX, SrcY, SrcX2, SrcY2,
						slickGame.g.getColor());
			}
		}
	}
}
 
开发者ID:TheRemote,项目名称:Spark,代码行数:23,代码来源:SlickEngine.java

示例7: showPauseButton

import org.newdawn.slick.Color; //导入依赖的package包/类
/**
 * Draw Pause button
 * @param gc	GameContainer
 * @param g	Graphics
 * @throws SlickException
 */
public static void showPauseButton(GameContainer gc, Graphics g) throws SlickException {
	pauseButton.draw(pauseButtonPosX, pauseButtonPosY, pauseButtonWidth, pauseButtonHeight);

	if (Controller.mouseInArea(pauseButtonPosX, pauseButtonPosY, pauseButtonPosX + pauseButtonHeight,
								pauseButtonPosY + pauseButtonHeight)) {
		pauseButton.draw(pauseButtonPosX, pauseButtonPosY, pauseButtonWidth, pauseButtonHeight, new Color(0, 0, 0, 50));

		if (Mouse.getEventButtonState() && Mouse.getEventButton() == 0) {
			gc.setPaused(!gc.isPaused());
			try {
				TimeUnit.MILLISECONDS.sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
}
 
开发者ID:hungthuanmk,项目名称:HCMIU_PlantsAndZombies,代码行数:24,代码来源:PlayUI.java

示例8: renderGlyph

import org.newdawn.slick.Color; //导入依赖的package包/类
/**
 * Loads a single glyph to the backing texture, if it fits.
 * 
 * @param glyph The glyph to be rendered
 * @param width The expected width of the glyph
 * @param height The expected height of the glyph
 * @throws SlickException if the glyph could not be rendered.
 */
private void renderGlyph(Glyph glyph, int width, int height) throws SlickException {
	// Draw the glyph to the scratch image using Java2D.
	scratchGraphics.setComposite(AlphaComposite.Clear);
	scratchGraphics.fillRect(0, 0, MAX_GLYPH_SIZE, MAX_GLYPH_SIZE);
	scratchGraphics.setComposite(AlphaComposite.SrcOver);
	scratchGraphics.setColor(java.awt.Color.white);
	for (Iterator iter = unicodeFont.getEffects().iterator(); iter.hasNext();)
		((Effect)iter.next()).draw(scratchImage, scratchGraphics, unicodeFont, glyph);
	glyph.setShape(null); // The shape will never be needed again.

	WritableRaster raster = scratchImage.getRaster();
	int[] row = new int[width];
	for (int y = 0; y < height; y++) {
		raster.getDataElements(0, y, width, 1, row);
		scratchIntBuffer.put(row);
	}
	GL.glTexSubImage2D(SGL.GL_TEXTURE_2D, 0, pageX, pageY, width, height, SGL.GL_BGRA, SGL.GL_UNSIGNED_BYTE,
		scratchByteBuffer);
	scratchIntBuffer.clear();

	glyph.setImage(pageImage.getSubImage(pageX, pageY, width, height));
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:31,代码来源:GlyphPage.java

示例9: render

import org.newdawn.slick.Color; //导入依赖的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

示例10: update

import org.newdawn.slick.Color; //导入依赖的package包/类
@Override
public void update(GameContainer gc, StateBasedGame sbg, int i) throws SlickException {
    if (shouldToggleFullscreen) {
        shouldToggleFullscreen = false;
        boolean fs = !gc.isFullscreen();
        AppGameContainer agc = (AppGameContainer)gc;
        agc.setDisplayMode(fs ? agc.getScreenWidth() : Application.DISPLAY_WIDTH,
                           fs ? agc.getScreenHeight() : Application.DISPLAY_HEIGHT, fs);
    }
    if (gc.getInput().isKeyPressed(Input.KEY_ENTER)) {
        click.play(1.0f, CLICK_VOLUME);
        mainMenu.fade(1000, 0.0f, true);
        sbg.enterState(Application.GAME, new FadeOutTransition(Color.black, 1000), new EmptyTransition());
    }
    if (gc.getInput().isKeyPressed(Input.KEY_C)) {
        sbg.enterState(Application.CREDITS);
    }
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:19,代码来源:MainMenu.java

示例11: render

import org.newdawn.slick.Color; //导入依赖的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

示例12: render

import org.newdawn.slick.Color; //导入依赖的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

示例13: render

import org.newdawn.slick.Color; //导入依赖的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

示例14: render

import org.newdawn.slick.Color; //导入依赖的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

示例15: render

import org.newdawn.slick.Color; //导入依赖的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:j-dong,项目名称:trashjam2017,代码行数:19,代码来源:CurveTest.java


注:本文中的org.newdawn.slick.Color类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。