org.newdawn.slick.Color Java Examples

The following examples show how to use org.newdawn.slick.Color. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImageBufferEndianTest.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void init(GameContainer container) throws SlickException {
   // detect what endian we have
   if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) {
          endian = "Big endian";
       } else if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) {
          endian = "Little endian";
       } else
          endian = "no idea";
   
   redImageBuffer = new ImageBuffer(100,100);
   fillImageBufferWithColor(redImageBuffer, Color.red, 100, 100);
   
   blueImageBuffer = new ImageBuffer(100,100);
   fillImageBufferWithColor(blueImageBuffer, Color.blue, 100, 100);
   
   fromRed = redImageBuffer.getImage();
   fromBlue = blueImageBuffer.getImage();
}
 
Example #2
Source File: GradientTest.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * @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);
}
 
Example #3
Source File: BlobbyTransition.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * @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);
	}
}
 
Example #4
Source File: UI.java    From opsu with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Draws a tab image and text centered at a location.
 * @param x the center x coordinate
 * @param y the center y coordinate
 * @param text the text to draw inside the tab
 * @param selected whether the tab is selected (white) or not (red)
 * @param isHover whether to include a hover effect (unselected only)
 */
public static void drawTab(float x, float y, String text, boolean selected, boolean isHover) {
	Image tabImage = GameImage.MENU_TAB.getImage();
	float tabTextX = x - (Fonts.MEDIUM.getWidth(text) / 2);
	float tabTextY = y - (tabImage.getHeight() / 2);
	Color filter, textColor;
	if (selected) {
		filter = Color.white;
		textColor = Color.black;
	} else {
		filter = (isHover) ? Colors.RED_HOVER : Color.red;
		textColor = Color.white;
	}
	tabImage.drawCentered(x, y, filter);
	Fonts.MEDIUM.drawString(tabTextX, tabTextY, text, textColor);
}
 
Example #5
Source File: RendererSlick.java    From nullpomino with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public static Color getMeterColorAsColor(int meterColor) {
	switch(meterColor) {
	case GameEngine.METER_COLOR_PINK:		return new Color(255,  0,255);
	case GameEngine.METER_COLOR_PURPLE:		return new Color(128,  0,255);
	case GameEngine.METER_COLOR_DARKBLUE:	return new Color(  0,  0,128);
	case GameEngine.METER_COLOR_BLUE:		return Color.blue;
	case GameEngine.METER_COLOR_CYAN:		return Color.cyan;
	case GameEngine.METER_COLOR_DARKGREEN:	return new Color(  0,128,  0);
	case GameEngine.METER_COLOR_GREEN:		return Color.green;
	case GameEngine.METER_COLOR_YELLOW:		return Color.yellow;
	case GameEngine.METER_COLOR_ORANGE:		return Color.orange;
	case GameEngine.METER_COLOR_RED:		return Color.red;
	}
	
	return Color.white;
}
 
Example #6
Source File: Curve.java    From opsu-dance with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Draws the curve in the range [0, t] (where the full range is [0, 1]) to the graphics context.
 * @param color the color filter
 * @param from index to draw from
 * @param to index to draw to (exclusive)
 */
public void draw(Color color, int from, int to) {
	if (curve == null)
		return;

	if (OPTION_FALLBACK_SLIDERS.state || SkinService.skin.getSliderStyle() == Skin.STYLE_PEPPYSLIDER || !mmsliderSupported) {
		// peppysliders
		Image hitCircle = GameImage.HITCIRCLE.getImage();
		Image hitCircleOverlay = GameImage.HITCIRCLE_OVERLAY.getImage();
		for (int i = from; i < to; i++)
			hitCircleOverlay.drawCentered(curve[i].x, curve[i].y, Colors.WHITE_FADE);
		float a = fallbackSliderColor.a;
		fallbackSliderColor.a = color.a;
		for (int i = from; i < to; i++)
			hitCircle.drawCentered(curve[i].x, curve[i].y, fallbackSliderColor);
		fallbackSliderColor.a = a;
	} else {
		// mmsliders
		if (renderState == null)
			renderState = new CurveRenderState(hitObject, curve, false);
		renderState.draw(color, borderColor, from, to);
	}
}
 
