Skip to content

Commit

Permalink
chore: Rect to replace RectBuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
dongwlin committed Jul 4, 2024
1 parent 8b2e033 commit 6c5e014
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions custom_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
// Implementers of this interface must embed an CustomActionHandler struct
// and provide implementations for the Run and Stop methods.
type CustomActionImpl interface {
Run(ctx SyncContext, taskName, ActionParam string, curBox RectBuffer, curRecDetail string) bool
Run(ctx SyncContext, taskName, ActionParam string, curBox Rect, curRecDetail string) bool
Stop()

Handle() unsafe.Pointer
Expand Down Expand Up @@ -56,11 +56,12 @@ func _RunAgent(
actionArg C.MaaTransparentArg,
) C.uint8_t {
act := *(*CustomActionImpl)(unsafe.Pointer(actionArg))
curBoxRectBuffer := rectBuffer{handle: curBox}
ok := act.Run(
SyncContext{handle: ctx},
C.GoString(taskName),
C.GoString(customActionParam),
&rectBuffer{handle: curBox},
curBoxRectBuffer.Get(),
C.GoString(curRecDetail),
)
if ok {
Expand Down
2 changes: 1 addition & 1 deletion run_without_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type MyAct struct {
CustomActionHandler
}

func (act MyAct) Run(ctx SyncContext, taskName, ActionParam string, curBox RectBuffer, curRecDetail string) bool {
func (act MyAct) Run(ctx SyncContext, taskName, ActionParam string, curBox Rect, curRecDetail string) bool {
image, ok := ctx.Screencap()
defer image.Destroy()
if !ok {
Expand Down

0 comments on commit 6c5e014

Please sign in to comment.