20 package net.sf.gridarta.gui.mapuserlistener;
22 import java.awt.event.InputEvent;
23 import java.awt.event.KeyEvent;
24 import java.awt.event.KeyListener;
25 import java.awt.event.MouseEvent;
26 import java.awt.event.MouseListener;
36 import org.jetbrains.annotations.NotNull;
37 import org.jetbrains.annotations.Nullable;
68 public void keyTyped(@NotNull
final KeyEvent e) {
73 public void keyPressed(@NotNull
final KeyEvent e) {
78 public void keyReleased(@NotNull
final KeyEvent e) {
92 public void mouseClicked(@NotNull
final MouseEvent e) {
97 public void mousePressed(@NotNull
final MouseEvent e) {
102 public void mouseReleased(@NotNull
final MouseEvent e) {
107 public void mouseEntered(@NotNull
final MouseEvent e) {
113 public void mouseExited(@NotNull
final MouseEvent e) {
137 public void activeMapViewChanged(@Nullable
final MapView<G, A, R> mapView) {
153 if (mapView != null) {
160 public void mapCreated(@NotNull
final MapControl<G, A, R> mapControl,
final boolean interactive) {
182 mapViewManager.addMapViewManagerListener(mapViewManagerListener);
183 mapManager.addMapManagerListener(mapManagerListener);
184 setMapView(mapViewManager.getActiveMapView());
193 if (prevMapView != null) {
195 prevMapView.
getRenderer().removeMouseListener(mouseListener);
199 if (mapView != null) {
201 mapView.getRenderer().addMouseListener(mouseListener);
203 setInside(mapView.getInternalFrame().getMousePosition() != null);
215 final boolean lightVisible = (modifiers & (InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK)) == (InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK);
216 if (this.lightVisible != lightVisible) {
227 if (this.inside != inside) {
238 if (mapView != null) {
239 mapView.
getRenderer().setLightVisible(inside && lightVisible);
final KeyListener keyListener
The KeyListener attached to mapView.
void updateRenderer()
Updates the current map view's renderer settings.
void setInside(final boolean inside)
Updates the "mouse is inside the window" flag for the current map view.
A MapManager manages all opened maps.
Graphical User Interface of Gridarta.
MapView< G, A, R > mapView
The MapView being tracked for key actions.
final MapViewManagerListener< G, A, R > mapViewManagerListener
The listener used to detect map view changes.
Base package of all Gridarta classes.
Reflects a game object (object on a map).
Interface for listeners listening to MapManager changes.
MapKeyListener(@NotNull final MapViewManager< G, A, R > mapViewManager, @NotNull final MapManager< G, A, R > mapManager)
Creates a new instance.
GameObjects are the objects based on Archetypes found on maps.
MapRenderer getRenderer()
Returns the MapRenderer for this view.
Interface for listeners interested in events related to MapViewManager instances. ...
void setModifiers(final int modifiers)
Updates the active modifiers for the current map view.
Base classes for rendering maps.
Currently nothing more than a marker interface for unification.
A map view consists of a map grid and a map cursor, and is attached to a map control.
final MouseListener mouseListener
The MouseListener attached to mapView.
final MapManagerListener< G, A, R > mapManagerListener
The MapManagerListener for tracking MapControl instances.
Tracks key presses and maps them to actions.
boolean lightVisible
Whether the CTRL+SHIFT modifiers are pressed.
void setMapView(@Nullable final MapView< G, A, R > mapView)
Sets the current map view.
boolean inside
Whether the mouse is inside the window.
Interface for MapArchObjects.
JInternalFrame getInternalFrame()
Returns the JInternalFrame instance for this map view.