Skip to content

Latest commit

 

History

History
39 lines (25 loc) · 1.22 KB

File metadata and controls

39 lines (25 loc) · 1.22 KB

Component that lets entities receive input events.

Specs

Members

onKey

putils::function<void(Entity::ID window, int keycode, bool pressed), KENGINE_INPUT_FUNCTION_SIZE> onKey;

onMouseMove

putils::function<void(Entity::ID window, const putils::Point2f & screenCoordinates, const putils::Point2f & relativeMovement), KENGINE_INPUT_FUNCTION_SIZE> onMouseMove;

onMouseButton

putils::function<void(Entity::ID window, int button, const putils::Point2f & screenCoordinates, bool pressed), KENGINE_INPUT_FUNCTION_SIZE> onMouseButton;

onMouseWheel

putils::function<void(Entity::ID window, float xoffset, float yoffset, const putils::Point2f & screenCoordinates), KENGINE_INPUT_FUNCTION_SIZE)> onMouseWheel;

All these callbacks take as a first parameter the id of the window entity in which the event happened.

The maximum size for these functors defaults to 64 and can be adjusted by defining the KENGINE_INPUT_FUNCTION_SIZE macro.