/** * @see org.newdawn.slick.state.GameState#render(org.newdawn.slick.GameContainer, * org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.Graphics) */ public void render(GameContainer container, StateBasedGame arg1, Graphics g) throws SlickException { world.render(container, arg1, g); // for (int i = 0 ; i < bulletDirector.getBullets ().size (); ++i) // { // Bullet bullet = bulletDirector.getBullets ().get (i); // if (bullet.isHeadingActive ()) // rocket.getImage ().setRotation (bullet.getHeading () + 90); // else // rocket.getImage ().setRotation (bullet.getRotation () + 90); // // g.drawImage (rocket.getImage (), (int)bullet.getX (), (int)bullet.getY ()); // } // for (int x = 0; x < 20; ++x) // g.drawImage (rocket.getImage (), (int)60 + xpos, (int)250 + (15 * x)); // g.drawImage (rocket.getImage (), (int)60 + xxpos, (int)350); int tileIndexX = (int) (mapX / map.getTileWidth()); int tileIndexY = (int) (mapY / map.getTileHeight()); map.render( (int) 0, (int) 0, tileIndexX, tileIndexY, (int) 1024 + map.getTileWidth(), (int) 768 + map.getTileHeight()); g.drawString("GameTime: " + world.getNetworkTime(), 100, 10); g.drawString("TimeShift: " + client.getGameTimeManager().getNetworkTimeShift(), 280, 10); g.drawString("Delta: " + delta, 450, 10); g.drawString("MapXY: " + mapX + ":" + mapY, 450, 60); }
public void localChatText(String text) { String[] commands = text.split(" "); if (commands[0].equals("client")) { if (commands.length == 2) { client.init(commands[1], "localhost", 9001, "localhost", 9000); chatFrame.appendRow("default", ""); } else if (commands.length == 6) { client.init( commands[1], commands[2], NumberTools.toInt(commands[3], 9005), commands[4], NumberTools.toInt(commands[5], 9000)); } else { chatFrame.appendRow( "default", "To start the client enter: client <username> <localip> <localport> <serverip> <serverport>"); return; } chatFrame.appendRow("default", "."); chatFrame.appendRow("default", "Try to connect...can take a while..."); } else if (commands[0].equals("server")) { if (commands.length == 1) { server.init("localhost", 9000); } else if (commands.length == 3) { server.init(commands[1], NumberTools.toInt(commands[2], 9000)); } else { chatFrame.appendRow( "default", "To start the client enter: client <localip> <serverip> <serverport>"); return; } chatFrame.appendRow("default", "."); chatFrame.appendRow("default", "Server created..."); } else { if (client.getChatService() != null) client .getChatService() .sendMessage(client.getCommonWorld().getUserManager().getAppUser(), text); } }
@Override public CommonWorld getCommonWorld() { return client.getCommonWorld(); }