mhframework.tilemap
Class MHIsoMouseMap

java.lang.Object
  extended by mhframework.tilemap.MHIsoMouseMap

public class MHIsoMouseMap
extends java.lang.Object

Mouse map for isometric tile maps. The getDirection() method in this class accepts an (x, y) pair representing a fine mouse map coordinate, and then returns a constant indicating the direction to perform a tile walk in order to identify the proper map coordinate containing the mouse point.

The current version of this class is hard-coded to work only for isometric tiles with dimensions 128x64.


Field Summary
static int CENTER
          Constant indicating center of mouse map.
static int HEIGHT
          The height of the mouse map matrix.
static int WIDTH
          The width of the mouse map matrix.
 
Constructor Summary
MHIsoMouseMap()
          Constructor.
 
Method Summary
 int getDirection(int mouseX, int mouseY)
          Returns the direction to be "walked" in order for the mouse point to be accurately interpreted as a map position.
static void main(java.lang.String[] args)
          For testing only.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CENTER

public static final int CENTER
Constant indicating center of mouse map.

See Also:
Constant Field Values

WIDTH

public static final int WIDTH
The width of the mouse map matrix.

See Also:
Constant Field Values

HEIGHT

public static final int HEIGHT
The height of the mouse map matrix.

See Also:
Constant Field Values
Constructor Detail

MHIsoMouseMap

public MHIsoMouseMap()
Constructor.

Method Detail

getDirection

public int getDirection(int mouseX,
                        int mouseY)
Returns the direction to be "walked" in order for the mouse point to be accurately interpreted as a map position.

Parameters:
mouseX - The x coordinate of a fine mouse map point.
mouseY - The y coordinate of a fine mouse map point.
Returns:
A constant indicating the point's position relative to a map cell's center.

main

public static void main(java.lang.String[] args)
For testing only. Do not use.