public void render(GameContainer gc, Graphics g) { sprite.draw(x, y); if (lines.size() > 0) { font.drawString(xLine1, yLine1, lines.get(0)); } if (lines.size() > 1) { font.drawString(xLine2, yLine2, lines.get(1)); } }
public void render() { PerformanceMonitor.startActivity("Render UIText"); ShaderManager.getInstance().enableDefaultTextured(); // TODO HACK: Workaround because the internal Slick texture mechanism is never used _workaroundTexture.bind(); if (_shadowed) _font.drawString(_shadowOffset.x, _shadowOffset.y, _text, _shadowColor); _font.drawString(0, 0, _text, _color); // TODO: Also ugly.. glDisable(GL11.GL_TEXTURE_2D); PerformanceMonitor.endActivity(); }
/** * @see org.newdawn.slick.Game#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics) */ @Override 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); }
/** * @see org.newdawn.slick.BasicGame#render(org.newdawn.slick.GameContainer, * org.newdawn.slick.Graphics) */ @Override 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() { @Override protected void performGLOperations() throws SlickException { renderGL(); } }; callable.call(); homer.draw(450, 250, 80, 200); font.drawString(150, 300, "Text Drawn after the callable"); }
/** * @see org.newdawn.slick.Font#drawString(float, float, java.lang.String, org.newdawn.slick.Color) */ public void drawString(float x, float y, String text, Color col) { drawString(x, y, text, col, 0, text.length() - 1); }
/** @see org.newdawn.slick.Font#drawString(float, float, java.lang.String) */ public void drawString(float x, float y, String text) { drawString(x, y, text, Color.white); }
@Override public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException { // TODO Auto-generated method stub font.drawString(250, 280, "Thank you for playing!!!"); }