-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
834f232
commit db6e8ca
Showing
8 changed files
with
205 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/java/com/projecturanus/betterp2p/client/gui/widget/Widget.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.projecturanus.betterp2p.client.gui.widget | ||
|
||
import net.minecraft.client.gui.Gui | ||
|
||
open class Widget { | ||
fun drawHorizontalLine(startX: Int, endX: Int, y: Int, color: Int) { | ||
var startX = startX | ||
var endX = endX | ||
if (endX < startX) { | ||
val i = startX | ||
startX = endX | ||
endX = i | ||
} | ||
Gui.drawRect(startX, y, endX + 1, y + 1, color) | ||
} | ||
|
||
/** | ||
* Draw a 1 pixel wide vertical line. Args : x, y1, y2, color | ||
*/ | ||
fun drawVerticalLine(x: Int, startY: Int, endY: Int, color: Int) { | ||
var startY = startY | ||
var endY = endY | ||
if (endY < startY) { | ||
val i = startY | ||
startY = endY | ||
endY = i | ||
} | ||
Gui.drawRect(x, startY + 1, x + 1, endY, color) | ||
} | ||
|
||
fun drawRectBorder(left: Int, top: Int, width: Int, height: Int, stroke: Int) { | ||
drawHorizontalLine(left, left + width, top, stroke) | ||
drawHorizontalLine(left, left + width, top + height, stroke) | ||
drawVerticalLine(left, top, top + height, stroke) | ||
drawVerticalLine(left + width, top, top + height, stroke) | ||
} | ||
} |
Oops, something went wrong.