@@ -8,6 +8,25 @@ import (
8
8
"github.com/Lama06/Oinky-Party/protocol"
9
9
"github.com/hajimehoshi/ebiten/v2"
10
10
"github.com/hajimehoshi/ebiten/v2/inpututil"
11
+ "image/color"
12
+ )
13
+
14
+ var (
15
+ defaultBackgroundColor = color.RGBA {R : 255 , G : 255 , B : 255 , A : 255 }
16
+ defaultButtonColors = ui.ButtonColorPalette {
17
+ BackgroundColor : color.RGBA {R : 18 , G : 53 , B : 91 , A : 255 },
18
+ BackgroundHoverColor : color.RGBA {R : 134 , G : 22 , B : 87 , A : 255 },
19
+ TextColor : color.RGBA {R : 212 , G : 245 , B : 245 , A : 255 },
20
+ TextHoverColor : color.RGBA {R : 212 , G : 245 , B : 245 , A : 255 },
21
+ }
22
+ defaultTextColors = ui.TextColorPalette {
23
+ Color : color.RGBA {R : 87 , G : 70 , B : 123 , A : 255 },
24
+ HoverColor : color.RGBA {R : 82 , G : 73 , B : 72 , A : 255 },
25
+ }
26
+ defaultTitleColors = ui.TextColorPalette {
27
+ Color : color.RGBA {R : 87 , G : 70 , B : 123 , A : 255 },
28
+ HoverColor : color.RGBA {R : 112 , G : 248 , B : 186 , A : 255 },
29
+ }
11
30
)
12
31
13
32
type screen interface {
@@ -35,21 +54,21 @@ func newTitleScreen(c *client) *titleScreen {
35
54
func (t * titleScreen ) title () * ui.Text {
36
55
width , height := ebiten .WindowSize ()
37
56
38
- return ui .NewText (ui .NewCenteredPosition (width / 2 , ( height / 3 )) , "Oinky Party" , rescources .RobotoTitleFont )
57
+ return ui .NewText (ui .NewCenteredPosition (width / 2 , height / 3 ), "Oinky Party" , defaultTitleColors , rescources .RobotoTitleFont )
39
58
}
40
59
41
60
func (t * titleScreen ) createPartyButton () * ui.Button {
42
61
width , height := ebiten .WindowSize ()
43
62
44
- return ui .NewButton (ui .NewCenteredPosition (width / 2 , (height / 3 )* 2 ), "Party erstellen" , func () {
63
+ return ui .NewButton (ui .NewCenteredPosition (width / 2 , (height / 3 )* 2 ), "Party erstellen" , defaultButtonColors , func () {
45
64
t .c .currentScreen = newCreatePartyScreen (t .c )
46
65
})
47
66
}
48
67
49
68
func (t * titleScreen ) joinPartyBtn () * ui.Button {
50
69
width , height := ebiten .WindowSize ()
51
70
52
- return ui .NewButton (ui .NewCenteredPosition (width / 2 , (height / 3 )* 2 + 100 ), "Party beitreten" , func () {
71
+ return ui .NewButton (ui .NewCenteredPosition (width / 2 , (height / 3 )* 2 + 100 ), "Party beitreten" , defaultButtonColors , func () {
53
72
t .c .currentScreen = newJoinPartyScreen (t .c )
54
73
})
55
74
}
@@ -71,6 +90,7 @@ func (t *titleScreen) Update() {
71
90
}
72
91
73
92
func (t * titleScreen ) Draw (screen * ebiten.Image ) {
93
+ screen .Fill (defaultBackgroundColor )
74
94
for _ , component := range t .content () {
75
95
component .Draw (screen )
76
96
}
@@ -105,6 +125,7 @@ func (s *gameScreen) Update() {
105
125
}
106
126
107
127
func (s * gameScreen ) Draw (screen * ebiten.Image ) {
128
+ screen .Fill (defaultBackgroundColor )
108
129
if s .c .currentGame != nil {
109
130
s .c .currentGame .Draw (screen )
110
131
}
@@ -151,13 +172,13 @@ func (j *joinPartyScreen) statusText() *ui.Text {
151
172
text = "Fehler beim Laden der Parties"
152
173
}
153
174
154
- return ui .NewText (ui .NewCenteredPosition (windowWidth / 2 , windowHeight / 2 ), text , rescources .RobotoNormalFont )
175
+ return ui .NewText (ui .NewCenteredPosition (windowWidth / 2 , windowHeight / 2 ), text , defaultTextColors , rescources .RobotoNormalFont )
155
176
}
156
177
157
178
func (j * joinPartyScreen ) title () * ui.Text {
158
179
windowWidth , windowHeight := ebiten .WindowSize ()
159
180
160
- return ui .NewText (ui .NewCenteredPosition (windowWidth / 2 , windowHeight / 3 ), "Party beitreten" , rescources .RobotoTitleFont )
181
+ return ui .NewText (ui .NewCenteredPosition (windowWidth / 2 , windowHeight / 3 ), "Party beitreten" , defaultTitleColors , rescources .RobotoTitleFont )
161
182
}
162
183
163
184
func (j * joinPartyScreen ) partiesList () []* ui.Button {
@@ -170,7 +191,7 @@ func (j *joinPartyScreen) partiesList() []*ui.Button {
170
191
partyButton := ui .NewButton (ui .NewCenteredPosition (
171
192
windowWidth / 2 ,
172
193
(windowHeight / 3 )* 2 + 100 * i ,
173
- ), fmt .Sprintf ("%s (%d Spieler)" , party .Name , len (party .Players )), func () {
194
+ ), fmt .Sprintf ("%s (%d Spieler)" , party .Name , len (party .Players )), defaultButtonColors , func () {
174
195
joinParty , err := json .Marshal (protocol.JoinPartyPacket {
175
196
PacketName : protocol .JoinPartyPacketName ,
176
197
Id : partyCopy .Id ,
@@ -210,6 +231,7 @@ func (j *joinPartyScreen) Update() {
210
231
}
211
232
212
233
func (j * joinPartyScreen ) Draw (screen * ebiten.Image ) {
234
+ screen .Fill (defaultBackgroundColor )
213
235
for _ , component := range j .content () {
214
236
component .Draw (screen )
215
237
}
@@ -256,7 +278,7 @@ func (c *createPartyScreen) partyNameText() *ui.Text {
256
278
257
279
pos := ui .NewCenteredPosition (width / 2 , height / 3 )
258
280
259
- return ui .NewText (pos , "Name der Party: " + string (c .partyName ), rescources .RobotoNormalFont )
281
+ return ui .NewText (pos , "Name der Party: " + string (c .partyName ), defaultTitleColors , rescources .RobotoTitleFont )
260
282
}
261
283
262
284
func (c * createPartyScreen ) createButton () * ui.Button {
@@ -275,7 +297,7 @@ func (c *createPartyScreen) createButton() *ui.Button {
275
297
c .c .SendPacket (createParty )
276
298
}
277
299
278
- return ui .NewButton (pos , "Party erstellen" , callback )
300
+ return ui .NewButton (pos , "Party erstellen" , defaultButtonColors , callback )
279
301
}
280
302
281
303
func (c * createPartyScreen ) Update () {
@@ -292,6 +314,7 @@ func (c *createPartyScreen) Update() {
292
314
}
293
315
294
316
func (c * createPartyScreen ) Draw (screen * ebiten.Image ) {
317
+ screen .Fill (defaultBackgroundColor )
295
318
c .partyNameText ().Draw (screen )
296
319
c .createButton ().Draw (screen )
297
320
}
@@ -313,7 +336,7 @@ func (p *partyScreen) title() *ui.Text {
313
336
314
337
pos := ui .NewCenteredPosition (width / 2 , height / 3 )
315
338
316
- return ui .NewText (pos , "Party: " + p .c .partyName , rescources .RobotoTitleFont )
339
+ return ui .NewText (pos , "Party: " + p .c .partyName , defaultTitleColors , rescources .RobotoTitleFont )
317
340
}
318
341
319
342
func (p * partyScreen ) playerList () []* ui.Text {
@@ -324,7 +347,7 @@ func (p *partyScreen) playerList() []*ui.Text {
324
347
playerList = append (playerList , ui .NewText (ui .NewCenteredPosition (
325
348
windowWidth / 2 ,
326
349
100 + windowHeight / 3 + 100 * i ,
327
- ), player .Name , rescources .RobotoNormalFont ))
350
+ ), player .Name , defaultTextColors , rescources .RobotoNormalFont ))
328
351
}
329
352
330
353
return playerList
@@ -335,7 +358,7 @@ func (p *partyScreen) startGameButton() *ui.Button {
335
358
336
359
pos := ui .NewCenteredPosition (windowWidth / 2 , windowHeight - 100 )
337
360
338
- return ui .NewButton (pos , "Spiel starten" , func () {
361
+ return ui .NewButton (pos , "Spiel starten" , defaultButtonColors , func () {
339
362
p .c .currentScreen = newStartGameScreen (p .c )
340
363
})
341
364
}
@@ -368,6 +391,7 @@ func (p *partyScreen) Update() {
368
391
}
369
392
370
393
func (p * partyScreen ) Draw (screen * ebiten.Image ) {
394
+ screen .Fill (defaultBackgroundColor )
371
395
for _ , component := range p .contents () {
372
396
component .Draw (screen )
373
397
}
@@ -390,7 +414,7 @@ func (s *startGameScreen) title() *ui.Text {
390
414
391
415
pos := ui .NewCenteredPosition (width / 2 , height / 3 )
392
416
393
- return ui .NewText (pos , "Spiel starten" , rescources .RobotoTitleFont )
417
+ return ui .NewText (pos , "Spiel starten" , defaultTextColors , rescources .RobotoTitleFont )
394
418
}
395
419
396
420
func (s * startGameScreen ) gameButtons () []* ui.Button {
@@ -411,7 +435,7 @@ func (s *startGameScreen) gameButtons() []*ui.Button {
411
435
s .c .SendPacket (startGame )
412
436
}
413
437
414
- buttons = append (buttons , ui .NewButton (pos , gameType .displayName , callback ))
438
+ buttons = append (buttons , ui .NewButton (pos , gameType .displayName , defaultButtonColors , callback ))
415
439
}
416
440
417
441
return buttons
@@ -439,6 +463,7 @@ func (s *startGameScreen) Update() {
439
463
}
440
464
441
465
func (s * startGameScreen ) Draw (screen * ebiten.Image ) {
466
+ screen .Fill (defaultBackgroundColor )
442
467
for _ , component := range s .content () {
443
468
component .Draw (screen )
444
469
}
0 commit comments