1
0
mirror of synced 2025-02-02 12:27:20 +01:00

Fix compiler warnings

This commit is contained in:
Stepland 2020-03-02 14:29:14 +01:00
parent 4ed188ea70
commit 123cd50acd
9 changed files with 27 additions and 33 deletions

View File

@ -14,7 +14,7 @@
// #include "Screens/Gameplay.hpp"
// #include "Screens/Result.hpp"
int main(int argc, char const *argv[]) {
int main(int, char const **) {
Data::Preferences preferences;
auto markers = Resources::load_markers();

View File

@ -9,6 +9,8 @@
#include <cereal/archives/json.hpp>
namespace fs = ghc::filesystem;
namespace Resources {
Marker::Marker(const fs::path& marker_folder) :
@ -184,21 +186,25 @@ namespace Resources {
Markers load_markers() {
Markers res;
for (auto& p : fs::directory_iterator("markers")) {
if (p.is_directory()) {
try {
Marker m{p.path()};
res.emplace(m.m_metadata.name, m);
} catch (const std::exception& e) {
std::cerr << "Unable to load marker folder "
<< p.path().string() << " : "
<< e.what() << std::endl;
if (fs::exists(fs::path("markers"))) {
for (auto& p : fs::directory_iterator("markers")) {
if (p.is_directory()) {
try {
Marker m{p.path()};
res.emplace(m.m_metadata.name, m);
} catch (const std::exception& e) {
std::cerr << "Unable to load marker folder "
<< p.path().string() << " : "
<< e.what() << std::endl;
}
}
}
}
/*
if (res.empty()) {
throw std::runtime_error("No markers found in marker folder, jujube needs at least one to operate");
}
*/
return res;
}
}

View File

@ -7,17 +7,7 @@
#include <ghc/filesystem.hpp>
#include <SFML/Graphics.hpp>
namespace fs = ghc::filesystem;
template <class Archive>
std::string save_minimal(const Archive &, ghc::filesystem::path& p) {
return p.string();
}
template <class Archive>
void load_minimal(const Archive &, ghc::filesystem::path& p, const std::string& value) {
p = fs::path{value};
}
#include "../Toolkit/ExtraCerealTypes/GHCFilesystemPath.hpp"
namespace Resources {
enum class MarkerAnimation {
@ -75,7 +65,7 @@ namespace Resources {
};
struct Marker {
Marker(const fs::path& marker_folder);
Marker(const ghc::filesystem::path& marker_folder);
std::optional<sf::Sprite> get_sprite(const MarkerAnimation& state, const float& seconds);
std::optional<sf::Sprite> get_sprite(const MarkerAnimation& state, const std::size_t frame);
void load_and_check(sf::Texture& spritesheet, const MarkerAnimationMetadata& metadata);

View File

@ -101,7 +101,7 @@ void MusicSelect::Screen::handle_key_press(const sf::Event::KeyEvent& key_event)
}
}
void MusicSelect::Screen::handle_mouse_click(const sf::Event::MouseButtonEvent& mouse_button_event) {
void MusicSelect::Screen::handle_mouse_click(const sf::Event::MouseButtonEvent& /*mouse_button_event*/) {
/*
if (mouse_button_event.button == sf::Mouse::Left) {
int clicked_panel_index = (mouse_button_event.x / m_panel_size) + 4 * (mouse_button_event.y / m_panel_size);

View File

@ -47,7 +47,6 @@ namespace MusicSelect {
static_cast<unsigned int>(get_size()*0.1f)
};
category_label.setFillColor(sf::Color::White);
auto bounds = category_label.getLocalBounds();
category_label.setPosition(get_size()*0.1f, get_size()*0.1f);
target.draw(category_label, states);
@ -66,7 +65,7 @@ namespace MusicSelect {
target.draw(label_text, states);
}
void SongPanel::click(MusicSelectRibbon& ribbon, const Data::Button& button) {
void SongPanel::click(Ribbon&, const Data::Button&) {
if (selected_chart.has_value()) {
// The song was already selected : look for the next chart in order
auto it = m_song->chart_levels.upper_bound(*selected_chart);

View File

@ -30,15 +30,15 @@ namespace MusicSelect {
class EmptyPanel final : public Panel {
public:
using Panel::Panel;
void click(Ribbon& ribbon, const Data::Button& button) override {return;};
void click(Ribbon&, const Data::Button&) override {return;};
private:
void draw(sf::RenderTarget& target, sf::RenderStates states) const override {return;};
void draw(sf::RenderTarget&, sf::RenderStates) const override {return;};
};
class ColoredMessagePanel final : public Panel {
public:
ColoredMessagePanel(SharedResources& resources, const sf::Color& color, const std::string& message) : Panel(resources), m_color(color), m_message(message) {};
void click(Ribbon& ribbon, const Data::Button& button) override {return;};
void click(Ribbon&, const Data::Button&) override {return;};
private:
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
const sf::Color m_color;
@ -48,7 +48,7 @@ namespace MusicSelect {
class ColorPanel final : public Panel {
public:
ColorPanel(SharedResources& resources, const sf::Color& t_color) : Panel(resources), m_color(t_color) {};
void click(Ribbon& ribbon, const Data::Button& button) override {return;};
void click(Ribbon&, const Data::Button&) override {return;};
private:
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
const sf::Color m_color;

View File

@ -117,7 +117,7 @@ namespace MusicSelect {
column.begin(),
column.end(),
[](jbcoe::polymorphic_value<Panel> panel) -> bool {
return (std::dynamic_pointer_cast<CategoryPanel>(panel).get() != nullptr);
return dynamic_cast<CategoryPanel*>(&*panel) != nullptr;
}
)) {
found = true;

View File

@ -91,7 +91,6 @@ namespace MusicSelect {
song_title_label.setScale(m_big_cover.get_size() / song_title_bounds.width, 1.0f);
}
song_title_label.setFillColor(sf::Color::White);
auto cover_pos = m_big_cover.getPosition();
song_title_label.setPosition(
get_big_cover_x() - m_big_cover.get_size()/2.f,
get_big_cover_y() + m_big_cover.get_size() + 0.01f*get_screen_width()
@ -114,7 +113,6 @@ namespace MusicSelect {
}
song_artist_label.setFillColor(sf::Color::White);
song_artist_label.setFillColor(sf::Color::White);
auto cover_pos = m_big_cover.getPosition();
song_artist_label.setPosition(
get_big_cover_x() - m_big_cover.get_size()/2.f,
get_big_cover_y() + m_big_cover.get_size() + 0.04f*get_screen_width()

View File

@ -107,7 +107,8 @@ namespace Toolkit {
G = C.g/255.0;
B = C.b/255.0;
///Casos no triviales.
double max, min, l, s;
double max, min, l;
double s = 0;
///Maximos
max = std::max(std::max(R,G),B);