-
Notifications
You must be signed in to change notification settings - Fork 2
Input
Adrian edited this page Feb 5, 2021
·
4 revisions
The input subsystem is a slightly dependent creature. It will only process input on whatever windowing context is active. If there is more than one window within your project, you must make sure to call SetAsActive
on the corresponding ZDomain instance. Take a look at the windowing wiki and the ZDomain class for more on Zenith windowing.
Querying the current cursor position is easy
glm::vec2 cursorPos = ZServices::Input()->GetCursorPosition();
You can also set the cursor position programmatically
ZServices::Input()->SetCursorPosition(glm::vec2(100.f, 100.f));
You can also query and set button and key values
if (ZServices::Input()->Key(ZKey::SPACE)) { ... }
if (ZServices::Input()->Mouse(ZMouse::RIGHT_MB)) { ... }
ZServices::Input()->SetKey(ZKey::SPACE, true);
ZServices::Input()->SetMouse(ZMouse::MB4, true);
Input abstractions for different controllers are planned for future builds.
Take a look at the ZInput interface for more.