Rectangle.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. function Rectangle() {
  2. Object.defineProperties(this, {
  3. 'x': { enumerable: true, configurable: true, get: Rectangle.prototype.__get_x, set: Rectangle.prototype.__set_x},
  4. 'y': { enumerable: true, configurable: true, get: Rectangle.prototype.__get_y, set: Rectangle.prototype.__set_y},
  5. 'w': { enumerable: true, configurable: true, get: Rectangle.prototype.__get_w, set: Rectangle.prototype.__set_w},
  6. 'h': { enumerable: true, configurable: true, get: Rectangle.prototype.__get_h, set: Rectangle.prototype.__set_h}
  7. })
  8. }
  9. Rectangle.prototype.__get_x = function() {
  10. return Polycode.Rectangle__get_x(this.__ptr)
  11. }
  12. Rectangle.prototype.__set_x = function(val) {
  13. Polycode.Rectangle__set_x(this.__ptr, val)
  14. }
  15. Rectangle.prototype.__get_y = function() {
  16. return Polycode.Rectangle__get_y(this.__ptr)
  17. }
  18. Rectangle.prototype.__set_y = function(val) {
  19. Polycode.Rectangle__set_y(this.__ptr, val)
  20. }
  21. Rectangle.prototype.__get_w = function() {
  22. return Polycode.Rectangle__get_w(this.__ptr)
  23. }
  24. Rectangle.prototype.__set_w = function(val) {
  25. Polycode.Rectangle__set_w(this.__ptr, val)
  26. }
  27. Rectangle.prototype.__get_h = function() {
  28. return Polycode.Rectangle__get_h(this.__ptr)
  29. }
  30. Rectangle.prototype.__set_h = function(val) {
  31. Polycode.Rectangle__set_h(this.__ptr, val)
  32. }
  33. Rectangle.prototype.setRect = function(x,y,w,h) {
  34. Polycode.Rectangle_setRect(this.__ptr, x,y,w,h)
  35. }
  36. Rectangle.prototype.Clipped = function(rect) {
  37. var retVal = new Rectangle()
  38. retVal.__ptr = Polycode.Rectangle_Clipped(this.__ptr, rect)
  39. return retVal
  40. }
  41. Rectangle.prototype.minX = function() {
  42. return Polycode.Rectangle_minX(this.__ptr)
  43. }
  44. Rectangle.prototype.maxX = function() {
  45. return Polycode.Rectangle_maxX(this.__ptr)
  46. }
  47. Rectangle.prototype.minY = function() {
  48. return Polycode.Rectangle_minY(this.__ptr)
  49. }
  50. Rectangle.prototype.maxY = function() {
  51. return Polycode.Rectangle_maxY(this.__ptr)
  52. }