From 7a93b18ec635c9d63baa3bb528791c40804d2cc2 Mon Sep 17 00:00:00 2001 From: Adam Saudagar Date: Sun, 16 May 2021 05:54:21 +0530 Subject: [PATCH] removed fullscreen config from semi fisher --- fishy/engine/common/window_server.py | 11 ++++++----- fishy/gui/config_top.py | 23 +++++++++-------------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/fishy/engine/common/window_server.py b/fishy/engine/common/window_server.py index b4bb0c7..bad4b83 100644 --- a/fishy/engine/common/window_server.py +++ b/fishy/engine/common/window_server.py @@ -25,7 +25,6 @@ class WindowServer: """ Screen = None windowOffset = None - titleOffset = None hwnd = None status = Status.STOPPED @@ -40,9 +39,6 @@ def init(): rect = win32gui.GetWindowRect(WindowServer.hwnd) client_rect = win32gui.GetClientRect(WindowServer.hwnd) WindowServer.windowOffset = math.floor(((rect[2] - rect[0]) - client_rect[2]) / 2) - WindowServer.titleOffset = ((rect[3] - rect[1]) - client_rect[3]) - WindowServer.windowOffset - if config.get("borderless"): - WindowServer.titleOffset = 0 WindowServer.status = Status.RUNNING except pywintypes.error: logging.error("Game window not found") @@ -59,8 +55,13 @@ def loop(): temp_screen = np.array(ImageGrab.grab(bbox=bbox)) rect = win32gui.GetWindowRect(WindowServer.hwnd) + client_rect = win32gui.GetClientRect(WindowServer.hwnd) + + fullscreen = GetSystemMetrics(1) == (rect[3] - rect[1]) + titleOffset = ((rect[3] - rect[1]) - client_rect[3]) - WindowServer.windowOffset if not fullscreen else 0 + crop = ( - rect[0] + WindowServer.windowOffset, rect[1] + WindowServer.titleOffset, rect[2] - WindowServer.windowOffset, + rect[0] + WindowServer.windowOffset, rect[1] + titleOffset, rect[2] - WindowServer.windowOffset, rect[3] - WindowServer.windowOffset) WindowServer.Screen = temp_screen[crop[1]:crop[3], crop[0]:crop[2]] diff --git a/fishy/gui/config_top.py b/fishy/gui/config_top.py index eb4b38d..286267b 100644 --- a/fishy/gui/config_top.py +++ b/fishy/gui/config_top.py @@ -79,7 +79,6 @@ def start_semifisher_config(gui: 'GUI'): def save(): gui.config.set("action_key", action_key_entry.get(), False) gui.config.set("collect_key", collect_key_entry.get(), False) - gui.config.set("borderless", borderless.instate(['selected']), False) gui.config.set("jitter", jitter.instate(['selected']), False) gui.config.set("sound_notification", sound.instate(['selected']), False) gui.config.save_config() @@ -111,29 +110,25 @@ def start_semifisher_config(gui: 'GUI'): gui._notify_check['state'] = tk.NORMAL gui._notify.set(is_subbed[0]) - ttk.Label(controls_frame, text="Fullscreen: ").grid(row=1, column=0, pady=(5, 5)) - borderless = ttk.Checkbutton(controls_frame, var=tk.BooleanVar(value=config.get("borderless"))) - borderless.grid(row=1, column=1) - - ttk.Label(controls_frame, text="Action Key:").grid(row=2, column=0) + ttk.Label(controls_frame, text="Action Key:").grid(row=1, column=0) action_key_entry = ttk.Entry(controls_frame, justify=tk.CENTER) - action_key_entry.grid(row=2, column=1) + action_key_entry.grid(row=1, column=1) action_key_entry.insert(0, config.get("action_key", "e")) action_key_entry.bind("", del_entry_key) - ttk.Label(controls_frame, text="Looting Key:").grid(row=4, column=0, pady=(5, 5)) + ttk.Label(controls_frame, text="Looting Key:").grid(row=3, column=0, pady=(5, 5)) collect_key_entry = ttk.Entry(controls_frame, justify=tk.CENTER) - collect_key_entry.grid(row=4, column=1, pady=(5, 5)) + collect_key_entry.grid(row=3, column=1, pady=(5, 5)) collect_key_entry.insert(0, config.get("collect_key", "r")) collect_key_entry.bind("", del_entry_key) - ttk.Label(controls_frame, text="Sound Notification: ").grid(row=5, column=0, pady=(5, 5)) + ttk.Label(controls_frame, text="Sound Notification: ").grid(row=4, column=0, pady=(5, 5)) sound = ttk.Checkbutton(controls_frame, var=tk.BooleanVar(value=config.get("sound_notification"))) - sound.grid(row=5, column=1) + sound.grid(row=4, column=1) - ttk.Label(controls_frame, text="Human-Like Delay: ").grid(row=6, column=0, pady=(5, 5)) + ttk.Label(controls_frame, text="Human-Like Delay: ").grid(row=5, column=0, pady=(5, 5)) jitter = ttk.Checkbutton(controls_frame, var=tk.BooleanVar(value=config.get("jitter"))) - jitter.grid(row=6, column=1) + jitter.grid(row=5, column=1) controls_frame.pack(padx=(5, 5), pady=(5, 5)) top.start() @@ -142,5 +137,5 @@ def start_semifisher_config(gui: 'GUI'): if __name__ == '__main__': from fishy.gui import GUI gui = GUI(lambda: IEngineHandler()) - gui.call_in_thread(lambda: start_fullfisher_config(gui)) + gui.call_in_thread(lambda: start_semifisher_config(gui)) gui.create()