Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions includes/RhythmGameUtilities/Enums/Difficulty.h
Original file line number Diff line number Diff line change
@@ -1,19 +1,40 @@
#pragma once

#include <string>

namespace RhythmGameUtilities
{

enum Difficulty
{

// Easy Difficulty
Easy,

// Medium Difficulty
Medium,

// Hard Difficulty
Hard,

// Expert Difficulty
Expert

};

std::string ToString(Difficulty difficulty)
{
switch (difficulty)
{
case Easy:
return "Easy";
case Medium:
return "Medium";
case Hard:
return "Hard";
case Expert:
return "Expert";
}
}

} // namespace RhythmGameUtilities
36 changes: 20 additions & 16 deletions includes/RhythmGameUtilities/Enums/NamedSection.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,29 @@
namespace RhythmGameUtilities
{

namespace NamedSection
enum NamedSection
{
typedef std::string Type;
/// Song information
Song,

/// <summary>
/// Song information
/// </summary>
Type Song = "Song";
/// Track information used for syncing with music and notes like BPM
SyncTrack,

/// <summary>
/// Track information used for syncing with music and notes like BPM
/// </summary>
Type SyncTrack = "SyncTrack";
/// Track events
Events
};

/// <summary>
/// Track events
/// </summary>
Type Events = "Events";

}; // namespace NamedSection
std::string ToString(NamedSection namedSection)
{
switch (namedSection)
{
case Song:
return "Song";
case SyncTrack:
return "SyncTrack";
case Events:
return "Events";
}
}

} // namespace RhythmGameUtilities
44 changes: 25 additions & 19 deletions includes/RhythmGameUtilities/Enums/TypeCode.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,36 @@
namespace RhythmGameUtilities
{

namespace TypeCode
enum TypeCode
{
typedef std::string Type;

/// <summary>
/// BPM Marker
/// </summary>
Type BPM = "B";
/// BPM Marker
BPM,

/// <summary>
/// Time Signature Marker
/// </summary>
Type TimeSignature = "TS";
/// Time Signature Marker
TimeSignature,

/// <summary>
/// Note Marker
/// </summary>
Type Note = "N";
/// Note Marker
Note,

/// <summary>
/// Event Marker
/// </summary>
Type Event = "E";
/// Event Marker
Event

} // namespace TypeCode
};

std::string ToString(TypeCode typeCode)
{
switch (typeCode)
{
case BPM:
return "B";
case TimeSignature:
return "TS";
case Note:
return "N";
case Event:
return "E";
}
}

} // namespace RhythmGameUtilities
46 changes: 46 additions & 0 deletions tests/RhythmGameUtilities/Enum.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#include <cassert>
#include <iostream>

#include "RhythmGameUtilities/Enums/Difficulty.h"
#include "RhythmGameUtilities/Enums/NamedSection.h"
#include "RhythmGameUtilities/Enums/TypeCode.h"

using namespace RhythmGameUtilities;

void testDifficulty()
{
assert(ToString(Difficulty::Easy) == "Easy");
assert(ToString(Difficulty::Medium) == "Medium");
assert(ToString(Difficulty::Hard) == "Hard");
assert(ToString(Difficulty::Expert) == "Expert");

std::cout << ".";
}

void testNamedSection()
{
assert(ToString(NamedSection::Song) == "Song");
assert(ToString(NamedSection::SyncTrack) == "SyncTrack");
assert(ToString(NamedSection::Events) == "Events");

std::cout << ".";
}

void testTypeCode()
{
assert(ToString(TypeCode::BPM) == "B");
assert(ToString(TypeCode::TimeSignature) == "TS");
assert(ToString(TypeCode::Note) == "N");
assert(ToString(TypeCode::Event) == "E");

std::cout << ".";
}

int main()
{
testDifficulty();
testNamedSection();
testTypeCode();

return 0;
}