Skip to content

Latest commit

 

History

History
74 lines (55 loc) · 1.45 KB

File metadata and controls

74 lines (55 loc) · 1.45 KB

Component that lets entities receive input events.

Specs

Members

EventVector type

template<typename T>
using EventVector = putils::vector<T, KENGINE_INPUT_MAX_BUFFERED_EVENTS>;

This template container is used for all event buffers. The maximum number of events of each type defaults to 128 and can be modified by defining the KENGINE_INPUT_MAX_BUFFERED_EVENTS macro.

keys

struct KeyEvent {
    Entity::ID window;
    int key;
    bool pressed;
};
EventVector<KeyEvent> keys;

Key events for the current frame.

clicks

struct ClickEvent {
    Entity::ID window;
    putils::Point2f pos;
    int button;
    bool pressed;
};
EventVector<ClickEvent> clicks;

Click events for the current frame.

moves

struct MouseMoveEvent {
    Entity::ID window;
    putils::Point2f pos;
    putils::Point2f rel;
};
EventVector<MouseMoveEvent> moves;

Mouse move events for the current frame.

scrolls

struct MouseScrollEvent {
    Entity::ID window;
    float xoffset;
    float yoffset;
    putils::Point2f pos;
};
EventVector<MouseScrollEvent> scrolls;

Mouse scroll events for the current frame.