new ui elements for timing

This commit is contained in:
2022-10-19 00:25:59 +02:00
parent 1992c549c1
commit 90ff452e10
4 changed files with 34 additions and 23 deletions

View File

@@ -5,6 +5,7 @@ import numpy as np
from window_capture import WindowCapture
from vision import Vision
from config_file import UserConfigs
from time import time
GREEN = 1
YELLOW = 2
@@ -49,6 +50,10 @@ class GameBase:
self.reset_counter = 0
self.stop_time = overlay.global_timeout_use.get()
self.breaks = overlay.hourly_breaks_use.get()
self.break_time = overlay.break_duration_use.get()
# initialize the user-class
self.config = UserConfigs()
# initialize the StunWindowCapture class
@@ -56,6 +61,33 @@ class GameBase:
# initialize the StunVision class
self.vision_stun = Vision()
def execute_main_loop(self):
start_time = time()
breaks = []
#breaks.append(7)
for i in range(1, int(self.breaks) + 1, 1):
avr_in_sec = int(self.stop_time) * 60 * 60 / int(self.breaks)
breaks.append(random.randint(i * avr_in_sec * 0.60, i * avr_in_sec))
while True:
if (time() - start_time) > float(self.stop_time) * 60 * 60:
self.overlay.run_mode = 'stopped'
for break_ in breaks:
elapsed = int(time() - start_time)
if elapsed > break_:
cv.waitKey(random.randint(1, 3) *60*1000)
breaks.remove(break_)
if self.overlay.run_mode == 'paused':
cv.waitKey(1)
continue
elif self.overlay.run_mode == 'stopped':
break
self.assess_playfield_and_make_move()
cv.waitKey(500)
def assess_playfield_and_make_move(self):
pass
def fill_data_coordinates(self):
# 230 to 2110 = 1883 / 14 = 134.5
# 60 to 1130 = 1076 / 8 = 134.5