Example #7
Source File: Grid.java    From FEMultiPlayer-V2 with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Can seize.
 *
 * @param u the u
 * @return true, if successful
 */
public boolean canSeize(Unit u) {
	//check if lord
	if(!u.getTheClass().name.equals("Lord"))
		return false;
	Color c = u.getPartyColor();
	if(c.equals(Party.TEAM_BLUE) 
			&& u.getXCoord() == redThroneX
			&& u.getYCoord() == redThroneY) {
		return true;
	} else if (c.equals(Party.TEAM_RED)
			&& u.getXCoord() == blueThroneX
			&& u.getYCoord() == blueThroneY){
		return true;
	}
	return false;
}
 
Example #8
Source File: TestState1.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * @see org.newdawn.slick.state.BasicGameState#keyReleased(int, char)
 */
public void keyReleased(int key, char c) {
	
	if (key == Input.KEY_2) {
		GameState target = game.getState(TestState2.ID);
		
		final long start = System.currentTimeMillis();
		CrossStateTransition t = new CrossStateTransition(target) {				
			public boolean isComplete() {
				return (System.currentTimeMillis() - start) > 2000;
			}

			public void init(GameState firstState, GameState secondState) {
			}
		};
		
		game.enterState(TestState2.ID, t, new EmptyTransition());
	}
	if (key == Input.KEY_3) {
		game.enterState(TestState3.ID, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
	}
}
 
Example #9
Source File: Beatmap.java    From opsu with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns the {@link #combo} field formatted as a string,
 * or null if the field is null or the default combo.
 */
public String comboToString() {
	if (combo == null)
		return null;

	StringBuilder sb = new StringBuilder();
	for (int i = 0; i < combo.length; i++) {
		Color c = combo[i];
		sb.append(c.getRed());
		sb.append(',');
		sb.append(c.getGreen());
		sb.append(',');
		sb.append(c.getBlue());
		sb.append('|');
	}
	if (sb.length() > 0)
		sb.setLength(sb.length() - 1);
	return sb.toString();
}
 
Example #10
Source File: OverworldFightTransition.java    From FEMultiplayer with GNU General Public License v3.0 6 votes vote down vote up
public void render() {
	float delta = Game.getDeltaSeconds();
	// Render fight stage (with transparency)
	Renderer.drawRectangle(0, 0, Game.getWindowWidth(), Game.getWindowHeight(), 0.0f, 
			new Color(0.0f, 0.0f, 0.0f, Math.min(1.0f, timer*5)));
	Renderer.setColor(new Color(1f, 1f, 1f, fightAlpha));
	if(timer > 0.4) fightAlpha += 6*delta;
	to.render();
	Renderer.setColor(null);
	// Render terrain zoom thing
	Color triColor = new Color(1.0f, 1.0f, 1.0f, triAlpha);
	for(int i=0; i<3; i++) {
		Renderer.drawTriangle(x[0], y[0], x[i], y[i], x[i+1], y[i+1], 0.0f, triColor);
		Renderer.drawTriangle(x[4], y[4], x[i+4], y[i+4], x[i+5], y[i+5], 0.0f, triColor);
	}
	if(timer > 0.3333) {
		triAlpha -= 3*delta;
	} else {
		for(int i=0; i<8; i++) {
			x[i] += dx[i]*delta;
			y[i] += dy[i]*delta;
		}
	}
	timer += delta;
	if(timer > LENGTH) done();
}
 
Example #11
Source File: Renderer.java    From FEMultiplayer with GNU General Public License v3.0 6 votes vote down vote up
public static void drawRectangle(float x0, float y0, float x1, float y1,
		float depth, Color c0, Color c1, Color c2, Color c3) {
	glDisable(GL_TEXTURE_2D);
	glBegin(GL_QUADS);
	c0 = c0.multiply(color);
	c1 = c1.multiply(color);
	c2 = c2.multiply(color);
	c3 = c3.multiply(color);
	glColor4f(c0.r, c0.g, c0.b, c0.a);
	glVertex3f(x0, y0, depth);
	glColor4f(c1.r, c1.g, c1.b, c1.a);
	glVertex3f(x1, y0, depth);
	glColor4f(c2.r, c2.g, c2.b, c2.a);
	glVertex3f(x1, y1, depth);
	glColor4f(c3.r, c3.g, c3.b, c3.a);
	glVertex3f(x0, y1, depth);
	glEnd();
	glEnable(GL_TEXTURE_2D);
	if(clip != null && !clip.persistent) clip.destroy();
}
 
Example #12
Source File: RotateTransition.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * @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.translate(container.getWidth()/2, container.getHeight()/2);
	g.scale(scale,scale);
	g.rotate(0, 0, ang);
	g.translate(-container.getWidth()/2, -container.getHeight()/2);
	if (background != null) {
		Color c = g.getColor();
		g.setColor(background);
		g.fillRect(0,0,container.getWidth(),container.getHeight());
		g.setColor(c);
	}
	prev.render(container, game, g);
	g.translate(container.getWidth()/2, container.getHeight()/2);
	g.rotate(0, 0, -ang);
	g.scale(1/scale,1/scale);
	g.translate(-container.getWidth()/2, -container.getHeight()/2);
}
 
Example #13
Source File: TestUtils.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * 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);
}
 
