| 46 | } |
| 47 | |
| 48 | MaaController* MaaWin32ControllerCreate( |
| 49 | void* hWnd, |
| 50 | MaaWin32ScreencapMethod screencap_method, |
| 51 | MaaWin32InputMethod mouse_method, |
| 52 | MaaWin32InputMethod keyboard_method) |
| 53 | { |
| 54 | LogFunc << VAR_VOIDP(hWnd) << VAR(screencap_method) << VAR(mouse_method) << VAR(keyboard_method); |
| 55 | |
| 56 | #ifndef _WIN32 |
| 57 | |
| 58 | LogError << "This API " << __FUNCTION__ << " is only available on Windows"; |
| 59 | return nullptr; |
| 60 | |
| 61 | #else |
| 62 | |
| 63 | if (!hWnd) { |
| 64 | LogWarn << "hWnd is nullptr"; |
| 65 | } |
| 66 | |
| 67 | auto control_unit = MAA_NS::Win32ControlUnitLibraryHolder::create_control_unit(hWnd, screencap_method, mouse_method, keyboard_method); |
| 68 | |
| 69 | if (!control_unit) { |
| 70 | LogError << "Failed to create control unit"; |
| 71 | return nullptr; |
| 72 | } |
| 73 | |
| 74 | return new MAA_CTRL_NS::ControllerAgent(std::move(control_unit)); |
| 75 | #endif |
| 76 | } |
| 77 | |
| 78 | MaaController* MaaMacOSControllerCreate(uint32_t window_id, MaaMacOSScreencapMethod screencap_method, MaaMacOSInputMethod input_method) |
| 79 | { |