aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-05-22 13:48:02 +0200
committerdec05eba <dec05eba@protonmail.com>2021-05-22 13:48:02 +0200
commit6eee3c3782047cae7ec07737c695566ae26ea3be (patch)
tree7ed2e2d87f3058aa0dff71cc51a93f6810d12b47
parent398eeeca691a14dd883c33fde16de55fe1ed6a4f (diff)
More smooth
-rw-r--r--src/Body.cpp6
-rw-r--r--src/ResourceLoader.cpp9
2 files changed, 10 insertions, 5 deletions
diff --git a/src/Body.cpp b/src/Body.cpp
index 6d06061..24be25b 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -626,7 +626,7 @@ namespace QuickMedia {
target_scroll -= selected_item_height;
const double scroll_diff = target_scroll - extra_scroll_current;
const double scroll_move_speed = 25.0;
- extra_scroll_current += (scroll_diff * std::min(1.0, frame_time * scroll_move_speed));
+ extra_scroll_current += (scroll_diff * std::min(1.0, 0.007f * scroll_move_speed));
double scroll_smooth_diff = extra_scroll_current - prev_extra_scroll;
prev_extra_scroll = extra_scroll_current;
@@ -808,12 +808,12 @@ namespace QuickMedia {
const float item_background_prev_pos_y = item_background.get_position().y;
const float item_background_pos_diff = item_background_target_pos_y - item_background_prev_pos_y;
float item_background_move_speed = instant_move ? 1000.0f : 50.0f;
- item_background.set_position(sf::Vector2f(pos.x, item_background_prev_pos_y + (item_background_pos_diff * std::min(1.0f, frame_time * item_background_move_speed))));
+ item_background.set_position(sf::Vector2f(pos.x, item_background_prev_pos_y + (item_background_pos_diff * std::min(1.0f, 0.007f * item_background_move_speed))));
const float item_background_prev_height = item_background.get_size().y;
const float item_background_height_diff = item_background_target_height - item_background_prev_height;
const float item_background_height_speed = instant_move ? 1000.0f : 50.0f;
- item_background.set_size(sf::Vector2f(size.x, item_background_prev_height + (item_background_height_diff * std::min(1.0f, frame_time * item_background_height_speed))));
+ item_background.set_size(sf::Vector2f(size.x, item_background_prev_height + (item_background_height_diff * std::min(1.0f, 0.007f * item_background_height_speed))));
if(render_selected_item_bg)
item_background.draw(window);
diff --git a/src/ResourceLoader.cpp b/src/ResourceLoader.cpp
index f7ce555..3100c7f 100644
--- a/src/ResourceLoader.cpp
+++ b/src/ResourceLoader.cpp
@@ -48,12 +48,17 @@ namespace QuickMedia::FontLoader {
}
}
+ bool successfully_loaded_font = false;
for(const std::string &noto_dir : noto_directories) {
- if(new_font->loadFromFile(noto_dir + "/" + font_file_name))
+ if(new_font->loadFromFile(noto_dir + "/" + font_file_name)) {
+ successfully_loaded_font = true;
break;
+ }
}
- fprintf(stderr, "Warning: Failed to load font: %s\n", font_file_name.c_str());
+ if(!successfully_loaded_font)
+ fprintf(stderr, "Warning: Failed to load font: %s\n", font_file_name.c_str());
+
font = new_font.get();
font_cache[(size_t)font_type] = std::move(new_font);
malloc_trim(0);