Example #14
Source File: CursorColorManager.java    From opsu-dance with GNU General Public License v3.0 6 votes vote down vote up
public static void setComboColors(Color[] colors)
{
	if (colors.length == 0) {
		comboCols = new Color[] { Color.white };
		comboColors = new int[] { -1 };
	} else {
		comboCols = colors;
		comboColors = new int[colors.length];
		int i = colors.length;
		do {
			--i;
			comboColors[i] = col(colors[i]);
		} while (i > 0);
	}

	for (CursorColor impl : impls) {
		impl.onComboColorsChanged();
	}
}
 
Example #15
Source File: ButtonMenu.java    From opsu with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void draw(GameContainer container, StateBasedGame game, Graphics g) {
	int width = container.getWidth();
	int height = container.getHeight();

	// score multiplier (TODO: fade in color changes)
	float mult = GameMod.getScoreMultiplier();
	String multString = String.format("Score Multiplier: %.2fx", mult);
	Color multColor = (mult == 1f) ? Color.white : (mult > 1f) ? Color.green : Color.red;
	float multY = Fonts.LARGE.getLineHeight() * 2 + height * 0.06f;
	Fonts.LARGE.drawString(
			(width - Fonts.LARGE.getWidth(multString)) / 2f,
			multY, multString, multColor);

	// category text
	for (GameMod.Category category : GameMod.Category.values()) {
		Fonts.LARGE.drawString(category.getX(),
				category.getY() - Fonts.LARGE.getLineHeight() / 2f,
				category.getName(), category.getColor());
	}

	// buttons
	for (GameMod mod : GameMod.values())
		mod.draw();

	super.draw(container, game, g);
}
 
Example #16
Source File: GameData.java    From opsu-dance with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Handles a slider start result (animation only: initial circle).
 * @param time the hit time
 * @param x the x coordinate
 * @param y the y coordinate
 * @param color the slider color
 * @param expand whether or not the hit result animation should expand
 */
