From: ChadF <ch...@us...> - 2007-09-13 02:40:33
|
Update of /cvsroot/arianne/stendhal/src/games/stendhal/client In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv9280/src/games/stendhal/client Modified Files: GameScreen.java StendhalUI.java Log Message: Changed minimap to use position listener instead of polling. Wrapped drawing of players in minimap (ghost players are gray if admin). Index: StendhalUI.java =================================================================== RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/client/StendhalUI.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** StendhalUI.java 12 Sep 2007 12:30:35 -0000 1.20 --- StendhalUI.java 13 Sep 2007 02:40:01 -0000 1.21 *************** *** 149,152 **** --- 149,161 ---- public abstract void setOffline(boolean offline); + /** + * Set the user's positiion. + * + * @param x The user's X coordinate. + * @param y The user's Y coordinate. + */ + public abstract void setPosition(double x, double y); + + // // <StendhalGUI> Index: GameScreen.java =================================================================== RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/client/GameScreen.java,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** GameScreen.java 12 Sep 2007 02:14:59 -0000 1.88 --- GameScreen.java 13 Sep 2007 02:40:01 -0000 1.89 *************** *** 14,17 **** --- 14,18 ---- import games.stendhal.client.entity.Entity; + import games.stendhal.client.events.PositionChangeListener; import games.stendhal.client.gui.j2DClient; import games.stendhal.client.gui.j2d.Text; *************** *** 64,68 **** * The game screen. This manages and renders the visual elements of the game. */ ! public class GameScreen { /** the logger instance. */ --- 65,69 ---- * The game screen. This manages and renders the visual elements of the game. */ ! public class GameScreen implements PositionChangeListener { /** the logger instance. */ *************** *** 606,632 **** /** - * Set the target coordinates that the screen centers on. - * - * @param x - * The world X coordinate. - * @param y - * The world Y coordinate. - */ - public void place(double x, double y) { - int ix = (int) x; - int iy = (int) y; - - /* - * Save CPU cycles - */ - if ((ix != this.x) || (iy != this.y)) { - this.x = ix; - this.y = iy; - - calculateView(); - } - } - - /** * Sets the world size. * --- 607,610 ---- *************** *** 1471,1474 **** --- 1449,1479 ---- } + + // + // PositionChangeListener + // + + /** + * The user position changed. + * This sets the target coordinates that the screen centers on. + * + * @param x The X coordinate (in world units). + * @param y The Y coordinate (in world units). + */ + public void positionChanged(final double x, final double y) { + int ix = (int) x; + int iy = (int) y; + + /* + * Save CPU cycles + */ + if ((ix != this.x) || (iy != this.y)) { + this.x = ix; + this.y = iy; + + calculateView(); + } + } + // // |