-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSceneSplash.py
More file actions
60 lines (50 loc) · 2.66 KB
/
SceneSplash.py
File metadata and controls
60 lines (50 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Splash scene - first scene the user sees
from typing import List, Optional, Any
import pygame
import pygwidgets
import pyghelpers
from BaseScene import BaseScene
from Constants import *
class SceneSplash(BaseScene):
def __init__(self, window: pygame.Surface):
super().__init__(window)
self._background_image = pygwidgets.Image(self.window, (0, 0), 'images/splashBackground.jpg')
self._dodger_image = pygwidgets.Image(self.window, (150, 30), 'images/dodger.png')
self._start_button = pygwidgets.CustomButton(self.window, (250, 500),
up='images/startNormal.png',
down='images/startDown.png',
over='images/startOver.png',
disabled='images/startDisabled.png',
enterToActivate=True)
self._quit_button = pygwidgets.CustomButton(self.window, (30, 650),
up='images/quitNormal.png',
down='images/quitDown.png',
over='images/quitOver.png',
disabled='images/quitDisabled.png')
self._high_scores_button = pygwidgets.CustomButton(self.window, (360, 650),
up='images/gotoHighScoresNormal.png',
down='images/gotoHighScoresDown.png',
over='images/gotoHighScoresOver.png',
disabled='images/gotoHighScoresDisabled.png')
def getSceneKey(self) -> str:
return SCENE_SPLASH
def enter(self, data: Optional[Any] = None) -> None:
pass
def handleInputs(self, eventsList: List[pygame.event.Event], keyPressedList: List[int]) -> None:
for event in eventsList:
if self._start_button.handleEvent(event):
self.goToScene(SCENE_PLAY)
elif self._quit_button.handleEvent(event):
self.quit()
elif self._high_scores_button.handleEvent(event):
self.goToScene(SCENE_HIGH_SCORES)
def update(self) -> None:
pass
def draw(self) -> None:
self._background_image.draw()
self._dodger_image.draw()
self._start_button.draw()
self._quit_button.draw()
self._high_scores_button.draw()
def leave(self) -> Optional[Any]:
return None