2019-03-05 20:52:18 +00:00
|
|
|
package ui
|
|
|
|
|
|
|
|
import "opslag.de/schobers/geom"
|
|
|
|
|
|
|
|
type DisplayCloseEvent struct {
|
|
|
|
EventBase
|
|
|
|
}
|
|
|
|
|
2019-03-05 21:51:57 +00:00
|
|
|
type DisplayResizeEvent struct {
|
|
|
|
EventBase
|
|
|
|
Bounds geom.RectangleF32
|
|
|
|
}
|
|
|
|
|
2019-03-05 20:52:18 +00:00
|
|
|
type Event interface {
|
|
|
|
Stamp() float64
|
|
|
|
}
|
|
|
|
|
|
|
|
type EventBase struct {
|
|
|
|
StampInSeconds float64
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *EventBase) Stamp() float64 {
|
|
|
|
return e.StampInSeconds
|
|
|
|
}
|
|
|
|
|
|
|
|
type MouseButton int
|
|
|
|
|
|
|
|
const (
|
|
|
|
MouseButtonLeft MouseButton = 1
|
|
|
|
MouseButtonRight MouseButton = 2
|
|
|
|
MouseButtonMiddle MouseButton = 3
|
|
|
|
)
|
|
|
|
|
|
|
|
type MouseButtonDownEvent struct {
|
|
|
|
MouseEvent
|
|
|
|
Button MouseButton
|
|
|
|
}
|
|
|
|
|
|
|
|
type MouseButtonUpEvent struct {
|
|
|
|
MouseEvent
|
|
|
|
Button MouseButton
|
|
|
|
}
|
|
|
|
|
|
|
|
type MouseEvent struct {
|
|
|
|
EventBase
|
|
|
|
X, Y float32
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *MouseEvent) Pos() geom.PointF32 {
|
|
|
|
return geom.PtF32(e.X, e.Y)
|
|
|
|
}
|
|
|
|
|
|
|
|
type MouseMoveEvent struct {
|
|
|
|
MouseEvent
|
2019-03-05 21:42:57 +00:00
|
|
|
MouseWheel float32
|
2019-03-05 20:52:18 +00:00
|
|
|
}
|