VISU - PHP Game Framework

WindowEventCallbackHandler
in package
implements WindowEventHandlerInterface

Table of Contents

Interfaces

WindowEventHandlerInterface

Constants

EVENT_TYPE_CHAR  = 1
EVENT_TYPE_CHAR_MODS  = 2
EVENT_TYPE_CURSOR_ENTER  = 5
EVENT_TYPE_CURSOR_POSITION  = 4
EVENT_TYPE_DROP  = 7
EVENT_TYPE_KEY  = 0
EVENT_TYPE_MOUSE_BUTTON  = 3
EVENT_TYPE_SCROLL  = 6

Properties

$eventHandlers  : array<int, array<string|int, callable>>
Registered callbacks
$eventRegistrationIndex  : int
A counter that ensures registered callbacks dont share the same ID

Methods

handleWindowChar()  : void
Window char event callback This method is invoked when a character is inputted (e.g. when typing).
handleWindowCharMods()  : void
Window char mods event callback This method is invoked when a character is inputted (e.g. when typing).
handleWindowCursorEnter()  : void
Window cursor enter event callback This method is invoked when the cursor enters or leaves the client area of the window.
handleWindowCursorPos()  : void
Window cursor position event callback This method is invoked when the cursor is moved.
handleWindowDidPollEvents()  : void
Callback after new evenets are polled This method is invoked after new events are polled think of it as a post-update method.
handleWindowDrop()  : void
Window drop event callback This method is invoked when one or more dragged files are dropped on the window.
handleWindowKey()  : void
Window key event callback This method is invoked when a key is pressed, repeated or released.
handleWindowMouseButton()  : void
Window mouse button event callback This method is invoked when a mouse button is pressed or released.
handleWindowScroll()  : void
Window scroll event callback This method is invoked when a scrolling device is used, such as a mouse wheel or scrolling area of a touchpad.
handleWindowWillPollEvents()  : void
Callback before new evenets are polled This method is invoked before new events are polled think of it as a pre-update method.
onWindowChar()  : int
Register a callback for the window char event
onWindowCharMods()  : int
Register a callback for the window char mods event
onWindowCursorEnter()  : int
Register a callback for the window cursor enter event
onWindowCursorPos()  : int
Register a callback for the window cursor position event
onWindowDrop()  : int
Register a callback for the window drop event
onWindowKey()  : int
Register a callback for the window key event
onWindowMouseButton()  : int
Register a callback for the window mouse button event
onWindowScroll()  : int
Register a callback for the window scroll event
unbindWindowCharCallback()  : void
Unregister a callback for the window char event
unbindWindowCharModsCallback()  : void
Unregister a callback for the window char mods event
unbindWindowCursorEnterCallback()  : void
Unregister a callback for the window cursor enter event
unbindWindowCursorPosCallback()  : void
Unregister a callback for the window cursor position event
unbindWindowDropCallback()  : void
Unregister a callback for the window drop event
unbindWindowKeyCallback()  : void
Unregister a callback for the window key event
unbindWindowMouseButtonCallback()  : void
Unregister a callback for the window mouse button event
unbindWindowScrollCallback()  : void
Unregister a callback for the window scroll event

Constants

Properties

$eventHandlers

Registered callbacks

private array<int, array<string|int, callable>> $eventHandlers = [self::EVENT_TYPE_KEY => [], self::EVENT_TYPE_CHAR => [], self::EVENT_TYPE_CHAR_MODS => [], self::EVENT_TYPE_MOUSE_BUTTON => [], self::EVENT_TYPE_CURSOR_POSITION => [], self::EVENT_TYPE_CURSOR_ENTER => [], self::EVENT_TYPE_DROP => []]

$eventRegistrationIndex

A counter that ensures registered callbacks dont share the same ID

private int $eventRegistrationIndex = 0

Methods

handleWindowChar()

Window char event callback This method is invoked when a character is inputted (e.g. when typing).

public handleWindowChar(Window $window, int $char) : void
Parameters
$window : Window

The window that received the event

$char : int

The Unicode code point of the character

handleWindowCharMods()

Window char mods event callback This method is invoked when a character is inputted (e.g. when typing).

public handleWindowCharMods(Window $window, int $char, int $mods) : void
Parameters
$window : Window

The window that received the event

$char : int

The Unicode code point of the character

$mods : int

Bit field describing which modifier keys were held down

handleWindowCursorEnter()

Window cursor enter event callback This method is invoked when the cursor enters or leaves the client area of the window.

public handleWindowCursorEnter(Window $window, int $entered) : void
Parameters
$window : Window

The window that received the event

$entered : int

Whether the cursor entered or left the window

handleWindowCursorPos()

Window cursor position event callback This method is invoked when the cursor is moved.

public handleWindowCursorPos(Window $window, float $xpos, float $ypos) : void
Parameters
$window : Window

The window that received the event

$xpos : float

The new x-coordinate, in screen coordinates, of the cursor

$ypos : float

The new y-coordinate, in screen coordinates, of the cursor

handleWindowDidPollEvents()

Callback after new evenets are polled This method is invoked after new events are polled think of it as a post-update method.

