Skip to content

Instantly share code, notes, and snippets.

@Mtgxyz
Created January 11, 2014 17:35
Show Gist options
  • Save Mtgxyz/8374042 to your computer and use it in GitHub Desktop.
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.
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