Maybe I'm crazy, but I want to incorporate some logic I learned in my XNA Game Development class into android/java game programming. For example, I'm using Point rather than Vector2 to manipulate the location of graphics programmatically, and adjust graphic size based on an Android device's dpi and orientation.
I thought finding the center of the graphic would be a great asset when laying out the GUI and determining which folder (hdpi, ldpi, or mdpi) the graphics should be taken from. Unfortunately, Eclipse seems to have a problem with the plus sign. This is interesting because I am trying to perform a simple mathematical operation.:
The operator + is undefined for the argument type(s) android.graphics.Point, android.graphics.Point
//Java code was both copied & pasted as well as written to make sure Visual Studio
public Point Center()
{
return new Point(_frameWidth/2, _frameHeight/2)+_location;
}
//Original XNA code
//Determines the coordinates of a sprite's center
public Vector2 Center
{
get
{
return _location + new Vector2(_frameWidth / 2, _frameHeight / 2);
}
}