public void sendSliderStartResult(int time, float x, float y, Color color, Color mirrorColor, boolean expand) {
	hitResultList.add(new HitObjectResult(time, HIT_ANIMATION_RESULT, x, y, color, HitObjectType.CIRCLE, null, expand, true));
	if (!OPTION_DANCE_MIRROR.state) {
		return;
	}
	float[] m = Utils.mirrorPoint(x, y);
	hitResultList.add(new HitObjectResult(time, HIT_ANIMATION_RESULT, m[0], m[1], mirrorColor, HitObjectType.CIRCLE, null, expand, true));
}
 
Example #17
Source File: FEMultiplayer.java    From FEMultiplayer with GNU General Public License v3.0 5 votes vote down vote up
public static void connect(String nickname, String ip) {
	getLocalPlayer().setName(nickname);
	client = new Client(ip, 21255);
	if(client.isOpen()) {
		lobby = new ClientLobbyStage(client.getSession());
		setCurrentStage(lobby);
		client.start();
	} else {
		currentStage.addEntity(new Notification(
				180, 120, "default_med", "ERROR: Could not connect to the server!", 5f, new Color(255, 100, 100), 0f));
	}
}
 
Example #18
Source File: ObjectiveInfo.java    From FEMultiplayer with GNU General Public License v3.0 5 votes vote down vote up
public void render(){
	OverworldStage s = ((OverworldStage) stage);
	String objective = s.getObjective().getDescription();
	String turn = "Turn " + s.getTurnCount();
	Renderer.drawBorderedRectangle(x, y, x+ WIDTH, y + HEIGHT, renderDepth,
			FightStage.NEUTRAL, FightStage.BORDER_LIGHT, FightStage.BORDER_DARK);
	Renderer.drawString("default_med", objective, x+4, y+4, renderDepth);
	Renderer.drawString("default_med", turn, x+4, y+20, renderDepth);
	float ystart = y + 36;
	for(Player p: s.getTurnOrder()){
		Transform t = new Transform();
		Color c = p.getParty().getColor().brighter();
		c.r = Math.max(c.r, 0.5f);
		c.g = Math.max(c.g, 0.5f);
		c.b = Math.max(c.b, 0.5f);
		t.setColor(c);
		Renderer.drawString("default_med", p.getName(), x + 8, ystart, renderDepth, t);
		int unitCount = 0;
		for(Unit u: p.getParty()){
			if(u.getHp() > 0) unitCount++;
		}
		String units = unitCount + "";
		int unitsWidth = FEResources.getBitmapFont("default_med").getStringWidth(units);
		Renderer.drawString("default_med", units, 
				x + WIDTH - unitsWidth - 8, ystart, renderDepth, t);
		ystart += 16;
	}
}
 
Example #19
Source File: CurveRenderState.java    From opsu-dance with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Do the actual drawing of the curve into the currently bound framebuffer.
 * @param color the color of the curve
 * @param borderColor the curve border color
 */
private void renderCurve(Color color, Color borderColor, int from, int to, boolean clearFirst) {
	staticState.initGradient();
	RenderState state = saveRenderState();
	staticState.initShaderProgram();
	GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, fbo.getVbo());
	GL20.glUseProgram(staticState.program);
	GL20.glEnableVertexAttribArray(staticState.attribLoc);
	GL20.glEnableVertexAttribArray(staticState.texCoordLoc);
	GL20.glUniform1i(staticState.texLoc, 0);
	GL20.glUniform3f(staticState.colLoc, color.r, color.g, color.b);
	GL20.glUniform4f(staticState.colBorderLoc, borderColor.r, borderColor.g, borderColor.b, borderColor.a);
	//stride is 6*4 for the floats (4 bytes) (u,v)(x,y,z,w)
	//2*4 is for skipping the first 2 floats (u,v)
	GL20.glVertexAttribPointer(staticState.attribLoc, 4, GL11.GL_FLOAT, false, 6 * 4, 2 * 4);
	GL20.glVertexAttribPointer(staticState.texCoordLoc, 2, GL11.GL_FLOAT, false, 6 * 4, 0);
	if (clearFirst) {
		GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
	}
	final int mirrors = OPTION_DANCE_MIRROR.state ? this.mirrors : 1;
	for (int i = 0; i < mirrors; i++) {
		if (pointsToRender == null) {
			renderCurve(from, to, i);
		} else {
			renderCurve(i);
		}
		//from++;
		//to++;
	}
	GL11.glFlush();
	GL20.glDisableVertexAttribArray(staticState.texCoordLoc);
	GL20.glDisableVertexAttribArray(staticState.attribLoc);
	restoreRenderState(state);
}
 
