g3n / engine

Go 3D Game Engine (http://g3n.rocks)
https://discord.gg/NfaeVr8zDg
BSD 2-Clause "Simplified" License
2.74k stars 292 forks source link

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

Open lanjiajie1 opened 1 year ago

lanjiajie1 commented 1 year ago

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

gamerscomplete commented 1 year ago

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.

lanjiajie1 commented 1 year ago

要检测何时单击鼠标右键,请在按下鼠标时使用订阅。右键单击是按钮 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