IsMouseEvent boolean on all current mouse events
This commit is contained in:
parent
9d436db917
commit
c624cc08cd
|
@ -27,6 +27,7 @@ type State struct {
|
|||
keydown map[string]interface{}
|
||||
|
||||
// Cursor position
|
||||
IsMouseEvent bool // A mouse event this tick
|
||||
CursorX int
|
||||
CursorY int
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ func (r *Renderer) Poll() (*event.State, error) {
|
|||
// Reset some events.
|
||||
s.WindowResized = false
|
||||
s.Touching = false
|
||||
s.IsMouseEvent = false
|
||||
|
||||
// helper function to push keyboard key names on keyDown events only.
|
||||
pushKey := func(name string, state uint8) {
|
||||
|
@ -56,6 +57,7 @@ func (r *Renderer) Poll() (*event.State, error) {
|
|||
t.Timestamp, sdl.GetTicks(), t.Type, t.Which, t.X, t.Y, t.XRel, t.YRel,
|
||||
)
|
||||
}
|
||||
s.IsMouseEvent = true
|
||||
|
||||
// Push the cursor position.
|
||||
s.CursorX = int(t.X)
|
||||
|
@ -66,6 +68,7 @@ func (r *Renderer) Poll() (*event.State, error) {
|
|||
t.Timestamp, sdl.GetTicks(), t.Type, t.Which, t.X, t.Y, t.Button, t.State,
|
||||
)
|
||||
}
|
||||
s.IsMouseEvent = true
|
||||
|
||||
// Push the cursor position.
|
||||
s.CursorX = int(t.X)
|
||||
|
@ -108,6 +111,7 @@ func (r *Renderer) Poll() (*event.State, error) {
|
|||
t.Timestamp, sdl.GetTicks(), t.Type, t.Which, t.X, t.Y,
|
||||
)
|
||||
}
|
||||
s.IsMouseEvent = true
|
||||
case *sdl.TouchFingerEvent:
|
||||
if DebugTouchEvents {
|
||||
fmt.Printf("[%d ms] tick:%d TouchFinger type:%d Finger=%d TouchID=%+v Pressure=%f XY=%f,%f\n",
|
||||
|
|
Loading…
Reference in New Issue
Block a user