g3n/engine

The newly added content will be overwritten. Right click function?

lanjiajie1 opened this issue · 2 comments

The newly added content will be overwritten. Right click function?

To detect when the right mouse button is clicked use subscribe on mouse down. Right click is button 1

app.SubscribeID(window.OnMouseDown, a, func(evname string, ev interface{}) {
    if me, found := ev.(*window.MouseEvent); found {
        if me.Button = 1 {
            fmt.Println("RIght mouse clicked")
        }
    }
})

You can see it being used here https://github.com/g3n/g3nd/blob/master/demos/other/raycast.go#L160

If you need help with G3N you should join the discord as there is more people to help there.

要检测何时单击鼠标右键,请在按下鼠标时使用订阅。右键单击是按钮 1

app.SubscribeID(window.OnMouseDown, a, func(evname string, ev interface{}) {
    if me, found := ev.(*window.MouseEvent); found {
        if me.Button = 1 {
            fmt.Println("RIght mouse clicked")
        }
    }
})

你可以在这里看到它被使用https://github.com/g3n/g3nd/blob/master/demos/other/raycast.go#L160

如果你需要 G3N 的帮助,你应该加入 discord,因为那里有更多的人可以提供帮助。

This is not the problem. Panel coverage has been resolved. Thank you