mirror of
https://github.com/GTNewHorizons/CodeChickenCore.git
synced 2026-11-16 01:54:50 +00:00
Initial Commit
This commit is contained in:
1 parent
397135f687
commit
0f32dd8620
82 files changed
+10693
No files matched your search
@@ -0,0 +1,42 @@
|
||||
package codechicken.lib.vec;
|
||||
|
||||
public class Rectangle4i
|
||||
{
|
||||
public int x;
|
||||
public int y;
|
||||
public int w;
|
||||
public int h;
|
||||
|
||||
public Rectangle4i()
|
||||
{
|
||||
}
|
||||
|
||||
public Rectangle4i(int x, int y, int w, int h)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.w = w;
|
||||
this.h = h;
|
||||
}
|
||||
|
||||
public Rectangle4i offset(int dx, int dy)
|
||||
{
|
||||
x+=dx;
|
||||
y+=dy;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Rectangle4i with(int px, int py)
|
||||
{
|
||||
if(x > px) x = px;
|
||||
if(y > py) y = py;
|
||||
if(x + w <= px) w = px-x+1;
|
||||
if(y + h <= py) h = py-y+1;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean contains(int px, int py)
|
||||
{
|
||||
return x <= px && px < x+w && y <= py && py < y+h;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user