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