Added display resize event.

This commit is contained in:
Sander Schobers 2019-03-05 22:51:57 +01:00
parent ff2ece7d06
commit c08474a01c
2 changed files with 7 additions and 0 deletions

View File

@ -52,6 +52,8 @@ func (r *Renderer) PushEvents(t ui.EventTarget, wait bool) {
switch e := ev.(type) { switch e := ev.(type) {
case *allg5.DisplayCloseEvent: case *allg5.DisplayCloseEvent:
t.Handle(&ui.DisplayCloseEvent{EventBase: eventBase(e)}) t.Handle(&ui.DisplayCloseEvent{EventBase: eventBase(e)})
case *allg5.DisplayResizeEvent:
t.Handle(&ui.DisplayResizeEvent{EventBase: eventBase(e), Bounds: geom.RectF32(float32(e.X), float32(e.Y), float32(e.X+e.Width), float32(e.Y+e.Height))})
case *allg5.MouseButtonDownEvent: case *allg5.MouseButtonDownEvent:
t.Handle(&ui.MouseButtonDownEvent{MouseEvent: mouseEvent(e.MouseEvent), Button: ui.MouseButton(e.Button)}) t.Handle(&ui.MouseButtonDownEvent{MouseEvent: mouseEvent(e.MouseEvent), Button: ui.MouseButton(e.Button)})
case *allg5.MouseButtonUpEvent: case *allg5.MouseButtonUpEvent:

View File

@ -6,6 +6,11 @@ type DisplayCloseEvent struct {
EventBase EventBase
} }
type DisplayResizeEvent struct {
EventBase
Bounds geom.RectangleF32
}
type Event interface { type Event interface {
Stamp() float64 Stamp() float64
} }