Start documenting some classes

This commit is contained in:
NaiJi ✨ 2022-05-08 06:43:12 +03:00
parent 41541e0757
commit f1d24460a6
9 changed files with 58 additions and 10 deletions

View File

@ -8,6 +8,15 @@
namespace kku namespace kku
{ {
/// Area
///
/// Consists of 2 arithmetic
/// points that represent
/// a rectangle position
/// and 2 arithmetic
/// lengths by x and y
/// that represent
/// rectangle coverage area
template <typename T, typename = std::enable_if_t<std::is_arithmetic_v<T>>> template <typename T, typename = std::enable_if_t<std::is_arithmetic_v<T>>>
struct Area struct Area
{ {

View File

@ -5,14 +5,33 @@
namespace kku namespace kku
{ {
/// BPMSection
///
/// Data to setup and distinguish
/// a section on beatmap timeline
struct BPMSection struct BPMSection
{ {
/// Amount of beats
/// per minute in the section
unsigned int bpm = 120; // Hi, osu unsigned int bpm = 120; // Hi, osu
/// Denominator in fraction of major
/// beats. Like, 1/2, 1/3. etc...
unsigned int fraction = 2; unsigned int fraction = 2;
/// Timestamp respresenting when
/// the section becomes active
microsec offset_start = 0; microsec offset_start = 0;
/// Interval between beats
microsec interval = 0; microsec interval = 0;
}; };
/// BPMSectionComparator
///
/// Predicate to define
/// BPMSection sorting rule:
/// by timestamp of start
struct BPMSectionComparator struct BPMSectionComparator
{ {
bool operator()(const BPMSection& lhs, const BPMSection& rhs) const noexcept bool operator()(const BPMSection& lhs, const BPMSection& rhs) const noexcept
@ -21,4 +40,4 @@ struct BPMSectionComparator
} }
}; };
} }

View File

@ -3,6 +3,9 @@
namespace kku namespace kku
{ {
/// Color
///
/// Object of color data in RGBa
struct Color struct Color
{ {
unsigned char red = 0; unsigned char red = 0;
@ -11,4 +14,4 @@ struct Color
unsigned char alpha = 0; unsigned char alpha = 0;
}; };
} }

View File

@ -13,6 +13,10 @@
namespace kku namespace kku
{ {
/// CoreFactory
///
/// Provides basic
/// multimedia elements and data
class CoreFactory class CoreFactory
{ {
public: public:

View File

@ -10,6 +10,10 @@
namespace kku namespace kku
{ {
/// Editor
///
/// Functional aggregation of
/// logic for Editor game mode
class Editor class Editor
{ {
public: public:
@ -85,4 +89,4 @@ protected:
std::set<BPMSection, BPMSectionComparator> _bpm_sections; std::set<BPMSection, BPMSectionComparator> _bpm_sections;
}; };
} }

View File

@ -6,6 +6,10 @@
namespace kku namespace kku
{ {
/// Game
///
/// Functional aggregation of
/// logic for actual game mode
class Game class Game
{ {
public: public:
@ -17,4 +21,4 @@ public:
virtual void display() const = 0; virtual void display() const = 0;
}; };
} }

View File

@ -6,6 +6,9 @@
namespace kku namespace kku
{ {
/// Line
///
/// Graphical 2D line
class Line class Line
{ {
public: public:
@ -15,4 +18,4 @@ public:
virtual void display() = 0; virtual void display() = 0;
}; };
} }

View File

@ -7,6 +7,9 @@
namespace kku namespace kku
{ {
/// Music
///
/// Object for streaming music file
class Music class Music
{ {
public: public:

View File

@ -5,11 +5,10 @@
namespace kku namespace kku
{ {
/* Meaning an element of a vector space in math. /// Vector2
* Don't mistake for std::vector<T> ///
* For now we don't need it as a special class, /// Meaning an element of a vector space in math.
* so let it be a wrapper. */ /// Don't mistake for std::vector<T>
template <typename T> template <typename T>
using Vector2 = std::pair<T, T>; using Vector2 = std::pair<T, T>;