Example #20
Source File: CurveRenderState.java    From opsu-dance with GNU General Public License v3.0 5 votes vote down vote up
public void draw(Color color, Color borderColor, List<Integer> pointsToRender) {
	lastPointDrawn = -1;
	firstPointDrawn = -1;
	this.pointsToRender = pointsToRender;
	draw(color, borderColor, 0, curve.length);
	this.pointsToRender = null;
}
 
Example #21
Source File: Slider.java    From opsu with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Constructor.
 * @param hitObject the associated HitObject
 * @param game the associated Game object
 * @param data the associated GameData object
 * @param color the color of this slider
 * @param comboEnd true if this is the last hit object in the combo
 */
public Slider(HitObject hitObject, Game game, GameData data, Color color, boolean comboEnd) {
	this.hitObject = hitObject;
	this.game = game;
	this.data = data;
	this.color = color;
	this.comboEnd = comboEnd;
	updatePosition();

	// slider time calculations
	this.sliderTime = hitObject.getSliderTime(sliderMultiplier, game.getBeatLength());
	this.sliderTimeTotal = sliderTime * hitObject.getRepeatCount();

	// ticks
	float tickLengthDiv = 100f * sliderMultiplier / sliderTickRate / game.getTimingPointMultiplier();
	int tickCount = (int) Math.ceil(hitObject.getPixelLength() / tickLengthDiv) - 1;
	if (tickCount > 0) {
		this.ticksT = new float[tickCount];
		float tickTOffset = 1f / (tickCount + 1);
		float t = tickTOffset;
		for (int i = 0; i < tickCount; i++, t += tickTOffset)
			ticksT[i] = t;
	}

	// follow circle animations
	tickExpand.setTime(tickExpand.getDuration());
	initialExpand.setTime(initialExpand.getDuration());
	releaseExpand.setTime(releaseExpand.getDuration());
}
 
Example #22
Source File: Button.java    From FEMultiplayer with GNU General Public License v3.0 5 votes vote down vote up
public void render(){
	int stringWidth = FEResources.getBitmapFont("default_med").getStringWidth(text);
	Color c = new Color(color);
	if(!hover)
		c = c.darker();
	Renderer.drawBorderedRectangle(x, y, x+width, y+20, renderDepth, c, FightStage.BORDER_LIGHT, FightStage.BORDER_DARK);
	Renderer.drawString("default_med", text, x+width/2-stringWidth/2, y + 4, renderDepth);
	
}
 
Example #23
Source File: Renderer.java    From FEMultiplayer with GNU General Public License v3.0 5 votes vote down vote up
public static void drawTriangle(float x0, float y0, float x, float y,
		float x2, float y2, float depth, Color c) {
	c.bind();
	glDisable(GL_TEXTURE_2D);
	c = c.multiply(color);
	glColor4f(c.r, c.g, c.b, c.a);
	glBegin(GL_TRIANGLES);
	glVertex3f(x0, y0, depth);
	glVertex3f(x, y, depth);
	glVertex3f(x2, y2, depth);
	glEnd();
	glEnable(GL_TEXTURE_2D);
	if(clip != null && !clip.persistent) clip.destroy();
}
 
Example #24
Source File: MorphShapeTest.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * @see org.newdawn.slick.Game#render(GameContainer, Graphics)
 */