public handleWindowDidPollEvents(Window $window) : void
Parameters
$window : Window

The window that received the event

handleWindowDrop()

Window drop event callback This method is invoked when one or more dragged files are dropped on the window.

public handleWindowDrop(Window $window, array<string|int, string> $paths) : void
Parameters
$window : Window

The window that received the event

$paths : array<string|int, string>

The UTF-8 encoded file and/or directory path names

handleWindowKey()

Window key event callback This method is invoked when a key is pressed, repeated or released.

public handleWindowKey(Window $window, int $key, int $scancode, int $action, int $mods) : void
Parameters
$window : Window

The window that received the event

$key : int

The key that was pressed, repeated or released

$scancode : int

The system-specific scancode of the key

$action : int

The key action. One of: GLFW_PRESS, GLFW_RELEASE or GLFW_REPEAT

$mods : int

Bit field describing which modifier keys were held down

handleWindowMouseButton()

Window mouse button event callback This method is invoked when a mouse button is pressed or released.

public handleWindowMouseButton(Window $window, int $button, int $action, int $mods) : void
Parameters
$window : Window

The window that received the event

$button : int

The mouse button that was pressed or released

$action : int

The mouse button action. One of: GLFW_PRESS or GLFW_RELEASE

$mods : int

Bit field describing which modifier keys were held down

handleWindowScroll()

Window scroll event callback This method is invoked when a scrolling device is used, such as a mouse wheel or scrolling area of a touchpad.

public handleWindowScroll(Window $window, float $xoffset, float $yoffset) : void
Parameters
$window : Window

The window that received the event

$xoffset : float

The scroll offset along the x-axis

$yoffset : float

The scroll offset along the y-axis

handleWindowWillPollEvents()

Callback before new evenets are polled This method is invoked before new events are polled think of it as a pre-update method.

public handleWindowWillPollEvents(Window $window) : void
Parameters
$window : Window

The window that received the event

onWindowChar()

Register a callback for the window char event

public onWindowChar(callable $callback) : int
Parameters
$callback : callable
Return values
int

The ID of the registered callback, store this if you want to unregister the callback later

onWindowCharMods()

Register a callback for the window char mods event

public onWindowCharMods(callable $callback) : int
Parameters
$callback : callable
Return values
int

The ID of the registered callback, store this if you want to unregister the callback later

onWindowCursorEnter()

Register a callback for the window cursor enter event

public onWindowCursorEnter(callable $callback) : int
Parameters
$callback : callable
Return values
int

The ID of the registered callback, store this if you want to unregister the callback later

onWindowCursorPos()

Register a callback for the window cursor position event

public onWindowCursorPos(callable $callback) : int
Parameters
$callback : callable
Return values
int

The ID of the registered callback, store this if you want to unregister the callback later

onWindowDrop()

Register a callback for the window drop event

public onWindowDrop(callable $callback) : int
Parameters
$callback : callable
Return values
int

The ID of the registered callback, store this if you want to unregister the callback later

onWindowKey()

Register a callback for the window key event

public onWindowKey(callable $callback) : int
Parameters
$callback : callable
Return values
int

The ID of the registered callback, store this if you want to unregister the callback later

onWindowMouseButton()

Register a callback for the window mouse button event

public onWindowMouseButton(callable $callback) : int
Parameters
$callback : callable
Return values
int

The ID of the registered callback, store this if you want to unregister the callback later

onWindowScroll()

Register a callback for the window scroll event

public onWindowScroll(callable $callback) : int
Parameters
$callback : callable
Return values
int

The ID of the registered callback, store this if you want to unregister the callback later

unbindWindowCharCallback()

Unregister a callback for the window char event

public unbindWindowCharCallback(int $id) : void
Parameters
$id : int

The ID of the callback to unregister

unbindWindowCharModsCallback()

Unregister a callback for the window char mods event

public unbindWindowCharModsCallback(int $id) : void
Parameters
$id : int

The ID of the callback to unregister

unbindWindowCursorEnterCallback()

Unregister a callback for the window cursor enter event

public unbindWindowCursorEnterCallback(int $id) : void
Parameters
$id : int

The ID of the callback to unregister

unbindWindowCursorPosCallback()

Unregister a callback for the window cursor position event

public unbindWindowCursorPosCallback(int $id) : void
Parameters
$id : int

The ID of the callback to unregister

unbindWindowDropCallback()

Unregister a callback for the window drop event

public unbindWindowDropCallback(int $id) : void
Parameters
$id : int

The ID of the callback to unregister

unbindWindowKeyCallback()

Unregister a callback for the window key event

public unbindWindowKeyCallback(int $id) : void
Parameters
$id : int

The ID of the callback to unregister

unbindWindowMouseButtonCallback()

Unregister a callback for the window mouse button event

public unbindWindowMouseButtonCallback(int $id) : void
Parameters
$id : int

The ID of the callback to unregister

unbindWindowScrollCallback()

Unregister a callback for the window scroll event

public unbindWindowScrollCallback(int $id) : void
Parameters
$id : int

The ID of the callback to unregister


        
On this page

Search results