Added todo's.

Added color definition to the Point2D class.
This commit is contained in:
CiscoTheWolf 2023-05-23 20:35:58 +02:00
parent 5180c414b7
commit 49ee35b55f

View file

@ -30,10 +30,12 @@ class ProotState:
class Point2D:
x = 0
y = 0
color:tuple[int, int, int] = (0, 0, 0)
def __init__(self, x, y):
def __init__(self, x, y, color: tuple[int, int, int] = (0, 0, 0)):
self.x = x
self.y = y
self.color = color
def round(self):
self.x = round(self.x)
@ -169,6 +171,7 @@ print("start loading images")
startT = curr_time = round(time.time()*1000)
# Loading all images
# TODO looking into storing and loading lists of points
image_left_eye_open = Image.open("faces/eyeLeftOpen.png")
image_left_eye_closed = Image.open("faces/eyeLeftClosed.png")
image_left_nose = Image.open("faces/noseLeft.png")
@ -183,6 +186,7 @@ print("start generating pixel array")
startT = curr_time = round(time.time()*1000)
# generate pixel arrays from each image
# TODO ^ storing and loading lists of points will take away this step. (it will require a dedicated script to precompute these)
points_left_eye_open = generate_point_array_from_image(image_left_eye_open)
points_left_eye_closed = generate_point_array_from_image(image_left_eye_closed)
points_left_nose = generate_point_array_from_image(image_left_nose)
@ -199,6 +203,7 @@ print("start pairing points for one eye")
startT = curr_time = round(time.time()*1000)
#calculate the point pairs between the open and closed left eye
# TODO look into precomputing and storing these animations before runtime
left_eye_blink_pairs = pair_points(points_left_eye_open, points_left_eye_closed)
endT = curr_time = round(time.time()*1000)
@ -214,6 +219,7 @@ blinkFrameCanvases = []
print("start populating matrices for each blink frame")
startT = curr_time = round(time.time()*1000)
# TODO look into the possibility of precomputing and more importantly storing the matrix objects
for alpha in range(0,11):
offscreen_interpolated_canvas = matrix.CreateFrameCanvas()
@ -231,20 +237,8 @@ endT = curr_time = round(time.time()*1000)
print("populating matrices for each blink frame took: " + str(endT - startT) + " ms")
def move_option(current_option: int, desired_option: int) -> int:
if current_option == desired_option:
return current_option
if current_option < desired_option:
current_option += 1
else:
current_option -= 1
return current_option
def update_screen():
# TODO move blinking animation logic to the ProotState class
global DesiredBlinkState, currentBlinkState, blinkFrameCanvases, matrix
# open eye again after blink