Skip to content

Commit 6031177

Browse files
committed
add new label textbutton style and fix issue that some text buttons refer to a label style instead of a text button style
1 parent 505425f commit 6031177

File tree

8 files changed

+52
-24
lines changed

8 files changed

+52
-24
lines changed

assets/ui/ui.atlas

+31-15
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,60 @@ filter: Nearest,Nearest
66
repeat: none
77
font11_gradient
88
rotate: false
9-
xy: 1, 124
9+
xy: 1, 121
1010
size: 128, 128
1111
orig: 128, 128
1212
offset: 0, 0
1313
index: -1
1414
font8
1515
rotate: false
16-
xy: 1, 58
16+
xy: 1, 55
1717
size: 128, 64
1818
orig: 128, 64
1919
offset: 0, 0
2020
index: -1
2121
frame
2222
rotate: false
23-
xy: 1, 12
23+
xy: 131, 220
2424
size: 20, 20
2525
split: 7, 7, 7, 7
2626
orig: 20, 20
2727
offset: 0, 0
2828
index: -1
2929
frame_transparent
3030
rotate: false
31-
xy: 131, 223
31+
xy: 23, 9
3232
size: 20, 20
3333
split: 7, 7, 7, 7
3434
orig: 20, 20
3535
offset: 0, 0
3636
index: -1
3737
game_hud
3838
rotate: false
39-
xy: 1, 34
39+
xy: 1, 31
4040
size: 126, 22
4141
orig: 126, 22
4242
offset: 0, 0
4343
index: -1
44+
label_frame
45+
rotate: false
46+
xy: 1, 9
47+
size: 20, 20
48+
split: 7, 7, 7, 7
49+
orig: 20, 20
50+
offset: 0, 0
51+
index: -1
52+
label_frame_transparent
53+
rotate: false
54+
xy: 131, 198
55+
size: 20, 20
56+
split: 7, 7, 7, 7
57+
orig: 20, 20
58+
offset: 0, 0
59+
index: -1
4460
life_bar
4561
rotate: false
46-
xy: 195, 246
62+
xy: 195, 243
4763
size: 22, 6
4864
split: 2, 2, 2, 2
4965
pad: 0, 0, 0, 0
@@ -52,50 +68,50 @@ life_bar
5268
index: -1
5369
no_sound
5470
rotate: false
55-
xy: 1, 1
71+
xy: 131, 187
5672
size: 11, 9
5773
orig: 11, 9
5874
offset: 0, 0
5975
index: -1
6076
pause
6177
rotate: false
62-
xy: 138, 214
78+
xy: 45, 11
6379
size: 6, 7
6480
orig: 6, 7
6581
offset: 0, 0
6682
index: -1
6783
play
6884
rotate: false
69-
xy: 131, 188
85+
xy: 153, 207
7086
size: 5, 9
7187
orig: 5, 9
7288
offset: 0, 0
7389
index: -1
7490
quit
7591
rotate: false
76-
xy: 23, 16
92+
xy: 160, 232
7793
size: 8, 8
7894
orig: 8, 8
7995
offset: 0, 0
8096
index: -1
8197
scroll_knob
8298
rotate: false
83-
xy: 219, 247
99+
xy: 219, 244
84100
size: 5, 5
85101
orig: 5, 5
86102
offset: 0, 0
87103
index: -1
88104
scroll_v
89105
rotate: false
90-
xy: 131, 199
106+
xy: 153, 218
91107
size: 5, 22
92108
split: 0, 0, 8, 9
93109
orig: 5, 22
94110
offset: 0, 0
95111
index: -1
96112
shield_bar
97113
rotate: false
98-
xy: 23, 26
114+
xy: 1, 1
99115
size: 22, 6
100116
split: 2, 2, 2, 2
101117
pad: 0, 0, 0, 0
@@ -104,14 +120,14 @@ shield_bar
104120
index: -1
105121
sound
106122
rotate: false
107-
xy: 153, 234
123+
xy: 45, 20
108124
size: 11, 9
109125
orig: 11, 9
110126
offset: 0, 0
111127
index: -1
112128
warning
113129
rotate: false
114-
xy: 131, 245
130+
xy: 131, 242
115131
size: 62, 7
116132
orig: 62, 7
117133
offset: 0, 0

assets/ui/ui.png

191 Bytes
Loading

