Cross-platform basics on capturing the game screen to a PIL image.

This commit is contained in:
John McCardle 2021-12-19 13:02:58 -05:00
부모 64ac273833
커밋 3f9af5012c
1개의 변경된 파일24개의 추가작업 그리고 0개의 파일을 삭제

24
main.py Normal file
파일 보기

@ -0,0 +1,24 @@
import pyautogui
import os
if os.name == 'windows':
import d3dshot
class AutomatableGame:
def __init__(self):
self.loc = pyautogui.locateOnScreen("images/app.png")
def fetch_sshot(self):
return pyautogui.screenshot(region=self.loc)
def send_key(self, key):
pass
class AutomatableGame__Windows(AutomatableGame):
def __init__(self):
super().__init__(self)
self.d = d3dshot.create()
def fetch_sshot(self):
return d.screenshot() # Cut this to self.loc(x, y, w, h)