public void render(GameContainer container, Graphics g)
		throws SlickException {
	g.setColor(Color.green);
	g.draw(a);
	g.setColor(Color.red);
	g.draw(b);
	g.setColor(Color.blue);
	g.draw(c);
	g.setColor(Color.white);
	g.draw(morph);
}
 
Example #25
Source File: NonGeometricData.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Get an attribute value converted to a color. isColor should first be checked
 * 
 * @param attribute The attribute whose value should be interpreted as a color
 * @return The color based on the attribute
 */
public Color getAsColor(String attribute) {
	if (!isColor(attribute)) {
		throw new RuntimeException("Attribute "+attribute+" is not specified as a color:"+getAttribute(attribute));
	}
	
	int col = Integer.parseInt(getAttribute(attribute).substring(1), 16);
	
	return new Color(col);
}
 
Example #26
Source File: TeamNameInput.java    From FEMultiplayer with GNU General Public License v3.0 5 votes vote down vote up
public void render(){
	Renderer.drawRectangle(0, 0, 480, 320, renderDepth, new Color(0,0,0,0.5f));
	Renderer.drawBorderedRectangle(x-10, y-20, x+width+10, y+height +5, renderDepth,
			FightStage.NEUTRAL, FightStage.BORDER_LIGHT, FightStage.BORDER_DARK);
	Renderer.drawString("default_med", "Team Name:", x, y-15, renderDepth);
	BitmapFont font = FEResources.getBitmapFont("default_med");
	Renderer.drawRectangle(x, y, x+width, y+height, renderDepth, FOCUSED);
	float linepos = x + font.getStringWidth(input.substring(0, cursorPos)) + 2;
	Renderer.drawRectangle(linepos, y+1, linepos+1, y+height-1, renderDepth-0.02f, CURSOR);
	Renderer.drawString("default_med", input.toString(), x+2, y+5, renderDepth-0.01f);
}
 
Example #27
Source File: CursorColorManager.java    From opsu-dance with GNU General Public License v3.0 5 votes vote down vote up
static int col(Color color)
{
	return
		(color.getRedByte() << 16) |
		(color.getGreenByte() << 8) |
		(color.getBlueByte());
}
 
Example #28
Source File: Menu.java    From FEMultiplayer with GNU General Public License v3.0 5 votes vote down vote up
public void render(){
	int oY = 0;
	for(int i = 0; i < items.size(); i++){
		Color c = (selection == i && !cleared)? MENU_SELECT: MENU;
		if(i == marked){
			c = MENU_MARKED;
		}
		Renderer.drawRectangle(x, y + oY, x + width, y + oY + height, renderDepth, c);
		renderItem(items.get(i), oY);
		oY+=height+1;
	}
}
 
Example #29
Source File: LoadStage.java    From FEMultiplayer with GNU General Public License v3.0 5 votes vote down vote up
public static void render(){
	int width = (int) (percent * 436);
	glClear(GL_COLOR_BUFFER_BIT |
	        GL_DEPTH_BUFFER_BIT |
	        GL_STENCIL_BUFFER_BIT);
	glClearDepth(1.0f);
	Renderer.drawString("default_med", "FE: Multiplayer is loading...", 22, 262, 0);
	String percentText = (int)(percent * 100) + "%";
	int pwidth = FEResources.getBitmapFont("default_med").getStringWidth(percentText);
	Renderer.drawString("default_med", percentText, 458 - pwidth, 263, 0);
	Renderer.drawRectangle(20, 280, 460, 300, 0, Color.gray);
	Renderer.drawRectangle(22, 282, 22+width, 298, 0, Color.blue.darker());
	Display.update();
}
 
Example #30
Source File: SoundURLTest.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * @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 volume of music", 100, 270);
	g.setColor(Color.blue);
	g.drawString("Music Volume Level: " + volume / 10.0f, 150, 300);
}