diff --git a/Cool b/Cool
index 1b2ceb72..28b6ce6d 160000
--- a/Cool
+++ b/Cool
@@ -1 +1 @@
-Subproject commit 1b2ceb72790d6e335d6355fc47fe06dc3d887ad9
+Subproject commit 28b6ce6d49d0ecdc35d4d016ce4e306815530fcd
diff --git a/changelog.md b/changelog.md
index 184c9b07..1121f11c 100644
--- a/changelog.md
+++ b/changelog.md
@@ -22,7 +22,8 @@
## 🐣beta-18 WIP
-- ✨ The Output Window can now easily be turned fullscreen with F10
+- ✨ Every time input is now nicely formatted like "1h 27m 53s"
+- ✨ The Output Window can now easily be turned fullscreen with F10
- ✨ When opening the Output Window, the aspect ratio automatically adapts to it
- ✨ The Output Window now doesn't have a title bar
- 🟦 Nodes: Added "MIDI Multi-Select with Transition"
diff --git a/src/App.cpp b/src/App.cpp
index 57495104..ea69723a 100644
--- a/src/App.cpp
+++ b/src/App.cpp
@@ -131,7 +131,7 @@ void App::update()
_project.current_clock(),
_project.exporter.is_exporting() /* force_sync_time */
);
- Cool::hack_get_global_time_in_seconds() = _project.current_clock().time_in_seconds();
+ Cool::hack_get_global_time_in_seconds() = _project.current_clock().time();
Cool::hack_get_is_exporting() = _project.exporter.is_exporting();
_project.audio.update(/*on_audio_data_changed = */ [&]() {
_project.modules_graph->on_audio_changed();
@@ -158,7 +158,7 @@ void App::update()
{
_project.clock.update();
render_view().update_size(_project.view_constraint); // TODO(JF) Integrate the notion of View Constraint inside the RenderView ? But that's maybe too much coupling
- polaroid().render(_project.clock.time_in_seconds(), _project.clock.delta_time_in_seconds());
+ polaroid().render(_project.clock.time(), _project.clock.delta_time());
}
else
{
@@ -215,7 +215,7 @@ Cool::Polaroid App::polaroid()
{
return {
.render_target = render_view().render_target(), // TODO(Modules) Each module should have its own render target that it renders on. The views shouldn't have a render target, but receive the one of the top-most module by reference.
- .render_fn = [this](Cool::RenderTarget& render_target, float time, float delta_time) {
+ .render_fn = [this](Cool::RenderTarget& render_target, Cool::Time time, Cool::Time delta_time) {
if (_last_time != time)
{
_last_time = time;
@@ -244,7 +244,7 @@ static void imgui_window_console()
#endif
}
-void App::render(Cool::RenderTarget& render_target, float time, float delta_time)
+void App::render(Cool::RenderTarget& render_target, Cool::Time time, Cool::Time delta_time)
{
_project.modules_graph->render(
render_target,
@@ -337,8 +337,8 @@ void App::imgui_window_exporter()
{
_project.exporter.imgui_windows({
.polaroid = polaroid(),
- .time = _project.clock.time_in_seconds(),
- .delta_time = _project.clock.delta_time_in_seconds(),
+ .time = _project.clock.time(),
+ .delta_time = _project.clock.delta_time(),
.time_speed = _project.clock.time_speed().value(),
.on_image_exported = [&](std::filesystem::path const& exported_image_path) {
auto folder_path = exported_image_path;
@@ -374,7 +374,11 @@ void App::imgui_windows_only_when_inputs_are_allowed()
ImGui::Begin(Cool::icon_fmt("Time", ICOMOON_STOPWATCH).c_str());
Cool::ClockU::imgui_timeline(
_project.clock,
- /* extra_widgets = */ [&]() { the_ui.widget(_project.clock.time_speed()); },
+ /* extra_widgets = */ [&]() {
+ ImGui::SetNextItemWidth(70.f);
+ the_ui.widget(_project.clock.time_speed());
+ //
+ },
/* on_time_reset = */ [&]() { on_time_reset(); }
);
ImGui::End();
@@ -397,7 +401,7 @@ void App::imgui_windows_only_when_inputs_are_allowed()
// Share online
_gallery_poster.imgui_window([&](img::Size size) {
auto the_polaroid = polaroid();
- the_polaroid.render(_project.clock.time_in_seconds(), _project.clock.delta_time_in_seconds(), size);
+ the_polaroid.render(_project.clock.time(), _project.clock.delta_time(), size);
auto const image = the_polaroid.render_target.download_pixels();
return img::save_png_to_string(image);
});
diff --git a/src/App.h b/src/App.h
index 747c3e9e..aa7bbd06 100644
--- a/src/App.h
+++ b/src/App.h
@@ -58,7 +58,7 @@ class App : public Cool::IApp {
auto nodes_library() const -> Cool::NodesLibrary const& { return _nodes_library_manager.library(); }
private:
- void render(Cool::RenderTarget& render_target, float time, float delta_time);
+ void render(Cool::RenderTarget& render_target, Cool::Time time, Cool::Time delta_time);
void on_time_changed();
void on_time_reset();
auto render_view() -> Cool::RenderView&;
@@ -75,7 +75,7 @@ class App : public Cool::IApp {
auto command_executor_without_history () { return CommandExecutor_WithoutHistory_Ref{}; }
auto command_executor_top_level () -> CommandExecutor_TopLevel { return CommandExecutor_TopLevel{command_executor_without_history(), _project.history, make_reversible_commands_context()}; }
auto command_executor () { return CommandExecutor{command_execution_context()}; }
- auto system_values (img::Size render_target_size, float time, float delta_time) { return SystemValues{render_target_size, time, delta_time, _project.camera_2D_manager.camera(), _project.camera_3D_manager.camera(), _project.audio}; }
+ auto system_values (img::Size render_target_size, Cool::Time time, Cool::Time delta_time) { return SystemValues{render_target_size, time, delta_time, _project.camera_2D_manager.camera(), _project.camera_3D_manager.camera(), _project.audio}; }
auto ui () { return Ui_Ref{command_executor()}; }
// clang-format on
@@ -105,7 +105,7 @@ class App : public Cool::IApp {
Project _project{};
std::optional _current_project_path{};
RecentlyOpened _recently_opened_projects{};
- float _last_time{0.f};
+ Cool::Time _last_time{0s};
bool _wants_view_in_fullscreen{false}; // Boolean that anyone can set to true or false at any moment to toggle the view's fullscreen mode.
bool _view_was_in_fullscreen_last_frame{false};
GalleryPoster _gallery_poster{};
diff --git a/src/Dependencies/SystemValues.h b/src/Dependencies/SystemValues.h
index f4f10257..3fcdebc3 100644
--- a/src/Dependencies/SystemValues.h
+++ b/src/Dependencies/SystemValues.h
@@ -8,8 +8,8 @@ namespace Lab {
struct SystemValues {
img::Size render_target_size{};
- float time{};
- float delta_time{};
+ Cool::Time time{};
+ Cool::Time delta_time{};
Cool::Camera2D camera_2D{};
Cool::Camera camera_3D{};
std::reference_wrapper audio_manager;
diff --git a/src/Module/ShaderBased/set_uniforms_for_shader_based_module.cpp b/src/Module/ShaderBased/set_uniforms_for_shader_based_module.cpp
index 26e7f9a9..81bce0c1 100644
--- a/src/Module/ShaderBased/set_uniforms_for_shader_based_module.cpp
+++ b/src/Module/ShaderBased/set_uniforms_for_shader_based_module.cpp
@@ -9,7 +9,6 @@
#include "Nodes/Node.h"
#include "Nodes/valid_input_name.h"
-
namespace Lab {
template
@@ -102,12 +101,12 @@ auto set_uniforms_for_shader_based_module(
shader.set_uniform("_height", system_values.height());
shader.set_uniform("_last_midi_button_pressed", Cool::midi_manager().all_values().last_button_pressed());
shader.set_uniform("_last_last_midi_button_pressed", Cool::midi_manager().all_values().last_last_button_pressed());
- shader.set_uniform("_time_since_last_midi_button_pressed", Cool::midi_manager().all_values().time_since_last_button_pressed_in_seconds());
+ shader.set_uniform("_time_since_last_midi_button_pressed", Cool::midi_manager().all_values().time_since_last_button_pressed().as_seconds_float());
shader.set_uniform("_aspect_ratio", system_values.aspect_ratio());
shader.set_uniform("_inverse_aspect_ratio", system_values.inverse_aspect_ratio());
shader.set_uniform_texture("mixbox_lut", Cool::TextureLibrary_Image::instance().get(Cool::Path::root() / "res/mixbox/mixbox_lut.png")->id());
- shader.set_uniform("_time", system_values.time);
- shader.set_uniform("_delta_time", system_values.delta_time);
+ shader.set_uniform("_time", system_values.time.as_seconds_float());
+ shader.set_uniform("_delta_time", system_values.delta_time.as_seconds_float());
if (depends_on.audio_volume)
shader.set_uniform("_audio_volume", system_values.audio_manager.get().volume());