core/src/main/kotlin/com/github/quillraven/darkmatter/screen/LoadingScreen.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class LoadingScreen(
103103
progressBar = image(SkinImage.LIFE_BAR.atlasKey).apply {
104104
scaleX = 0f
105105
}
106-
progressText = textButton(bundle["loading"], SkinTextButton.TRANSPARENT.name)
106+
progressText = textButton(bundle["loading"], SkinTextButton.LABEL_TRANSPARENT.name)
107107
cell.padLeft(ELEMENT_PADDING).padRight(ELEMENT_PADDING).padBottom(ELEMENT_PADDING)
108108
}
109109

core/src/main/kotlin/com/github/quillraven/darkmatter/ui/GameOverUI.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@ class GameOverUI(private val bundle: I18NBundle) {
3636
}
3737
row()
3838

39-
lastScoreButton = textButton(bundle["score", 0], SkinLabel.DEFAULT.name) {
39+
lastScoreButton = textButton(bundle["score", 0], SkinTextButton.LABEL.name) {
4040
label.wrap = true
4141
}
4242
row()
4343

44-
highScoreButton = textButton(bundle["highscore", 0], SkinLabel.DEFAULT.name) {
44+
highScoreButton = textButton(bundle["highscore", 0], SkinTextButton.LABEL.name) {
4545
label.wrap = true
4646
}
4747
row()
4848

49-
backButton = textButton(bundle["backToMenu"], SkinLabel.DEFAULT.name) {
49+
backButton = textButton(bundle["backToMenu"], SkinTextButton.DEFAULT.name) {
5050
label.wrap = true
5151
}
5252
row()

core/src/main/kotlin/com/github/quillraven/darkmatter/ui/MenuUI.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,17 @@ class MenuUI(private val bundle: I18NBundle) {
5454
}
5555
row()
5656

57-
highScoreButton = textButton(bundle["highscore", 0], SkinLabel.DEFAULT.name) {
57+
highScoreButton = textButton(bundle["highscore", 0], SkinTextButton.LABEL.name) {
5858
label.wrap = true
5959
}
6060
row()
6161

62-
creditsButton = textButton(bundle["credit"], SkinLabel.DEFAULT.name) {
62+
creditsButton = textButton(bundle["credit"], SkinTextButton.DEFAULT.name) {
6363
label.wrap = true
6464
}
6565
row()
6666

67-
quitGameButton = textButton(bundle["quitGame"], SkinLabel.DEFAULT.name) {
67+
quitGameButton = textButton(bundle["quitGame"], SkinTextButton.DEFAULT.name) {
6868
label.wrap = true
6969
}
7070

core/src/main/kotlin/com/github/quillraven/darkmatter/ui/skin.kt

+14-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ enum class SkinImageButton {
2222
}
2323

2424
enum class SkinTextButton {
25-
DEFAULT, TRANSPARENT
25+
DEFAULT, TRANSPARENT, LABEL, LABEL_TRANSPARENT
2626
}
2727

2828
enum class SkinWindow {
@@ -46,7 +46,9 @@ enum class SkinImage(val atlasKey: String) {
4646
SOUND_ON("sound"),
4747
SOUND_OFF("no_sound"),
4848
SCROLL_V("scroll_v"),
49-
SCROLL_KNOB("scroll_knob")
49+
SCROLL_KNOB("scroll_knob"),
50+
FRAME_LABEL("label_frame"),
51+
FRAME_LABEL_TRANSPARENT("label_frame_transparent")
5052
}
5153

5254
fun createSkin(assets: AssetStorage) {
@@ -93,6 +95,16 @@ private fun Skin.createTextButtonStyles(
9395
up = skin.getDrawable(SkinImage.FRAME_TRANSPARENT.atlasKey)
9496
down = up
9597
}
98+
textButton(SkinTextButton.LABEL.name) {
99+
font = defaultFont
100+
up = skin.getDrawable(SkinImage.FRAME_LABEL.atlasKey)
101+
down = up
102+
}
103+
textButton(SkinTextButton.LABEL_TRANSPARENT.name) {
104+
font = defaultFont
105+
up = skin.getDrawable(SkinImage.FRAME_LABEL_TRANSPARENT.atlasKey)
106+
down = up
107+
}
96108
}
97109

98110
private fun Skin.createImageButtonStyles(skin: Skin) {

raw/ui/label_frame.9.png

273 Bytes
Loading

raw/ui/label_frame_transparent.9.png

273 Bytes
Loading

0 commit comments

Comments
 (0)