Skip to content

Commit

Permalink
Use main menu button borders from SF version
Browse files Browse the repository at this point in the history
  • Loading branch information
SerVB committed Feb 5, 2021
1 parent 1e71860 commit e572671
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/commonMain/kotlin/com/github/servb/pph/pheroes/game/MenuView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,29 +40,26 @@ private class iMainMenuDlg : iDialog, IViewCmdHandler {
}

override fun OnCompose() {
// gApp.Surface().Darken50Rect(GetScrRect()) // commented in sources
gApp.Surface().Darken50Rect(GetScrRect())
// Compose outer frame
val rect = GetScrRect()
rect.rect.inflate(1)
val cColor_Grey = RGB16(32, 32, 32)
gApp.Surface().HLine(IPointInt(rect.x + 2, rect.y), rect.x + rect.width - 3, cColor_Grey)
gApp.Surface().HLine(IPointInt(rect.x + 2, rect.y + rect.height - 1), rect.x + rect.width - 3, cColor_Grey)
gApp.Surface().VLine(IPointInt(rect.x, rect.y + 2), rect.y + rect.height - 2, cColor_Grey)
gApp.Surface().VLine(IPointInt(rect.x + rect.width - 1, rect.y + 2), rect.y + rect.height - 2, cColor_Grey)

var props = IiDibFont.ComposeProps(
iGradient(IDibPixelPointer(menuBtnText, 0), 15),
cColor.Black.pixel,
IiDibFont.Decor.Border
)
val state = GetButtonState()

if (state and State.Disabled != 0) {
props = IiDibFont.ComposeProps(RGB16(255, 160, 80), cColor.Black.pixel, IiDibFont.Decor.Border)
} else if (state and State.Pressed != 0) {
if ((state and State.Disabled) != 0) {
props = IiDibFont.ComposeProps(RGB16(128, 100, 80), cColor.Black.pixel, IiDibFont.Decor.Border)
} else if ((state and State.Pressed) != 0) {
props = IiDibFont.ComposeProps(RGB16(255, 255, 255), cColor.Black.pixel, IiDibFont.Decor.Border)
val cColor_Grey = RGB16(32, 32, 32)
gApp.Surface().HLine(IPointInt(rect.x + 2, rect.y), rect.x + rect.width - 3, cColor_Grey)
gApp.Surface()
.HLine(IPointInt(rect.x + 2, rect.y + rect.height - 1), rect.x + rect.width - 3, cColor_Grey)
gApp.Surface().VLine(IPointInt(rect.x, rect.y + 2), rect.y + rect.height - 2, cColor_Grey)
gApp.Surface()
.VLine(IPointInt(rect.x + rect.width - 1, rect.y + 2), rect.y + rect.height - 2, cColor_Grey)
gApp.Surface().Darken50Rect(GetScrRect())
}

Expand All @@ -73,7 +70,12 @@ private class iMainMenuDlg : iDialog, IViewCmdHandler {
IPointInt(0, 0),
gTextMgr[m_TextKey],
GetScrRect(),
Alignment.AlignCenter
Alignment.AlignCenter,
if ((state and State.Pressed) != 0) {
IPointInt(1, 1)
} else {
IPointInt(0, 0)
}
)
}
}
Expand Down

0 comments on commit e572671

Please sign in to comment.