diff options
author | Simon Gagne <gags2431@usherbrooke.ca> | 2023-03-21 11:35:43 -0400 |
---|---|---|
committer | Simon Gagne <gags2431@usherbrooke.ca> | 2023-03-21 11:35:43 -0400 |
commit | 73d1b5bdda882a533767e06e75831cc5c9e552a5 (patch) | |
tree | cbe336efcf45c7bb711f84042ade103ca1921fd9 /chordNote.h | |
parent | 24975df8fe3161947f99506e05538b05c05ba3a1 (diff) | |
parent | 1d23034ac50413ed3172bad68c944faf93199dcc (diff) |
Windows compat
Diffstat (limited to 'chordNote.h')
-rw-r--r-- | chordNote.h | 57 |
1 files changed, 32 insertions, 25 deletions
diff --git a/chordNote.h b/chordNote.h index 33a7010..47ca43f 100644 --- a/chordNote.h +++ b/chordNote.h @@ -1,45 +1,52 @@ -#ifndef __CHORDNOTE_H__ -#define __CHORDNOTE_H__ - -#include <regex> +#ifndef CHORDNOTE_H +#define CHORDNOTE_H // Chords are used to represent a set of notes that are played together. // For this guitar hero implementation, a single note is technically a chord. // This analogy is used to make sure that simultaneous notes are always grouped // under a single chord since they have information in common (start/end time). +// Fret Definitions {{{ #define FRET1 0 // green #define FRET2 1 // red #define FRET3 2 // yellow #define FRET4 3 // blue #define FRET5 4 // orange - +// }}} class ChordNote { private: - bool notes[5]; // which buttons are pressed - int start; // when to play in ms (relative to song start) - int end; // when to stop playing in ms (relative to song start) - int renderStart; // when to render (no need to define on construction) - public: + const int start; // Time in Nanoseconds + const int end; // 0 if not set + bool notes[5]; // Which notes are in the chord + int renderStart; // Time in Nanoseconds // Chords are initialized with a single button. // Other notes are added as notes with the same "start" are encountered // in .chart files. - // End time is initialized to 0 but can be changed if the .chart indicates - // that the chord is held for longer than the default 1/16th note. - ChordNote(int btn, int startTime, int endTime); - ~ChordNote(); - void change(int button); // change note in existing chord - void setEnd(int endTime); // set the end time of the chord - void setRenderStart(int renderTime); // sets when to start rendering - bool* getNotes(); // get the notes in the chord - int getStart(); // get the start time of the chord - int getEnd(); // get the end time of the chord - int getRenderStart(); // get the render time of the chord - std::regex getRegex(); // regex for this chord - // compares the player's input to - // the expected chord + // End time is initialized to 0 but can be changed if the .chart file + // indicates otherwise. + public: + // Constructors, Destructors & Operators: + ChordNote(bool noteStates[5], int start, int end=0); // All known notes + ChordNote(int note, int start, int end=0); // For chartiles + ChordNote(const ChordNote& chord); // Copy constructor + ChordNote& operator=(const ChordNote& other); // Assignment operator + ~ChordNote(); // Destructor + // Getters: + bool* getNotes(); // All notes in the chord + int getStart(); // Start time of the chord + int getEnd(); // End time of the chord + int getRenderStart(); // Start time for rendering + // Setters: + void setRenderStart(int renderTime); // When it needs to start rendering + // Modifiers: + bool toggle(int note); // Add/remove a note in a chord + void merge(ChordNote chord); // Merge two chords (OR on every note) + // Misc: + bool has(int note); // check if a note is in the chord + void print(); // For debugging }; //#include "chordNote.cpp" -#endif // __CHORDNOTE_H__ +#endif // CHORDNOTE_H +// vim: syntax=cpp.doxygen |