Separated langpack, concept art for inventory UI

Former-commit-id: 7a98df93b4ef50b47283abcd99576d6fbefc9cc5
Former-commit-id: db6e34417ccf84e59ba68547f30459cb4b188eb7
This commit is contained in:
Song Minjae
2016-07-04 23:08:16 +09:00
parent 2ed435165a
commit 2e46df67a8
91 changed files with 70088 additions and 720 deletions

View File

@@ -17,6 +17,8 @@ class Hitbox(x1: Double, y1: Double, width: Double, height: Double) {
var height: Double = 0.0
private set
val HALF_PIXEL = 0.5
init {
hitboxStart = Point2d(x1, y1)
hitboxEnd = Point2d(x1 + width, y1 + height)
@@ -54,62 +56,56 @@ class Hitbox(x1: Double, y1: Double, width: Double, height: Double) {
* @param width
* @param height
*/
fun set(x1: Double, y1: Double, width: Double, height: Double) {
fun set(x1: Double, y1: Double, width: Double, height: Double): Hitbox {
hitboxStart = Point2d(x1, y1)
hitboxEnd = Point2d(x1 + width, y1 + height)
this.width = width
this.height = height
return this
}
fun reassign(other: Hitbox) = set(other.posX, other.posY, other.width, other.height)
fun reassign(other: Hitbox) {
set(other.posX, other.posY, other.width, other.height)
}
fun translate(x: Double, y: Double) = setPosition(posX + x, posY + y)
fun translate(vec: Vector2) = translate(vec.x, vec.y)
fun translate(x: Double, y: Double) {
setPosition(posX + x, posY + y)
}
fun translate(vec: Vector2) {
translate(vec.x, vec.y)
}
fun setPosition(x1: Double, y1: Double) {
fun setPosition(x1: Double, y1: Double): Hitbox {
hitboxStart = Point2d(x1, y1)
hitboxEnd = Point2d(x1 + width, y1 + height)
return this
}
fun setPosition(vector: Vector2) = setPosition(vector.x, vector.y)
fun setPositionX(x: Double) {
setPosition(x, posY)
}
fun setPositionX(x: Double) = setPosition(x, posY)
fun setPositionY(y: Double) = setPosition(posX, y)
fun setPositionY(y: Double) {
setPosition(posX, y)
}
fun setPositionFromPoint(x1: Double, y1: Double) {
fun setPositionFromPoint(x1: Double, y1: Double): Hitbox {
hitboxStart = Point2d(x1 - width / 2, y1 - height)
hitboxEnd = Point2d(hitboxStart.x + width, hitboxStart.y + height)
return this
}
fun setPositionXFromPoint(x: Double) {
setPositionFromPoint(x, pointedY)
}
fun setPositionYFromPoint(y: Double) {
setPositionFromPoint(pointedX, y)
}
fun translatePosX(d: Double) {
fun translatePosX(d: Double): Hitbox {
setPositionX(posX + d)
return this
}
fun translatePosY(d: Double) {
fun translatePosY(d: Double): Hitbox {
setPositionY(posY + d)
return this
}
fun setDimension(w: Double, h: Double) {
fun setDimension(w: Double, h: Double): Hitbox {
width = w
height = h
return this
}
fun snapToPixel(): Hitbox {
hitboxStart.x = Math.round(hitboxStart.x - HALF_PIXEL).toDouble()
hitboxStart.y = Math.round(hitboxStart.y - HALF_PIXEL).toDouble()
hitboxEnd.x = Math.round(hitboxEnd.x - HALF_PIXEL).toDouble()
hitboxEnd.y = Math.round(hitboxEnd.y - HALF_PIXEL).toDouble()
return this
}
/**
@@ -132,9 +128,7 @@ class Hitbox(x1: Double, y1: Double, width: Double, height: Double) {
val centeredY: Double
get() = (hitboxStart.y + hitboxEnd.y) * 0.5f
fun toVector(): Vector2 {
return Vector2(posX, posY)
}
fun toVector(): Vector2 = Vector2(posX, posY)
fun clone(): Hitbox = Hitbox(posX, posY, width, height)
}