Split loading screen into four screens.
Added set loading screen function in the ProotState class.
This commit is contained in:
parent
4f37c94c22
commit
e95c47855b
4 changed files with 32 additions and 17 deletions
BIN
faces/ProotScreen1.png
Normal file
BIN
faces/ProotScreen1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1 KiB |
BIN
faces/ProotScreen2.png
Normal file
BIN
faces/ProotScreen2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 1 KiB After Width: | Height: | Size: 1 KiB |
|
@ -39,6 +39,8 @@ class ProotState:
|
|||
cls._instance.current_blink_state = 0
|
||||
cls._instance.desired_blink_state = 0
|
||||
cls._instance.blinks_frames_ready = False
|
||||
cls._instance.loading_screen = True
|
||||
cls._instance.loading_time = True
|
||||
return cls._instance
|
||||
|
||||
def next_blink_frame_number(self) -> int:
|
||||
|
@ -70,7 +72,31 @@ class ProotState:
|
|||
|
||||
def get_blinks_frames_ready(self) -> bool:
|
||||
return self.blinks_frames_ready
|
||||
|
||||
|
||||
def set_ProotScreen(self, matrix):
|
||||
self.loading_time += 1
|
||||
self.loading_time = self.loading_time % 90
|
||||
if not self.image_prootScreen1:
|
||||
self.image_prootScreen1 = matrix.CreateFrameCanvas()
|
||||
image_prootScreen = Image.open("faces/ProotScreen1.png").convert('RGB')
|
||||
self.image_prootScreen1.SetImage(image_prootScreen)
|
||||
matrix.SwapOnVSync(self.image_prootScreen1)
|
||||
if not self.image_prootScreen2:
|
||||
self.image_prootScreen2 = matrix.CreateFrameCanvas()
|
||||
image_prootScreen = Image.open("faces/ProotScreen2.png").convert('RGB')
|
||||
self.image_prootScreen2.SetImage(image_prootScreen)
|
||||
if not self.image_prootScreen3:
|
||||
self.image_prootScreen3 = matrix.CreateFrameCanvas()
|
||||
image_prootScreen = Image.open("faces/ProotScreen3.png").convert('RGB')
|
||||
self.image_prootScreen3.SetImage(image_prootScreen)
|
||||
|
||||
if self.loading_time < 30:
|
||||
matrix.SwapOnVSync(self.image_prootScreen1)
|
||||
elif self.loading_time < 60:
|
||||
matrix.SwapOnVSync(self.image_prootScreen2)
|
||||
else:
|
||||
matrix.SwapOnVSync(self.image_prootScreen3)
|
||||
|
||||
|
||||
class Point2D:
|
||||
x = 0
|
||||
|
@ -101,12 +127,7 @@ class Point2D:
|
|||
return (self.x, self.y) == (other.x, other.y)
|
||||
|
||||
|
||||
def set_ProotScreen(matrix):
|
||||
prootScreen_frame_canvas = matrix.CreateFrameCanvas()
|
||||
image_prootScreen = Image.open("faces/ProotScreen.png").convert('RGB')
|
||||
prootScreen_frame_canvas.SetImage(image_prootScreen)
|
||||
prootScreen_frame_canvas.brightness = 100
|
||||
matrix.SwapOnVSync(prootScreen_frame_canvas)
|
||||
|
||||
|
||||
|
||||
def mirror_points(points: list[Point2D]) -> list[Point2D]:
|
||||
|
@ -202,13 +223,16 @@ def interpolate_point_pairs(pairs: list[tuple[Point2D, Point2D]], percentage: fl
|
|||
|
||||
|
||||
def update_screen():
|
||||
# TODO move blinking animation logic to the ProotState class
|
||||
global blinkFrameCanvases, matrix
|
||||
|
||||
proot_state = ProotState()
|
||||
|
||||
if proot_state.get_blinks_frames_ready():
|
||||
# TODO move blinking animation writing logic to the ProotState class
|
||||
matrix.SwapOnVSync(blinkFrameCanvases[proot_state.next_blink_frame_number()])
|
||||
else:
|
||||
proot_state.set_ProotScreen(matrix)
|
||||
|
||||
|
||||
|
||||
def interrupt_timer():
|
||||
|
@ -236,15 +260,6 @@ screen_update_thread = threading.Thread(target=random_blinks)
|
|||
screen_update_thread.start()
|
||||
|
||||
|
||||
print("start setting ProotScreen")
|
||||
startT = curr_time = round(time.time()*1000)
|
||||
# setting ProotScreen, This is the loading splash screen
|
||||
set_ProotScreen(matrix)
|
||||
|
||||
endT = curr_time = round(time.time()*1000)
|
||||
print("setting ProotScreen took: " + str(endT - startT) + " ms")
|
||||
|
||||
|
||||
print("start loading images")
|
||||
startT = curr_time = round(time.time()*1000)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue