Fix compiler warnings
This commit is contained in:
parent
4ed188ea70
commit
123cd50acd
@ -14,7 +14,7 @@
|
|||||||
// #include "Screens/Gameplay.hpp"
|
// #include "Screens/Gameplay.hpp"
|
||||||
// #include "Screens/Result.hpp"
|
// #include "Screens/Result.hpp"
|
||||||
|
|
||||||
int main(int argc, char const *argv[]) {
|
int main(int, char const **) {
|
||||||
|
|
||||||
Data::Preferences preferences;
|
Data::Preferences preferences;
|
||||||
auto markers = Resources::load_markers();
|
auto markers = Resources::load_markers();
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
|
|
||||||
#include <cereal/archives/json.hpp>
|
#include <cereal/archives/json.hpp>
|
||||||
|
|
||||||
|
namespace fs = ghc::filesystem;
|
||||||
|
|
||||||
namespace Resources {
|
namespace Resources {
|
||||||
|
|
||||||
Marker::Marker(const fs::path& marker_folder) :
|
Marker::Marker(const fs::path& marker_folder) :
|
||||||
@ -184,6 +186,7 @@ namespace Resources {
|
|||||||
|
|
||||||
Markers load_markers() {
|
Markers load_markers() {
|
||||||
Markers res;
|
Markers res;
|
||||||
|
if (fs::exists(fs::path("markers"))) {
|
||||||
for (auto& p : fs::directory_iterator("markers")) {
|
for (auto& p : fs::directory_iterator("markers")) {
|
||||||
if (p.is_directory()) {
|
if (p.is_directory()) {
|
||||||
try {
|
try {
|
||||||
@ -196,9 +199,12 @@ namespace Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
if (res.empty()) {
|
if (res.empty()) {
|
||||||
throw std::runtime_error("No markers found in marker folder, jujube needs at least one to operate");
|
throw std::runtime_error("No markers found in marker folder, jujube needs at least one to operate");
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,17 +7,7 @@
|
|||||||
#include <ghc/filesystem.hpp>
|
#include <ghc/filesystem.hpp>
|
||||||
#include <SFML/Graphics.hpp>
|
#include <SFML/Graphics.hpp>
|
||||||
|
|
||||||
namespace fs = ghc::filesystem;
|
#include "../Toolkit/ExtraCerealTypes/GHCFilesystemPath.hpp"
|
||||||
|
|
||||||
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};
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Resources {
|
namespace Resources {
|
||||||
enum class MarkerAnimation {
|
enum class MarkerAnimation {
|
||||||
@ -75,7 +65,7 @@ namespace Resources {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Marker {
|
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 float& seconds);
|
||||||
std::optional<sf::Sprite> get_sprite(const MarkerAnimation& state, const std::size_t frame);
|
std::optional<sf::Sprite> get_sprite(const MarkerAnimation& state, const std::size_t frame);
|
||||||
void load_and_check(sf::Texture& spritesheet, const MarkerAnimationMetadata& metadata);
|
void load_and_check(sf::Texture& spritesheet, const MarkerAnimationMetadata& metadata);
|
||||||
|
@ -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) {
|
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);
|
int clicked_panel_index = (mouse_button_event.x / m_panel_size) + 4 * (mouse_button_event.y / m_panel_size);
|
||||||
|
@ -47,7 +47,6 @@ namespace MusicSelect {
|
|||||||
static_cast<unsigned int>(get_size()*0.1f)
|
static_cast<unsigned int>(get_size()*0.1f)
|
||||||
};
|
};
|
||||||
category_label.setFillColor(sf::Color::White);
|
category_label.setFillColor(sf::Color::White);
|
||||||
auto bounds = category_label.getLocalBounds();
|
|
||||||
category_label.setPosition(get_size()*0.1f, get_size()*0.1f);
|
category_label.setPosition(get_size()*0.1f, get_size()*0.1f);
|
||||||
target.draw(category_label, states);
|
target.draw(category_label, states);
|
||||||
|
|
||||||
@ -66,7 +65,7 @@ namespace MusicSelect {
|
|||||||
target.draw(label_text, states);
|
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()) {
|
if (selected_chart.has_value()) {
|
||||||
// The song was already selected : look for the next chart in order
|
// The song was already selected : look for the next chart in order
|
||||||
auto it = m_song->chart_levels.upper_bound(*selected_chart);
|
auto it = m_song->chart_levels.upper_bound(*selected_chart);
|
||||||
|
@ -30,15 +30,15 @@ namespace MusicSelect {
|
|||||||
class EmptyPanel final : public Panel {
|
class EmptyPanel final : public Panel {
|
||||||
public:
|
public:
|
||||||
using Panel::Panel;
|
using Panel::Panel;
|
||||||
void click(Ribbon& ribbon, const Data::Button& button) override {return;};
|
void click(Ribbon&, const Data::Button&) override {return;};
|
||||||
private:
|
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 {
|
class ColoredMessagePanel final : public Panel {
|
||||||
public:
|
public:
|
||||||
ColoredMessagePanel(SharedResources& resources, const sf::Color& color, const std::string& message) : Panel(resources), m_color(color), m_message(message) {};
|
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:
|
private:
|
||||||
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
|
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
|
||||||
const sf::Color m_color;
|
const sf::Color m_color;
|
||||||
@ -48,7 +48,7 @@ namespace MusicSelect {
|
|||||||
class ColorPanel final : public Panel {
|
class ColorPanel final : public Panel {
|
||||||
public:
|
public:
|
||||||
ColorPanel(SharedResources& resources, const sf::Color& t_color) : Panel(resources), m_color(t_color) {};
|
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:
|
private:
|
||||||
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
|
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
|
||||||
const sf::Color m_color;
|
const sf::Color m_color;
|
||||||
|
@ -117,7 +117,7 @@ namespace MusicSelect {
|
|||||||
column.begin(),
|
column.begin(),
|
||||||
column.end(),
|
column.end(),
|
||||||
[](jbcoe::polymorphic_value<Panel> panel) -> bool {
|
[](jbcoe::polymorphic_value<Panel> panel) -> bool {
|
||||||
return (std::dynamic_pointer_cast<CategoryPanel>(panel).get() != nullptr);
|
return dynamic_cast<CategoryPanel*>(&*panel) != nullptr;
|
||||||
}
|
}
|
||||||
)) {
|
)) {
|
||||||
found = true;
|
found = true;
|
||||||
|
@ -91,7 +91,6 @@ namespace MusicSelect {
|
|||||||
song_title_label.setScale(m_big_cover.get_size() / song_title_bounds.width, 1.0f);
|
song_title_label.setScale(m_big_cover.get_size() / song_title_bounds.width, 1.0f);
|
||||||
}
|
}
|
||||||
song_title_label.setFillColor(sf::Color::White);
|
song_title_label.setFillColor(sf::Color::White);
|
||||||
auto cover_pos = m_big_cover.getPosition();
|
|
||||||
song_title_label.setPosition(
|
song_title_label.setPosition(
|
||||||
get_big_cover_x() - m_big_cover.get_size()/2.f,
|
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()
|
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);
|
||||||
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(
|
song_artist_label.setPosition(
|
||||||
get_big_cover_x() - m_big_cover.get_size()/2.f,
|
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()
|
get_big_cover_y() + m_big_cover.get_size() + 0.04f*get_screen_width()
|
||||||
|
@ -107,7 +107,8 @@ namespace Toolkit {
|
|||||||
G = C.g/255.0;
|
G = C.g/255.0;
|
||||||
B = C.b/255.0;
|
B = C.b/255.0;
|
||||||
///Casos no triviales.
|
///Casos no triviales.
|
||||||
double max, min, l, s;
|
double max, min, l;
|
||||||
|
double s = 0;
|
||||||
|
|
||||||
///Maximos
|
///Maximos
|
||||||
max = std::max(std::max(R,G),B);
|
max = std::max(std::max(R,G),B);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user