1 /* $Id$ */
2 /***************************************************************************
3  *                   (C) Copyright 2003-2010 - Stendhal                    *
4  ***************************************************************************
5  ***************************************************************************
6  *                                                                         *
7  *   This program is free software; you can redistribute it and/or modify  *
8  *   it under the terms of the GNU General Public License as published by  *
9  *   the Free Software Foundation; either version 2 of the License, or     *
10  *   (at your option) any later version.                                   *
11  *                                                                         *
12  ***************************************************************************/
13 package games.stendhal.client;
14 
15 import java.awt.Point;
16 import java.awt.geom.Point2D;
17 
18 import games.stendhal.client.gui.j2d.RemovableSprite;
19 import games.stendhal.client.gui.j2d.entity.EntityView;
20 
21 public interface IGameScreen {
22 
23 	/** The width / height of one tile. */
24 	int SIZE_UNIT_PIXELS = 32;
25 
26 	/** Prepare screen for the next frame to be rendered and move it if needed .*/
nextFrame()27 	void nextFrame();
28 
29 	/**
30 	 * Center the view.
31 	 */
center()32 	 void center();
33 
34 	/**
35 	 * Set the offline indication state.
36 	 *
37 	 * @param offline
38 	 *            <code>true</code> if offline.
39 	 */
setOffline(boolean offline)40 	void setOffline(boolean offline);
41 
42 	/**
43 	 * Removes a text bubble.
44 	 * @param entity The text to be removed.
45 	 */
removeText(RemovableSprite entity)46 	void removeText(RemovableSprite entity);
47 
48 	/**
49 	 * Removes all the text entities.
50 	 */
clearTexts()51 	void clearTexts();
52 
53 	/**
54 	 * Gets an entity view at given coordinates.
55 	 *
56 	 * @param x
57 	 *            The X world coordinate.
58 	 * @param y
59 	 *            The Y world coordinate.
60 	 *
61 	 * @return The entity view, or <code>null</code> if none found.
62 	 */
getEntityViewAt(double x, double y)63 	EntityView<?> getEntityViewAt(double x, double y);
64 
65 	/**
66 	 * Get a movable entity view at given coordinates.
67 	 *
68 	 * @param x
69 	 *            The X world coordinate.
70 	 * @param y
71 	 *            The Y world coordinate.
72 	 *
73 	 * @return The entity view, or <code>null</code> if none found.
74 	 */
getMovableEntityViewAt(final double x, final double y)75 	EntityView<?> getMovableEntityViewAt(final double x,
76 			final double y);
77 
78 	/**
79 	 * Get the text bubble at specific coordinates.
80 	 *
81 	 * @param x
82 	 *            Screen X coordinate.
83 	 * @param y
84 	 *            Screen Y world coordinate.
85 	 * @return the text bubble at the given coordinate or <code>null</code> if
86 	 * 	not found.
87 	 */
getTextAt(int x, int y)88 	RemovableSprite getTextAt(int x, int y);
89 
90 	/**
91 	 * Convert screen view coordinates to world coordinates.
92 	 *
93 	 * @param p
94 	 *            The screen view coordinates.
95 	 *
96 	 * @return World coordinates.
97 	 */
convertScreenViewToWorld(final Point p)98 	Point2D convertScreenViewToWorld(final Point p);
99 
100 	/**
101 	 * Convert screen view coordinates to world coordinates.
102 	 *
103 	 * @param x
104 	 *            The screen view X coordinate.
105 	 * @param y
106 	 *            The screen view Y coordinate.
107 	 *
108 	 * @return World coordinates.
109 	 */
convertScreenViewToWorld(final int x, final int y)110 	Point2D convertScreenViewToWorld(final int x, final int y);
111 
112 	/**
113 	 * The user position changed. This sets the target coordinates that the
114 	 * screen centers on.
115 	 *
116 	 * @param x
117 	 *            The X coordinate (in world units).
118 	 * @param y
119 	 *            The Y coordinate (in world units).
120 	 */
positionChanged(final double x, final double y)121 	void positionChanged(final double x, final double y);
122 }
123