Skip to content

Commit bcb480e

Browse files
committed
Created vector2i
1 parent c5822ec commit bcb480e

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package com.redomar.game.lib.utils;
2+
3+
public class Vector2i {
4+
5+
private int x, y;
6+
7+
public Vector2i(){
8+
set(0, 0);
9+
}
10+
11+
public Vector2i(int x, int y){
12+
set(x, y);
13+
}
14+
15+
public Vector2i(Vector2i vector){
16+
set(vector.x, vector.y);
17+
}
18+
19+
public Vector2i add(Vector2i vector){
20+
this.x += vector.x;
21+
this.y += vector.y;
22+
return this;
23+
}
24+
25+
public Vector2i subtract(Vector2i vector){
26+
this.x -= vector.x;
27+
this.y -= vector.y;
28+
return this;
29+
}
30+
31+
public void set(int x, int y){
32+
this.x = x;
33+
this.y = y;
34+
}
35+
36+
public int getX() {
37+
return x;
38+
}
39+
40+
public Vector2i setX(int x) {
41+
this.x = x;
42+
return this;
43+
}
44+
45+
public int getY() {
46+
return y;
47+
}
48+
49+
public Vector2i setY(int y) {
50+
this.y = y;
51+
return this;
52+
}
53+
54+
}

0 commit comments

Comments
 (0)