IT BUILDSSS
This commit is contained in:
parent
73a02bf924
commit
cf873f7ad2
BIN
assets/textures/fallback_cover.png
Normal file
BIN
assets/textures/fallback_cover.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
@ -49,4 +49,7 @@ executable(
|
||||
'-Wnon-virtual-dtor',
|
||||
'-pedantic'
|
||||
]
|
||||
)
|
||||
)
|
||||
|
||||
install_subdir('assets', install_dir : 'assets', strip_directory : true)
|
||||
install_subdir('songs', install_dir: 'songs', strip_directory : true)
|
@ -11,7 +11,7 @@
|
||||
int main(int argc, char const *argv[]) {
|
||||
|
||||
sf::RenderWindow window(sf::VideoMode(800,600), "jujube");
|
||||
window.setVerticalSyncEnabled(true);
|
||||
window.setFramerateLimit(60);
|
||||
|
||||
Data::SongList song_list;
|
||||
MusicSelect::Screen music_select{song_list};
|
||||
|
@ -22,6 +22,7 @@ MusicSelect::Screen::Screen(const Data::SongList& t_song_list) :
|
||||
void MusicSelect::Screen::select_chart(sf::RenderWindow& window) {
|
||||
|
||||
window.create(sf::VideoMode(600,600), "jujube", sf::Style::None);
|
||||
window.setFramerateLimit(60);
|
||||
bool chart_selected = false;
|
||||
while (not chart_selected) {
|
||||
sf::Event event;
|
||||
@ -48,6 +49,7 @@ void MusicSelect::Screen::select_chart(sf::RenderWindow& window) {
|
||||
);
|
||||
}
|
||||
window.display();
|
||||
window.clear(sf::Color::Black);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,11 @@ void MusicSelect::CategoryPanel::click(Screen& screen) {
|
||||
}
|
||||
|
||||
void MusicSelect::CategoryPanel::draw(Resources& resources, sf::RenderTarget& target, sf::FloatRect area) {
|
||||
sf::RectangleShape red_rectangle;
|
||||
red_rectangle.setFillColor(sf::Color::Transparent);
|
||||
red_rectangle.setOutlineColor(sf::Color::Red);
|
||||
red_rectangle.setOutlineThickness(1.f);
|
||||
|
||||
sf::RectangleShape frame{{area.width*0.9f, area.height*0.9f}};
|
||||
frame.setFillColor(sf::Color::Black);
|
||||
frame.setOutlineThickness(1.f);
|
||||
@ -20,16 +25,20 @@ void MusicSelect::CategoryPanel::draw(Resources& resources, sf::RenderTarget& ta
|
||||
sf::Text top_text;
|
||||
top_text.setFont(resources.noto_sans_medium);
|
||||
top_text.setString("category");
|
||||
top_text.setCharacterSize(12U);
|
||||
top_text.setCharacterSize(50U);
|
||||
top_text.setFillColor(sf::Color::White);
|
||||
auto bounds = top_text.getLocalBounds();
|
||||
top_text.setScale(area.width*0.45f / bounds.width, area.width*0.45f / bounds.width);
|
||||
top_text.setPosition(area.left + area.width*0.15f, area.top + area.height*0.15f);
|
||||
top_text.setPosition(area.left + area.width*0.07f, area.top + area.height*0.07f);
|
||||
target.draw(top_text);
|
||||
|
||||
set_to_global_bounds(red_rectangle, top_text);
|
||||
target.draw(red_rectangle);
|
||||
|
||||
sf::Text label_text;
|
||||
label_text.setFont(resources.noto_sans_medium);
|
||||
label_text.setString(this->label);
|
||||
label_text.setCharacterSize(24U);
|
||||
label_text.setCharacterSize(100U);
|
||||
label_text.setFillColor(sf::Color::White);
|
||||
auto text_bounds = label_text.getLocalBounds();
|
||||
label_text.setOrigin(text_bounds.width / 2.f, text_bounds.height / 2.f);
|
||||
@ -39,6 +48,10 @@ void MusicSelect::CategoryPanel::draw(Resources& resources, sf::RenderTarget& ta
|
||||
label_text.setScale(area.width*0.8f / text_bounds.width, area.width*0.8f / text_bounds.width);
|
||||
}
|
||||
label_text.setPosition(area.left + area.width / 2.f, area.top + area.height / 2.f);
|
||||
target.draw(label_text);
|
||||
|
||||
set_to_global_bounds(red_rectangle, label_text);
|
||||
target.draw(red_rectangle);
|
||||
}
|
||||
|
||||
|
||||
@ -50,3 +63,9 @@ void MusicSelect::SongPanel::click(Screen& screen) {
|
||||
void MusicSelect::SongPanel::draw(Resources& resources, sf::RenderTarget& target, sf::FloatRect area) {
|
||||
|
||||
}
|
||||
|
||||
void MusicSelect::set_to_global_bounds(sf::RectangleShape& rect, const sf::Text& text) {
|
||||
const auto& bounds = text.getGlobalBounds();
|
||||
rect.setSize({bounds.width, bounds.height});
|
||||
rect.setPosition({bounds.left, bounds.top});
|
||||
}
|
||||
|
@ -44,4 +44,6 @@ namespace MusicSelect {
|
||||
private:
|
||||
const Data::Song& song;
|
||||
};
|
||||
|
||||
void set_to_global_bounds(sf::RectangleShape& rect, const sf::Text& text);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user