func processKeyboard(message *scratch.ScratchMessage) { switch message.SecondaryCommand { case keyCode: bte, err := message.GetInt32() if err == nil { osimpl.SendKeycode(uint8(bte)) } case keyString: str, err := message.GetString() if err == nil { osimpl.SendKeyboardString(str) } } }
func processMouse(message *scratch.ScratchMessage) { switch message.SecondaryCommand { case mouseMove: x, err := message.GetInt32() if err != nil { return } y, err := message.GetInt32() if err != nil { return } osimpl.MoveMouse(int(x), int(y)) case mouseLeft: osimpl.LeftClick() case mouseRight: osimpl.RightClick() case leftDown: osimpl.LeftDown() case leftUp: osimpl.LeftUp() case rightDown: osimpl.RightDown() case rightUp: osimpl.RightUp() case middleDown: osimpl.MiddleDown() case middleUp: osimpl.MiddleUp() case scrollDown: osimpl.ScrollDown() case scrollUp: osimpl.ScrollUp() } }