RhythmGame 1.4.3
Loading...
Searching...
No Matches
BmsGauge.h
Go to the documentation of this file.
1//
2// Created by bobini on 10.09.23.
3//
4
5#ifndef RHYTHMGAME_BMSGAUGE_H
6#define RHYTHMGAME_BMSGAUGE_H
7
9
10#include <QObject>
11#include <QVariant>
12
18namespace gameplay_logic::rules {
20{
21 Q_GADGET
22 Q_PROPERTY(int64_t offsetFromStart READ getOffsetFromStart CONSTANT)
23 Q_PROPERTY(double gauge READ getGauge CONSTANT)
24 int64_t offsetFromStart;
25 double gauge;
26
27 public:
28 GaugeHistoryEntry() = default;
30 [[nodiscard]] auto getOffsetFromStart() const -> int64_t;
31 [[nodiscard]] auto getGauge() const -> double;
32
33 friend auto operator<<(QDataStream& stream, const GaugeHistoryEntry& entry)
34 -> QDataStream&;
35 friend auto operator>>(QDataStream& stream, GaugeHistoryEntry& entry)
36 -> QDataStream&;
37};
38
39class BmsGauge : public QObject
40{
41 Q_OBJECT
42
46 Q_PROPERTY(QString name READ getName CONSTANT)
53 Q_PROPERTY(bool courseGauge READ isCourseGauge CONSTANT)
57 Q_PROPERTY(double gauge READ getGauge NOTIFY gaugeChanged)
61 Q_PROPERTY(double gaugeMax READ getGaugeMax CONSTANT)
67 Q_PROPERTY(double threshold READ getThreshold CONSTANT)
73 Q_PROPERTY(QList<gameplay_logic::rules::GaugeHistoryEntry> gaugeHistory READ
74 getGaugeHistory NOTIFY gaugeChanged)
75 QString name;
76
77 double gaugeMax;
78 double threshold = 0;
80 bool courseGauge;
81
82 BmsGauge() = default;
83
84 public:
85 explicit BmsGauge(QString name,
86 double gaugeMax,
87 double initialValue,
88 double threshold,
89 bool courseGauge,
90 QObject* parent = nullptr);
91 auto getGauge() const -> double;
92 auto getGaugeMax() const -> double;
93 // 0 for hard clear, 80 for normal clear, etc.
94 auto getThreshold() const -> double;
95 auto getGaugeHistory() const -> const QList<GaugeHistoryEntry>&;
96 virtual void addHit(std::chrono::nanoseconds offsetFromStart,
97 std::chrono::nanoseconds hitOffset,
98 Judgement judgement) = 0;
99 virtual void addMineHit(std::chrono::nanoseconds offsetFromStart,
100 double penalty) = 0;
101 auto getName() const -> QString;
102 auto isCourseGauge() const -> bool;
103
104 protected:
105 void addGaugeHistoryEntry(GaugeHistoryEntry entry);
106
107 signals:
108 void gaugeChanged();
109};
110} // namespace gameplay_logic::rules
111
112#endif // RHYTHMGAME_BMSGAUGE_H
gameplay_logic::BmsGaugeHistory::DTO gaugeHistory
Definition ScoreDb.cpp:92
Definition BmsGauge.h:40
double gauge
Definition BmsGauge.h:23
int64_t offsetFromStart
Definition BmsGauge.h:22
auto getOffsetFromStart() const -> int64_t
Definition BmsGauge.cpp:69
auto getGauge() const -> double
Definition BmsGauge.cpp:74
Judgement
The possible judgements for note hits.
Definition Judgement.h:18
Namespace for logic that affects how the game plays exactly.
Definition BmsGauge.cpp:7
Classes and functions mostly related to gameplay.
Definition ArenaGameplaySource.h:10