A program's handler of a window's keyboard and mouse events (see the module documentation): extend it and override the procedures wanted (the others do nothing).
Called each frame just before drawing, the scene at time t and the
camera placed (see the module documentation): e.g. to move HUD text
next to a moving object, or frames. A view following a frame moved here
follows it in this frame's drawing (its transform is taken again after);
trajectories' points changed here are drawn from the next frame (change
them in before_update).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(WindowEventHandler), | intent(inout) | :: | self | |||
| class(WindowProxy), | intent(inout) | :: | window |
the window about to draw |
||
| real(kind=wp), | intent(in) | :: | t |
simulation time |
Called each frame with its time t, before the scene is updated for it
and the camera placed (see the module documentation): to change the
data for time t (trajectories' points, frames' positions), drawn and
followed by the views in this frame.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(WindowEventHandler), | intent(inout) | :: | self | |||
| class(WindowProxy), | intent(inout) | :: | window |
the window about to update |
||
| real(kind=wp), | intent(in) | :: | t |
simulation time |
A mouse button (MOUSE_LEFT, MOUSE_MIDDLE, MOUSE_RIGHT) was pressed at (x, y) (see mouse_motion).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(WindowEventHandler), | intent(inout) | :: | self | |||
| class(WindowProxy), | intent(inout) | :: | window |
the window of the event |
||
| real(kind=wp), | intent(in) | :: | x |
-1 to 1 across the window, y up |
||
| real(kind=wp), | intent(in) | :: | y |
-1 to 1 across the window, y up |
||
| integer, | intent(in) | :: | button |
MOUSE_LEFT, MOUSE_MIDDLE or MOUSE_RIGHT |
A mouse button was released at (x, y) (see button_press).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(WindowEventHandler), | intent(inout) | :: | self | |||
| class(WindowProxy), | intent(inout) | :: | window |
the window of the event |
||
| real(kind=wp), | intent(in) | :: | x |
-1 to 1 across the window, y up |
||
| real(kind=wp), | intent(in) | :: | y |
-1 to 1 across the window, y up |
||
| integer, | intent(in) | :: | button |
as button_press's |
A handle (vkf_handles) was grabbed (DRAG_START), dragged (DRAG_MOVE: it has moved) or released (DRAG_END) with the mouse: e.g. compute again what depends on it (see the module documentation).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(WindowEventHandler), | intent(inout) | :: | self | |||
| class(WindowProxy), | intent(inout) | :: | window |
the window the handle is dragged in |
||
| class(DragHandle), | intent(inout), | target | :: | handle |
the handle (select type for its kind) |
|
| integer, | intent(in) | :: | stage |
DRAG_START, DRAG_MOVE or DRAG_END |
A key was pressed: key (a character's code, iachar('v'), or KEY_),
with the modifier keys held (MOD_ bits). Set handled (false on entry)
to skip the built-in key's action.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(WindowEventHandler), | intent(inout) | :: | self | |||
| class(WindowProxy), | intent(inout) | :: | window |
the window of the event |
||
| integer, | intent(in) | :: | key |
a character code or KEY_; MOD_ bits |
||
| integer, | intent(in) | :: | modifiers |
a character code or KEY_; MOD_ bits |
||
| logical, | intent(inout) | :: | handled |
(true: skip the built-in key) |
A key was released (see key_press).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(WindowEventHandler), | intent(inout) | :: | self | |||
| class(WindowProxy), | intent(inout) | :: | window |
the window of the event |
||
| integer, | intent(in) | :: | key |
as key_press's |
||
| integer, | intent(in) | :: | modifiers |
as key_press's |
The mouse moved to (x, y) (-1 to 1 across the window, y up), with the buttons held (left, middle, right): moving (none held, OpenFrames' mouse motion) or dragging.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(WindowEventHandler), | intent(inout) | :: | self | |||
| class(WindowProxy), | intent(inout) | :: | window |
the window of the event |
||
| real(kind=wp), | intent(in) | :: | x |
-1 to 1 across the window, y up |
||
| real(kind=wp), | intent(in) | :: | y |
-1 to 1 across the window, y up |
||
| logical, | intent(in) | :: | buttons(3) |
(held: left, middle, right) |
type, public :: WindowEventHandler contains procedure :: key_press => handler_key_press procedure :: key_release => handler_key_release procedure :: mouse_motion => handler_mouse_motion procedure :: button_press => handler_button_press procedure :: button_release => handler_button_release procedure :: before_update => handler_before_update procedure :: before_draw => handler_before_draw procedure :: handle_drag => handler_handle_drag end type WindowEventHandler