@Override public void update(GameContainer gc, StateBasedGame sb, int delta) throws SlickException { Input input = gc.getInput(); if (input.isMouseButtonDown(0) && bib.spriteCollisionByPoint(input.getAbsoluteMouseX(), input.getAbsoluteMouseY())) sb.enterState(Main.TRACKSCREEN); if (input.isMouseButtonDown(0) && shoes.spriteCollisionByPoint(input.getAbsoluteMouseX(), input.getAbsoluteMouseY())) sb.enterState(Main.TRAININGSCREEN); if (input.isKeyDown(Input.KEY_ESCAPE)) { PauseScreen.screen = 3; sb.enterState(Main.PAUSESCREEN); } } // end update
@Override public void render(GameContainer gc, StateBasedGame sb, Graphics g) throws SlickException { Input input = gc.getInput(); gc.setShowFPS(false); background.draw(0, 0); if (shoes.spriteCollisionByPoint(input.getAbsoluteMouseX(), input.getAbsoluteMouseY())) g.drawImage(shoes.image, shoes.x, shoes.y, Color.blue); else shoes.draw(g); if (bib.spriteCollisionByPoint(input.getAbsoluteMouseX(), input.getAbsoluteMouseY())) g.drawImage(bib.image, bib.x, bib.y, Color.red); else bib.draw(g); g.setColor(Color.black); g.drawString("PR - " + PR / 60 + ":" + String.format("%02d", PR % 60), 230, 75); g.setColor(Color.white); } // end render