ZenScript main repository
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DIRectangle.java 734B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package org.openzen.drawablegui;
  7. /**
  8. *
  9. * @author Hoofdgebruiker
  10. */
  11. public class DIRectangle {
  12. public static final DIRectangle EMPTY = new DIRectangle(0, 0, 0, 0);
  13. public final int x;
  14. public final int y;
  15. public final int width;
  16. public final int height;
  17. public DIRectangle(int x, int y, int width, int height) {
  18. this.x = x;
  19. this.y = y;
  20. this.width = width;
  21. this.height = height;
  22. }
  23. public boolean contains(int x, int y) {
  24. return x >= this.x && x < (this.x + this.width)
  25. && y >= this.y && y < (this.y + this.height);
  26. }
  27. }