Created
January 11, 2014 17:35
-
-
Save Mtgxyz/8374042 to your computer and use it in GitHub Desktop.
Simple 2-Integer-Class for use with 2D-Game (Map Coords...), drawing quads (Position of the Pixels), and much more.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package de.bplaced.mtgxyz.cavegame; | |
public class Int2 { | |
public int x; | |
public int y; | |
public Int2(int x, int y) { | |
this.x = x; | |
this.y = y; | |
} | |
public Int2() { | |
this(0,0); | |
} | |
public String toString() { | |
return "de.bplaced.mtgxyz.cavegame.Int2@"+this.hashCode()+": {\n x: "+this.x+"\n y: "+this.y+"\n}"; | |
} | |
public boolean equals(Object obj) { | |
if(!(obj instanceof Int2)) { | |
return false; | |
} | |
Int2 i2 = (Int2) obj; | |
if(i2.x != this.x || i2.y != this.y) | |
return false; | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment