osuplusplus/include/config_def.hpp

208 lines
5 KiB
C++

#ifndef CONFIG
#define CONFIG_DEFINED
#define CONFIG(name, ...)
#define SECTION(name, ...)
#define UINT
#define VAR_UINT(section, name)
#define VAR_UINT_D(section, name, default)
#define INT
#define VAR_INT(section, name)
#define VAR_INT_D(section, name, default)
#define STRING
#define VAR_STRING(section, name)
#define VAR_STRING_D(section, name, default)
#define BOOL
#define VAR_BOOL(section, name)
#define VAR_BOOL_D(section, name, default)
#define FLOAT
#define VAR_FLOAT(section, name)
#define VAR_FLOAT_D(section, name, default)
#define COLOUR
#define VAR_COLOUR(section, name)
#define VAR_COLOUR_D(section, name, default)
#define ENUM(name, ...)
#define VAR_ENUM(section, name, enum_type)
#define VAR_ENUM_D(section, name, enum_type, default)
#define STRUCT_STREAM_OPS(name, ...)
#define STRUCT(name, ...)
#define VAR_STRUCT(section, name, struct_type)
#define VAR_STRUCT_D(section, name, struct_type, default)
#define VAR_LIST(section, name, type)
#define VAR_LIST_SEP(section, name, type, sep)
#define VAR_LIST_NUMBERED(section, name, type)
#endif // CONFIG
ENUM(Countdown,
NONE,
NORMAL,
HALF,
DOUBLE
)
ENUM(SampleSet,
DEFAULT,
NORMAL,
SOFT,
DRUM
)
ENUM(Mode,
STANDARD,
TAIKO,
CATCH,
MANIA
)
ENUM(OverlayPosition,
NO_CHANGE,
BELOW,
ABOVE
)
STRUCT(TimingPoint,
VAR_UINT(, time)
VAR_FLOAT(, beatLength)
VAR_UINT(, meter)
VAR_ENUM(, sampleSet, SampleSet)
VAR_UINT(, sampleIndex)
VAR_UINT(, volume)
VAR_BOOL(, uninherited)
VAR_UINT(, effects)
)
STRUCT_STREAM_OPS(TimingPoint, time, beatLength, meter, sampleSet, sampleIndex, volume, uninherited, effects)
STRUCT(HitObjectType,
VAR_UINT(, hitCircle)
VAR_UINT(, slider)
VAR_UINT(, newCombo)
VAR_UINT(, spinner)
VAR_UINT(, colourHax)
VAR_UINT(, holdNote)
)
STRUCT_STREAM_OPS(HitObjectType, hitCircle, slider, newCombo, spinner, colourHax, holdNote)
STRUCT(HitSound,
VAR_UINT(, normal)
VAR_UINT(, whistle)
VAR_UINT(, finish)
VAR_UINT(, clap)
)
STRUCT_STREAM_OPS(HitSound, normal, whistle, finish, clap)
STRUCT(HitObject,
VAR_INT(, x)
VAR_INT(, y)
VAR_INT(, time)
VAR_STRUCT(, type, HitObjectType)
VAR_STRUCT(, hitSound ,HitSound)
)
STRUCT_STREAM_OPS(HitObject, x, y, time, type, hitSound)
// https://osu.ppy.sh/wiki/en/Client/File_formats/osu_%28file_format%29
CONFIG(Difficulty,
VAR_UINT(, formatVersion)
SECTION(general,
VAR_STRING(.general, audioFilename)
VAR_UINT_D(.general, audioLeadIn, 0)
VAR_INT_D(.general, previewTime, -1)
VAR_ENUM_D(.general, countdown, Countdown, NORMAL)
VAR_ENUM_D(.general, sampleSet, SampleSet, NORMAL)
VAR_FLOAT_D(.general, stackLeniency, 0.7)
VAR_ENUM_D(.general, mode, Mode, STANDARD)
VAR_BOOL_D(.general, letterboxInBreaks, false)
VAR_BOOL_D(.general, useSkinSprites, false)
VAR_ENUM_D(.general, overlayPosition, OverlayPosition, NO_CHANGE)
VAR_STRING(.general, skinPreference)
VAR_BOOL_D(.general, epilepsyWarning, false)
VAR_UINT_D(.general, countdownOffset, 0)
VAR_BOOL_D(.general, specialStyle, false)
VAR_BOOL_D(.general, widescreenStoryboard, false)
VAR_BOOL_D(.general, sampleMatchPlaybackRate, false)
)
SECTION(editor,
VAR_LIST_SEP(.editor, bookmarks, uint, ",")
VAR_FLOAT(.editor, distanceSpacing)
VAR_UINT(.editor, beatDivisor)
VAR_UINT(.editor, gridSize)
VAR_FLOAT(.editor, timelineZoom)
)
SECTION(metadata,
VAR_STRING(.metadata, title)
VAR_STRING(.metadata, titleUnicode)
VAR_STRING(.metadata, artist)
VAR_STRING(.metadata, artistUnicode)
VAR_STRING(.metadata, creator)
VAR_STRING(.metadata, version)
VAR_STRING(.metadata, source)
VAR_LIST_SEP(.metadata, tags, std::string, " ")
VAR_UINT(.metadata, beatmapID)
VAR_UINT(.metadata, beatmapSetID)
)
SECTION(difficulty,
VAR_FLOAT(.difficulty, hpDrainRate)
VAR_FLOAT(.difficulty, circleSize)
VAR_FLOAT(.difficulty, overallDifficulty)
VAR_FLOAT(.difficulty, approachRate)
VAR_FLOAT(.difficulty, sliderMultiplier)
VAR_FLOAT(.difficulty, sliderTickRate)
)
VAR_LIST(, timingPoints, TimingPoint)
SECTION(colours,
VAR_LIST_NUMBERED(.colours, combo, sf::Color)
VAR_COLOUR(.colours, sliderTrackOverride)
VAR_COLOUR(.colours, sliderBorder)
)
VAR_LIST(, hitObjects, HitObject)
)
#ifdef CONFIG_DEFINED
#undef CONFIG
#undef SECTION
#undef UINT
#undef VAR_UINT
#undef VAR_UINT_D
#undef INT
#undef VAR_INT
#undef VAR_INT_D
#undef STRING
#undef VAR_STRING
#undef VAR_STRING_D
#undef BOOL
#undef VAR_BOOL
#undef VAR_BOOL_D
#undef FLOAT
#undef VAR_FLOAT
#undef VAR_FLOAT_D
#undef COLOUR
#undef VAR_COLOUR
#undef VAR_COLOUR_D
#undef ENUM
#undef VAR_ENUM
#undef VAR_ENUM_D
#undef STRUCT
#undef VAR_STRUCT
#undef VAR_STRUCT_D
#undef VAR_LIST
#undef VAR_LIST_SEP
#undef VAR_LIST_NUMBERED
#endif // CONFIG_DEFINED