RhythmGame 1.4.3
Loading...
Searching...
No Matches
InputAttached.h
Go to the documentation of this file.
1//
2// Created by PC on 25/09/2024.
3//
4
5#ifndef INPUT_H
6#define INPUT_H
8
9#include <QQuickItem>
10#include <qqmlintegration.h>
11
12namespace qml_components {
13
19class InputAttached : public QObject
20{
21 Q_OBJECT
22 QML_ATTACHED(InputAttached)
23
24 Q_PROPERTY(bool col11 READ col11 NOTIFY col11Changed)
25 Q_PROPERTY(bool col12 READ col12 NOTIFY col12Changed)
26 Q_PROPERTY(bool col13 READ col13 NOTIFY col13Changed)
27 Q_PROPERTY(bool col14 READ col14 NOTIFY col14Changed)
28 Q_PROPERTY(bool col15 READ col15 NOTIFY col15Changed)
29 Q_PROPERTY(bool col16 READ col16 NOTIFY col16Changed)
30 Q_PROPERTY(bool col17 READ col17 NOTIFY col17Changed)
31 Q_PROPERTY(bool col1sUp READ col1sUp NOTIFY col1sUpChanged)
32 Q_PROPERTY(bool col1sDown READ col1sDown NOTIFY col1sDownChanged)
33 Q_PROPERTY(bool col21 READ col21 NOTIFY col21Changed)
34 Q_PROPERTY(bool col22 READ col22 NOTIFY col22Changed)
35 Q_PROPERTY(bool col23 READ col23 NOTIFY col23Changed)
36 Q_PROPERTY(bool col24 READ col24 NOTIFY col24Changed)
37 Q_PROPERTY(bool col25 READ col25 NOTIFY col25Changed)
38 Q_PROPERTY(bool col26 READ col26 NOTIFY col26Changed)
39 Q_PROPERTY(bool col27 READ col27 NOTIFY col27Changed)
40 Q_PROPERTY(bool col2sUp READ col2sUp NOTIFY col2sUpChanged)
41 Q_PROPERTY(bool col2sDown READ col2sDown NOTIFY col2sDownChanged)
42 Q_PROPERTY(bool start1 READ start1 NOTIFY start1Changed)
43 Q_PROPERTY(bool select1 READ select1 NOTIFY select1Changed)
44 Q_PROPERTY(bool start2 READ start2 NOTIFY start2Changed)
45 Q_PROPERTY(bool select2 READ select2 NOTIFY select2Changed)
46
47 auto isEnabled() const -> bool;
48
49 std::array<bool, magic_enum::enum_count<input::BmsKey>()> keyStates{};
50
51 public:
52 explicit InputAttached(QObject* obj = nullptr);
53
55 static std::function<QQuickItem*()>* findCurrentScene;
56 static auto qmlAttachedProperties(QObject* object) -> InputAttached*;
57
58 signals:
59#define KEY(name) \
60 void name##Pressed(int64_t time); \
61 void name##Released(int64_t time); \
62 void name##Changed();
63
86#undef KEY
87 void buttonPressed(input::BmsKey button, int64_t time);
88 void buttonReleased(input::BmsKey button, int64_t time);
89
112
113 public:
114#define KEY(name, uppercase) \
115 auto name() const -> bool \
116 { \
117 return keyStates[static_cast<int>(input::BmsKey::uppercase)]; \
118 }
119
120 KEY(col11, Col11)
121 KEY(col12, Col12)
122 KEY(col13, Col13)
123 KEY(col14, Col14)
124 KEY(col15, Col15)
125 KEY(col16, Col16)
126 KEY(col17, Col17)
127 KEY(col1sUp, Col1sUp)
128 KEY(col21, Col21)
129 KEY(col22, Col22)
130 KEY(col23, Col23)
131 KEY(col24, Col24)
132 KEY(col25, Col25)
133 KEY(col26, Col26)
134 KEY(col27, Col27)
135 KEY(col2sUp, Col2sUp)
136 KEY(col1sDown, Col1sDown)
137 KEY(col2sDown, Col2sDown)
138 KEY(start1, Start1)
139 KEY(select1, Select1)
140 KEY(start2, Start2)
141 KEY(select2, Select2)
142#undef KEY
143};
144
145} // namespace qml_components
146
147#endif // INPUT_H
Type type
Definition BmsNotesData.cpp:33
#define KEY(name)
Definition InputAttached.h:59
Definition InputTranslator.h:178
TickType
Definition InputTranslator.h:230
The class that provides the Input attached property.
Definition InputAttached.h:20
void col13Ticked(int tickNumber, input::InputTranslator::TickType type)
bool col1sDown
Definition InputAttached.h:32
static input::InputTranslator * inputSignalProvider
Definition InputAttached.h:54
void col12Ticked(int tickNumber, input::InputTranslator::TickType type)
void col27Ticked(int tickNumber, input::InputTranslator::TickType type)
bool select1
Definition InputAttached.h:43
bool col15
Definition InputAttached.h:28
void col26Ticked(int tickNumber, input::InputTranslator::TickType type)
void col15Ticked(int tickNumber, input::InputTranslator::TickType type)
bool col22
Definition InputAttached.h:34
bool col11
Definition InputAttached.h:24
void col14Ticked(int tickNumber, input::InputTranslator::TickType type)
void col2sUpTicked(int tickNumber, input::InputTranslator::TickType type)
void col1sDownTicked(int tickNumber, input::InputTranslator::TickType type)
bool col2sUp
Definition InputAttached.h:40
bool col17
Definition InputAttached.h:30
void col1sUpTicked(int tickNumber, input::InputTranslator::TickType type)
void col22Ticked(int tickNumber, input::InputTranslator::TickType type)
bool col27
Definition InputAttached.h:39
void buttonPressed(input::BmsKey button, int64_t time)
void col17Ticked(int tickNumber, input::InputTranslator::TickType type)
bool col16
Definition InputAttached.h:29
void col23Ticked(int tickNumber, input::InputTranslator::TickType type)
void select1Ticked(int tickNumber, input::InputTranslator::TickType type)
void col2sDownTicked(int tickNumber, input::InputTranslator::TickType type)
bool col1sUp
Definition InputAttached.h:31
void col11Ticked(int tickNumber, input::InputTranslator::TickType type)
bool start2
Definition InputAttached.h:44
static std::function< QQuickItem *()> * findCurrentScene
Definition InputAttached.h:55
void select2Ticked(int tickNumber, input::InputTranslator::TickType type)
bool col25
Definition InputAttached.h:37
void start2Ticked(int tickNumber, input::InputTranslator::TickType type)
bool col23
Definition InputAttached.h:35
bool col13
Definition InputAttached.h:26
bool col12
Definition InputAttached.h:25
bool start1
Definition InputAttached.h:42
bool col14
Definition InputAttached.h:27
void col16Ticked(int tickNumber, input::InputTranslator::TickType type)
bool select2
Definition InputAttached.h:45
bool col24
Definition InputAttached.h:36
void col24Ticked(int tickNumber, input::InputTranslator::TickType type)
void start1Ticked(int tickNumber, input::InputTranslator::TickType type)
void col25Ticked(int tickNumber, input::InputTranslator::TickType type)
static auto qmlAttachedProperties(QObject *object) -> InputAttached *
Definition InputAttached.cpp:165
bool col26
Definition InputAttached.h:38
void col21Ticked(int tickNumber, input::InputTranslator::TickType type)
bool col2sDown
Definition InputAttached.h:41
bool col21
Definition InputAttached.h:33
void buttonReleased(input::BmsKey button, int64_t time)
Various input-related classes and functions.
Definition BmsKeys.h:12
BmsKey
The keys used for BMS.
Definition BmsKeys.h:20
Contains classes that wrap some functionality for use in QML.
Definition ProfileArenaIdentityProvider.h:9