DDNet documentation
Loading...
Searching...
No Matches
key_binder.h
Go to the documentation of this file.
1/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
2/* If you are missing that file, acquire a complete release at teeworlds.com. */
3#ifndef GAME_CLIENT_COMPONENTS_KEY_BINDER_H
4#define GAME_CLIENT_COMPONENTS_KEY_BINDER_H
5
8#include <game/client/ui.h>
9
10// component to fetch keypresses, override all other input
11class CKeyBinder : public CComponent
12{
13public:
14 int Sizeof() const override { return sizeof(*this); }
15 bool OnInput(const IInput::CEvent &Event) override;
16
18 {
19 public:
22 };
23 CKeyReaderResult DoKeyReader(CButtonContainer *pReaderButton, CButtonContainer *pClearButton, const CUIRect *pRect, const CBindSlot &CurrentBind, bool Activate);
24 bool IsActive() const;
25 bool HasPendingKeyReader() const { return m_pKeyReaderId != nullptr; }
26 bool AbortPendingKey();
27
28private:
30 bool m_TakeKey = false;
31 std::optional<CBindSlot> m_Key;
32};
33
34#endif
Definition binds.h:27
Definition ui.h:269
Definition component.h:165
Definition key_binder.h:18
CBindSlot m_Bind
Definition key_binder.h:20
bool m_Aborted
Definition key_binder.h:21
Definition key_binder.h:12
const CButtonContainer * m_pKeyReaderId
Definition key_binder.h:29
bool m_TakeKey
Definition key_binder.h:30
bool AbortPendingKey()
Definition key_binder.cpp:101
CKeyReaderResult DoKeyReader(CButtonContainer *pReaderButton, CButtonContainer *pClearButton, const CUIRect *pRect, const CBindSlot &CurrentBind, bool Activate)
Definition key_binder.cpp:34
std::optional< CBindSlot > m_Key
Definition key_binder.h:31
bool IsActive() const
Definition key_binder.cpp:96
bool HasPendingKeyReader() const
Definition key_binder.h:25
bool OnInput(const IInput::CEvent &Event) override
Definition key_binder.cpp:14
int Sizeof() const override
Definition key_binder.h:14
Definition ui_rect.h:12
Definition input.h:22