public class

Rect

extends Object
java.lang.Object
   ↳ com.neomades.graphics.Rect

Class Overview

Rect holds four int coordinates for a rectangle area. The four coordinates are position: x, y and dimension: w (width), h (height).

Summary

Fields
public int h Height of the rectangle
public int w Width of the rectangle
public int x X-position
public int y Y-position
Public Constructors
Rect()
Constructs a new Rectangle, with all values to 0 (x, y, width and height)
Rect(int x, int y, int w, int h)
Constructs a new rectangle, given the x, y, width and height.
Rect(Rect collision)
Create a rectangle from an other rectangle.
Public Methods
int bottom()
Gets the bottom position of the rectangle (y + height).
int left()
Gets the left position of the rectangle (x)
int right()
Gets the right position of the rectangle (x + width).
int top()
Gets the top position of the rectangle (y)
[Expand]
Inherited Methods
From class java.lang.Object

Fields

public int h

Height of the rectangle

public int w

Width of the rectangle

public int x

X-position

public int y

Y-position

Public Constructors

public Rect ()

Constructs a new Rectangle, with all values to 0 (x, y, width and height)

public Rect (int x, int y, int w, int h)

Constructs a new rectangle, given the x, y, width and height.

Parameters
x x position
y y position
w width
h height

public Rect (Rect collision)

Create a rectangle from an other rectangle.

Parameters
collision the rectangle to create

Public Methods

public int bottom ()

Gets the bottom position of the rectangle (y + height).

Returns
  • the bottom position

public int left ()

Gets the left position of the rectangle (x)

Returns
  • the left position

public int right ()

Gets the right position of the rectangle (x + width).

Returns
  • the right position

public int top ()

Gets the top position of the rectangle (y)

Returns
  • the top position