Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Latest commit

 

History

History
38 lines (24 loc) · 1.11 KB

说明.md

File metadata and controls

38 lines (24 loc) · 1.11 KB
  • 说明

    • 记录按键、鼠标事件macro.py

      def callback(event):
          global raw_data
      
          if type(event) == winput.MouseEvent:
              # 如果是鼠标左键点击事件,记录周围64x64像素图片
              if event.action == winput.WM_LBUTTONDOWN:
                  beg_x = max(0,event.position[0] - GLOBAL_HALF_W)
                  beg_y = max(0,event.position[1] - GLOBAL_HALF_H)
                  img = pyautogui.screenshot(region=[beg_x, beg_y, GLOBAL_W, GLOBAL_H])
                  event.additional_data = np.asarray(img)
          raw_data.append((perf_counter_ns(), event))
    • 处理raw_data生成宏 macro.py

      def from_raw_data(name, start_time, start_mouse_pos, screen_width, screen_height, raw_data):
          event_executor_list = []
          ...
          pass
    • 宏序列化、反序列化为二进制数据 Macro.from_bytes、Macro.to_bytes

    • 宏序列化、反序列化为JSON数据 Macro.from_json、Macro.to_json

    • 鼠标点击事件的图像匹配 MouseButtonPressEvent.execute MouseButtonPressEvent.get_mouse_position