-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoption.go
58 lines (47 loc) · 1.64 KB
/
option.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package maa
import (
"unsafe"
"github.com/MaaXYZ/maa-framework-go/internal/maa"
)
func setGlobalOption(key maa.MaaGlobalOption, value unsafe.Pointer, valSize uintptr) bool {
return maa.MaaSetGlobalOption(key, value, uint64(valSize))
}
// SetLogDir sets the log directory.
func SetLogDir(path string) bool {
if path == "" {
return false
}
return setGlobalOption(maa.MaaGlobalOption_LogDir, unsafe.Pointer(&[]byte(path)[0]), uintptr(len(path)))
}
// SetSaveDraw sets whether to save draw.
func SetSaveDraw(enabled bool) bool {
return setGlobalOption(maa.MaaGlobalOption_SaveDraw, unsafe.Pointer(&enabled), unsafe.Sizeof(enabled))
}
// SetRecording sets whether to dump all screenshots and actions.
func SetRecording(enabled bool) bool {
return setGlobalOption(maa.MaaGlobalOption_Recording, unsafe.Pointer(&enabled), unsafe.Sizeof(enabled))
}
type LoggingLevel int32
// LoggingLevel
const (
LoggingLevelOff LoggingLevel = iota
LoggingLevelFatal
LoggingLevelError
LoggingLevelWarn
LoggingLevelInfo
LoggingLevelDebug
LoggingLevelTrace
LoggingLevelAll
)
// SetStdoutLevel sets the level of log output to stdout.
func SetStdoutLevel(level LoggingLevel) bool {
return setGlobalOption(maa.MaaGlobalOption_StdoutLevel, unsafe.Pointer(&level), unsafe.Sizeof(level))
}
// SetShowHitDraw sets whether to show hit draw.
func SetShowHitDraw(enabled bool) bool {
return setGlobalOption(maa.MaaGlobalOption_ShowHitDraw, unsafe.Pointer(&enabled), unsafe.Sizeof(enabled))
}
// SetDebugMode sets whether to enable debug mode.
func SetDebugMode(enabled bool) bool {
return setGlobalOption(maa.MaaGlobalOption_DebugMode, unsafe.Pointer(&enabled), unsafe.Sizeof(enabled))
}