add util stream ops and print difficulty on -p

This commit is contained in:
jacekpoz 2024-04-20 12:08:55 +02:00
parent 810f81370a
commit 82929e16bf
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8
2 changed files with 77 additions and 0 deletions

View file

@ -0,0 +1,25 @@
#pragma once
#include <concepts>
#include <sstream>
#include <vector>
#include <SFML/Graphics/Color.hpp>
std::ostream &operator<<(std::ostream &stream, const sf::Color &color) {
stream << "Color(" << color.r << ", " << color.g << ", " << color.b << ", " << color.a << ")";
return stream;
}
template <typename T>
std::ostream &operator<<(std::ostream &stream, const std::vector<T> &vec) {
stream << "[";
for (size_t i = 0; i < vec.size(); ++i) {
stream << vec.at(i);
if (i != vec.size() - 1) {
stream << ", ";
}
}
stream << "]";
return stream;
}

View file

@ -2,6 +2,7 @@
#include <beatmaps.hpp>
#include <TextureManager.hpp>
#include <osuparser.hpp>
#include <util_stream_ops.hpp>
#include <iostream>
#include <filesystem>
@ -62,6 +63,57 @@ int main(int argc, char *argv[]) {
i += 1;
Difficulty diff = parseDifficulty(argv[i]);
std::cout << "osu format version: " << diff.formatVersion << "\n";
std::cout << "general.audioFilename: " << diff.general.audioFilename << "\n";
std::cout << "general.audioLeadIn: " << diff.general.audioLeadIn << "\n";
std::cout << "general.previewTime: " << diff.general.previewTime << "\n";
std::cout << "general.countdown: " << diff.general.countdown << "\n";
std::cout << "general.sampleSet: " << diff.general.sampleSet << "\n";
std::cout << "general.stackLeniency: " << diff.general.stackLeniency << "\n";
std::cout << "general.mode: " << diff.general.mode << "\n";
std::cout << "general.letterboxInBreaks: " << diff.general.letterboxInBreaks << "\n";
std::cout << "general.useSkinSprites: " << diff.general.useSkinSprites << "\n";
std::cout << "general.overlayPosition: " << diff.general.overlayPosition << "\n";
std::cout << "general.skinPreference: " << diff.general.skinPreference << "\n";
std::cout << "general.epilepsyWarning: " << diff.general.epilepsyWarning << "\n";
std::cout << "general.countdownOffset: " << diff.general.countdownOffset << "\n";
std::cout << "general.specialStyle: " << diff.general.specialStyle << "\n";
std::cout << "general.widescreenStoryboard: " << diff.general.widescreenStoryboard << "\n";
std::cout << "general.sampleMatchPlaybackRate: " << diff.general.sampleMatchPlaybackRate << "\n";
std::cout << "editor.bookmarks: " << diff.editor.bookmarks << "\n";
std::cout << "editor.distanceSpacing: " << diff.editor.distanceSpacing << "\n";
std::cout << "editor.beatDivisor: " << diff.editor.beatDivisor << "\n";
std::cout << "editor.gridSize: " << diff.editor.gridSize << "\n";
std::cout << "editor.timelineZoom: " << diff.editor.timelineZoom << "\n";
std::cout << "metadata.title: " << diff.metadata.title << "\n";
std::cout << "metadata.titleUnicode: " << diff.metadata.titleUnicode << "\n";
std::cout << "metadata.artist: " << diff.metadata.artist << "\n";
std::cout << "metadata.artistUnicode: " << diff.metadata.artistUnicode << "\n";
std::cout << "metadata.creator: " << diff.metadata.creator << "\n";
std::cout << "metadata.version: " << diff.metadata.version << "\n";
std::cout << "metadata.source: " << diff.metadata.source << "\n";
std::cout << "metadata.tags: " << diff.metadata.tags << "\n";
std::cout << "metadata.beatmapID: " << diff.metadata.beatmapID << "\n";
std::cout << "metadata.beatmapSetID: " << diff.metadata.beatmapSetID << "\n";
std::cout << "difficulty.hpDrainRate: " << diff.difficulty.hpDrainRate << "\n";
std::cout << "difficulty.circleSize: " << diff.difficulty.circleSize << "\n";
std::cout << "difficulty.overallDifficulty: " << diff.difficulty.overallDifficulty << "\n";
std::cout << "difficulty.approachRate: " << diff.difficulty.approachRate << "\n";
std::cout << "difficulty.sliderMultiplier: " << diff.difficulty.sliderMultiplier << "\n";
std::cout << "difficulty.sliderTickRate: " << diff.difficulty.sliderTickRate << "\n";
std::cout << "timingPoints: " << diff.timingPoints << "\n";
std::cout << "colours.combo: " << diff.colours.combo << "\n";
std::cout << "colours.sliderTrackOverride: " << diff.colours.sliderTrackOverride << "\n";
std::cout << "colours.sliderBorder: " << diff.colours.sliderBorder << "\n";
std::cout << "hitObjects: " << diff.hitObjects << "\n";
std::exit(EXIT_SUCCESS);
}