mirror of
https://github.com/GTNewHorizons/bdlib.git
synced 2026-10-26 14:23:54 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
377fe3c27a |
No files matched your search
+1
-1
@@ -18,7 +18,7 @@ buildscript {
|
||||
apply plugin: 'forge'
|
||||
apply plugin: 'scala'
|
||||
|
||||
version = "0.9.1"
|
||||
version = "0.9.2"
|
||||
|
||||
if (project.hasProperty('buildnum')) {
|
||||
project.version = project.version + '.' + project.buildnum
|
||||
|
||||
@@ -14,3 +14,12 @@ class Point(val x: Int, val y: Int) {
|
||||
def +(that: Point) = new Point(this.x + that.x, this.y + that.y)
|
||||
def -(that: Point) = new Point(this.x - that.x, this.y - that.y)
|
||||
}
|
||||
|
||||
object Point {
|
||||
|
||||
import language.implicitConversions
|
||||
|
||||
implicit def awt2point(p: java.awt.Point): Point = new Point(p.x, p.y)
|
||||
implicit def point2awt(p: Point): java.awt.Point = new java.awt.Point(p.x, p.y)
|
||||
implicit def tuple2point(p: (Int, Int)): Point = new Point(p._1, p._2)
|
||||
}
|
||||
@@ -13,4 +13,6 @@ class Rect(val x: Int, val y: Int, val w: Int, val h: Int) {
|
||||
def this(p: Point, w: Int, h: Int) = this(p.x, p.y, w, h)
|
||||
def contains(p: Point) = p.x >= x && p.y >= y && p.x <= x + w && p.y <= y + h
|
||||
def origin = new Point(x, y)
|
||||
def +(p: Point) = new Rect(origin + p, w, h)
|
||||
def -(p: Point) = new Rect(origin - p, w, h)
|
||||
}
|
||||
Reference in new issue
Block a user