Skip to content

Commit

Permalink
docs: update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
dongwlin committed Aug 14, 2024
1 parent 7d9995b commit 4387543
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ import (
"github.com/MaaXYZ/maa-framework-go"
"github.com/MaaXYZ/maa-framework-go/toolkit"
"github.com/MaaXYZ/maa-framework-go/buffer"
"image"
)

func main() {
Expand Down Expand Up @@ -112,13 +113,12 @@ func main() {

inst.BindResource(res)
inst.BindController(ctrl)

myRec := NewMyRec()
defer myRec.Destroy()
myAct := NewMyAct()
defer func() {
myRec.Destroy()
myAct.Destroy()
}()
defer myAct.Destroy()

inst.RegisterCustomRecognizer("MyRec", myRec)
inst.RegisterCustomAction("MyAct", myAct)

Expand All @@ -134,15 +134,15 @@ type MyRec struct {
maa.CustomRecognizerHandler
}

func NewMyRec() MyRec {
return MyRec{
func NewMyRec() maa.CustomRecognizer {
return &MyRec{
CustomRecognizerHandler: maa.NewCustomRecognizerHandler(),
}
}

func (MyRec) Analyze(
func (*MyRec) Analyze(
ctx maa.SyncContext,
image buffer.ImageBuffer,
image image.Image,
taskName string,
customRecognitionParam string,
) (maa.AnalyzeResult, bool) {
Expand All @@ -157,13 +157,13 @@ type MyAct struct {
maa.CustomActionHandler
}

func NewMyAct() MyAct {
return MyAct{
func NewMyAct() maa.CustomAction {
return &MyAct{
CustomActionHandler: maa.NewCustomActionHandler(),
}
}

func (MyAct) Run(
func (*MyAct) Run(
ctx maa.SyncContext,
taskName string,
customActionParam string,
Expand All @@ -173,7 +173,7 @@ func (MyAct) Run(
return true
}

func (MyAct) Stop() {
func (*MyAct) Stop() {
}
```

Expand Down

0 comments on commit 4387543

Please sign in to comment.