DDNet documentation
Toggle main menu visibility
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
6
#include <
game/client/component.h
>
7
#include <
game/client/components/binds.h
>
8
#include <
game/client/ui.h
>
9
10
// component to fetch keypresses, override all other input
11
class
CKeyBinder
:
public
CComponent
12
{
13
public
:
14
int
Sizeof
()
const override
{
return
sizeof
(*this); }
15
bool
OnInput
(
const
IInput::CEvent
&Event)
override
;
16
17
class
CKeyReaderResult
18
{
19
public
:
20
CBindSlot
m_Bind
;
21
bool
m_Aborted
;
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
28
private
:
29
const
CButtonContainer
*
m_pKeyReaderId
=
nullptr
;
30
bool
m_TakeKey
=
false
;
31
std::optional<CBindSlot>
m_Key
;
32
};
33
34
#endif
binds.h
CBindSlot
Definition
binds.h:27
CButtonContainer
Definition
ui.h:269
CComponent
Definition
component.h:165
CKeyBinder::CKeyReaderResult
Definition
key_binder.h:18
CKeyBinder::CKeyReaderResult::m_Bind
CBindSlot m_Bind
Definition
key_binder.h:20
CKeyBinder::CKeyReaderResult::m_Aborted
bool m_Aborted
Definition
key_binder.h:21
CKeyBinder
Definition
key_binder.h:12
CKeyBinder::m_pKeyReaderId
const CButtonContainer * m_pKeyReaderId
Definition
key_binder.h:29
CKeyBinder::m_TakeKey
bool m_TakeKey
Definition
key_binder.h:30
CKeyBinder::AbortPendingKey
bool AbortPendingKey()
Definition
key_binder.cpp:101
CKeyBinder::DoKeyReader
CKeyReaderResult DoKeyReader(CButtonContainer *pReaderButton, CButtonContainer *pClearButton, const CUIRect *pRect, const CBindSlot &CurrentBind, bool Activate)
Definition
key_binder.cpp:34
CKeyBinder::m_Key
std::optional< CBindSlot > m_Key
Definition
key_binder.h:31
CKeyBinder::IsActive
bool IsActive() const
Definition
key_binder.cpp:96
CKeyBinder::HasPendingKeyReader
bool HasPendingKeyReader() const
Definition
key_binder.h:25
CKeyBinder::OnInput
bool OnInput(const IInput::CEvent &Event) override
Definition
key_binder.cpp:14
CKeyBinder::Sizeof
int Sizeof() const override
Definition
key_binder.h:14
CUIRect
Definition
ui_rect.h:12
IInput::CEvent
Definition
input.h:22
component.h
ui.h
src
game
client
components
key_binder.h
Generated by
1.18.0