def mainLoop(self):
     fetchTrain = GetEnv(inDim=(621, 656, 684, 793), outDim=(109, 35))
     # sleep(5)
     image = fetchTrain.takeImage(1, "inverse")
     # print(len(image))
     cv2.imwrite("points.png", image)
     return self.readPoints("points.png")
class Environment:
    def __init__(self):
        self.env = GetEnv(inDim=InFrameDim,
                          outDim=(OutFrameSize, OutFrameSize))
        self.out = []
        for i in range(5):
            self.out.append(self.env.takeImage(4, "None"))
        while True:
            self.out.append(self.env.takeImage(4, "None"))
            self.out.pop(0)

    def getEnvironment(self):
        return self.out

    def step(self, action):
        print(f"action: {action}")
        if action == 0:
            pyautogui.press('left')
        elif action == 1:
            pyautogui.press('up')
        elif action == 2:
            pyautogui.press('down')
        elif action == 3:
            pyautogui.press('right')
        elif action == 4:
            pyautogui.press('enter')
        else:
            sleep(1 / 28)
class Environment:
    def __init__(self):
        self.env = GetEnv(inDim=InFrameDim,
                          outDim=(OutFrameSize, OutFrameSize))
        self.out = []
        for i in range(5):
            self.out.append(self.env.takeImage(4, "None"))
        thread = threading.Thread(target=self.run, args=())
        thread.daemon = True
        thread.start()

    def run(self):
        while True:
            self.out.append(self.env.takeImage(4, "None"))
            self.out.pop(0)

    def getEnvironment(self):
        return self.out

    def step(self, action, prev_action):
        print(f"action: {action}")
        print(f"Mouse Action: {MouseActionSpace[action[1]]}")
        upgrade = random.randrange(1, 9)
        pydirectinput.press(str(upgrade))
        pydirectinput.keyUp(ActionSpace[prev_action[0]])
        pydirectinput.keyDown(ActionSpace[action[0]])
        pydirectinput.moveTo(MouseActionSpace[action[1]][0],
                             MouseActionSpace[action[1]][1])
 def mainLoop(self, inDim, outDim):
     fetchTrain = GetEnv(inDim=inDim, outDim=outDim)
     # sleep(5)
     image = fetchTrain.takeImage(1, "inverse")
     # print(len(image))
     cv2.imwrite("points.png", image)
     return self.readPoints("points.png")
 def __init__(self):
     self.env = GetEnv(inDim=InFrameDim,
                       outDim=(OutFrameSize, OutFrameSize))
     self.out = []
     for i in range(5):
         self.out.append(self.env.takeImage(4, "None"))
     while True:
         self.out.append(self.env.takeImage(4, "None"))
         self.out.pop(0)
 def __init__(self):
     self.env = GetEnv(inDim=InFrameDim,
                       outDim=(OutFrameSize, OutFrameSize))
     self.out = []
     for i in range(5):
         self.out.append(self.env.takeImage(4, "None"))
     thread = threading.Thread(target=self.run, args=())
     thread.daemon = True
     thread.start()