added async stone detection thread
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
from copy import copy
|
|
||||||
|
|
||||||
import cv2 as cv
|
import cv2 as cv
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from game_base_class import GameBase
|
from game_base_class import GameBase
|
||||||
@@ -11,6 +9,7 @@ from litris_stone_id_thread import NewStoneID
|
|||||||
from window_capture import WindowCapture
|
from window_capture import WindowCapture
|
||||||
from vision import Vision
|
from vision import Vision
|
||||||
from config_file import UserConfigs
|
from config_file import UserConfigs
|
||||||
|
|
||||||
class Litris(GameBase):
|
class Litris(GameBase):
|
||||||
|
|
||||||
def __init__(self, overlay):
|
def __init__(self, overlay):
|
||||||
@@ -37,7 +36,7 @@ class Litris(GameBase):
|
|||||||
|
|
||||||
self.litris_reset_board = cv.imread("control_elements/sodoku_reset_button.jpg", cv.IMREAD_COLOR)
|
self.litris_reset_board = cv.imread("control_elements/sodoku_reset_button.jpg", cv.IMREAD_COLOR)
|
||||||
|
|
||||||
self.stone_id_thread = NewStoneID()
|
self.stone_id_thread = NewStoneID(self.capture_window)
|
||||||
|
|
||||||
self.move_mode = 1
|
self.move_mode = 1
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ Z_FULL = [[0, 0, 0, 0], [0, 1, 1, 0], [0, 0, 1, 1], [0, 0, 0, 0]]
|
|||||||
T_FULL = [[0, 0, 0, 0], [0, 1, 1, 1], [0, 0, 1, 0], [0, 0, 0, 0]]
|
T_FULL = [[0, 0, 0, 0], [0, 1, 1, 1], [0, 0, 1, 0], [0, 0, 0, 0]]
|
||||||
class NewStoneID(threading.Thread):
|
class NewStoneID(threading.Thread):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, cap_win):
|
||||||
threading.Thread.__init__(self)
|
threading.Thread.__init__(self)
|
||||||
|
|
||||||
self.config = UserConfigs()
|
#self.config = UserConfigs()
|
||||||
self.capture_window = WindowCapture(None, None, self.config)
|
self.capture_window = cap_win
|
||||||
self.vision_stun = Vision()
|
self.vision_stun = Vision()
|
||||||
|
|
||||||
self.stone_coordinates = np.zeros((4, 4), dtype=object)
|
self.stone_coordinates = np.zeros((4, 4), dtype=object)
|
||||||
|
|||||||
Reference in New Issue
Block a user