MCPcopy Create free account
hub / github.com/MaaXYZ/MaaFramework / MaaWin32ControllerCreate

Function MaaWin32ControllerCreate

source/MaaFramework/API/MaaFramework.cpp:48–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48MaaController* 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
78MaaController* MaaMacOSControllerCreate(uint32_t window_id, MaaMacOSScreencapMethod screencap_method, MaaMacOSInputMethod input_method)
79{

Callers 4

create_win32_controllerFunction · 0.50
ctorMethod · 0.50
runMethod · 0.50
mainFunction · 0.50

Calls 1

moveFunction · 0.85

Tested by 1

mainFunction · 0.40