/** * @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); }
/** * @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); }
/** * @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); } }
/** * @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); }
/** * 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"); }
/** * @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); }
/** * @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); }
/** * @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); }
/** * @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(); }
/** * 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 { } }; }
/** * @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(); }
/** * @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); } }
/** * @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())); }
/** * @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(); }
/** * @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); }
@Override public void render(Graphics g, long cTime) { if(lastNode != null) { lastNode.render(g, cTime); // Render the range of the last node. g.setColor(LaserBarrier.BARRIER_RANGE_INDICATOR); g.drawOval((lastNode.getPosition().x - (LaserBarrier.BARRIER_RANGE / 2)), (lastNode.getPosition().y - (LaserBarrier.BARRIER_RANGE / 2)), LaserBarrier.BARRIER_RANGE, LaserBarrier.BARRIER_RANGE); } // Render all the nodes and the barrier between them. Iterator<Projectile> it = projectiles.iterator(); while(it.hasNext()) { Projectile node = it.next(); node.render(g, cTime); } }
public void startButton(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException { float rate = 0.9f; float width = playButton.getWidth() * PZGUI.getResolutionRateWidth() * rate; float height = playButton.getHeight() * PZGUI.getResolutionRateHeight() * rate; float posX = PZGUI.getWidth() /2 - width/2; float posY = PZGUI.getHeight() * (float)(0.7) - height/2; float edgeX = posX + width; float edgeY = posY + height; playButton.draw(posX, posY, width, height); if ( Mouse.getX() >= posX && Mouse.getX() <= edgeX && PZGUI.getHeight() - Mouse.getY() >= posY && PZGUI.getHeight() - Mouse.getY() <= edgeY) { playButton.draw(posX, posY, width, height, new Color(100, 100, 100, 60)); if (Mouse.isButtonDown(0)) sbg.enterState(1); } }
@Override public void render(GameContainer container, Graphics g) throws SlickException { int x = pacman.getxPos(); int y = pacman.getyPos(); mazeMap.render(0, 0); renderFood(x, y); startReady(); renderPacman(); soundEatFruit(); renderGhosts(); renderScore(g); renderLives(g, lives); renderTitle(g); if(lives == 0) gameOver.draw(200, 384); if (youWin() == 0) youWin.draw(212, 384); }
/** * Render the diagram to the given graphics context * * @param g The graphics context to which we should render the diagram */ public void render(Graphics g) { // last list generation if (list == -1) { list = GL.glGenLists(1); GL.glNewList(list, SGL.GL_COMPILE); render(g, diagram); GL.glEndList(); } GL.glCallList(list); TextureImpl.bindNone(); }
/** * @see org.newdawn.slick.state.BasicGameState#render(org.newdawn.slick.GameContainer, org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.Graphics) */ public void render(GameContainer container, StateBasedGame game, Graphics g) { g.setFont(font); g.setColor(Color.blue); g.drawString("This is State 3", 200, 50); g.setColor(Color.white); for (int i=0;i<options.length;i++) { g.drawString(options[i], 400 - (font.getWidth(options[i])/2), 200+(i*50)); if (selected == i) { g.drawRect(200,190+(i*50),400,50); } } }
/** * @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.resetTransform(); 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(); } }
/** * @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("Position: "+music.getPosition(), 100,100); g.drawString("Space - Pause/Resume", 100,130); g.drawString("Right Arrow - Advance 5 seconds", 100, 145); }
/** * @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) { Color old = g.getColor(); g.setColor(color); g.fillRect(0, 0, container.getWidth() * 2, container.getHeight() * 2); g.setColor(old); }
/** * @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) { Color old = g.getColor(); g.setColor(color); g.fillRect(0, 0, container.getWidth()*2, container.getHeight()*2); g.setColor(old); }
/** * @see org.newdawn.slick.BasicGame#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics) */ public void render(GameContainer container, Graphics g) { for (int x=0;x<3;x++) { for (int y=0;y<3;y++) { images[x+(y*3)].draw(100+(x*width),100+(y*height)); } } }
/** * Get a graphics context for a particular image * * @param image The image for which to retrieve the graphics context * @return The graphics context * @throws SlickException Indicates it wasn't possible to create a graphics context * given available hardware. */ public static Graphics getGraphicsForImage(Image image) throws SlickException { Graphics g = (Graphics) graphics.get(image.getTexture()); if (g == null) { g = createGraphics(image); graphics.put(image.getTexture(), g); } return g; }
static Icon getColorIcon (java.awt.Color color) { BufferedImage image = new BufferedImage(32, 16, BufferedImage.TYPE_INT_RGB); java.awt.Graphics g = image.getGraphics(); g.setColor(color); g.fillRect(1, 1, 30, 14); g.setColor(java.awt.Color.black); g.drawRect(0, 0, 31, 15); return new ImageIcon(image); }
/** * @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.white); g.drawString("1 - No Clipping", 100, 10); g.drawString("2 - Screen Clipping", 100, 30); g.drawString("3 - World Clipping", 100, 50); if (world) { g.drawString("WORLD CLIPPING ENABLED", 200, 80); } if (clip) { g.drawString("SCREEN CLIPPING ENABLED", 200, 80); } g.rotate(400, 400, ang); if (world) { g.setWorldClip(350,302,100,196); } if (clip) { g.setClip(350,302,100,196); } g.setColor(Color.red); g.fillOval(300,300,200,200); g.setColor(Color.blue); g.fillRect(390,200,20,400); g.clearClip(); g.clearWorldClip(); }
/** * @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); }
/** * @see org.newdawn.slick.Game#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics) */ 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.Game#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics) */ public void render(GameContainer container, Graphics g) throws SlickException { g.clearAlphaMap(); g.setDrawMode(Graphics.MODE_NORMAL); g.setColor(Color.white); g.fillOval(100,100,150,150); textureMap.draw(10,50); g.copyArea(copy, 100,100); g.setColor(Color.red); g.fillRect(300,100,200,200); copy.draw(350,150); }