diff --git a/headers/enduro2d/core/audio.hpp b/headers/enduro2d/core/audio.hpp index 824dbe16..997e78fd 100644 --- a/headers/enduro2d/core/audio.hpp +++ b/headers/enduro2d/core/audio.hpp @@ -96,7 +96,7 @@ namespace e2d void volume(f32 value) noexcept; [[nodiscard]] f32 volume() const noexcept; - + void resume() noexcept; void pause() noexcept; private: diff --git a/headers/enduro2d/core/profiler.hpp b/headers/enduro2d/core/profiler.hpp index 282d348d..d161231f 100644 --- a/headers/enduro2d/core/profiler.hpp +++ b/headers/enduro2d/core/profiler.hpp @@ -8,6 +8,8 @@ #include "_core.hpp" +#include "deferrer.hpp" + namespace e2d { class profiler final : public module { @@ -156,7 +158,7 @@ namespace e2d void on_event(const event_info& event) noexcept final { const bool skip = info_.events.empty() && depth_; - + if ( std::holds_alternative(event) ) { ++depth_; } else if ( std::holds_alternative(event) ) { @@ -168,7 +170,7 @@ namespace e2d if ( !skip ) { info_.events.push_back(event); } - + if ( !depth_ && time_point_ <= Clock::now() ) { promise_.resolve(std::move(info_)); } @@ -212,7 +214,7 @@ namespace e2d::profilers bool try_save_recording_info( const profiler::recording_info& src, buffer& dst) noexcept; - + bool try_save_recording_info( const profiler::recording_info& src, const output_stream_uptr& dst) noexcept; diff --git a/headers/enduro2d/core/render.hpp b/headers/enduro2d/core/render.hpp index c535d7e2..adf88318 100644 --- a/headers/enduro2d/core/render.hpp +++ b/headers/enduro2d/core/render.hpp @@ -906,7 +906,7 @@ namespace e2d shader_ptr create_shader( str_view vertex_source, str_view fragment_source); - + shader_ptr create_shader( buffer_view vertex_source, buffer_view fragment_source); diff --git a/headers/enduro2d/core/window.hpp b/headers/enduro2d/core/window.hpp index ddbb7501..f75bc306 100644 --- a/headers/enduro2d/core/window.hpp +++ b/headers/enduro2d/core/window.hpp @@ -105,7 +105,7 @@ namespace e2d private: debug& debug_; }; - + class window_input_source final : public window::event_listener { public: window_input_source(input& input) noexcept; diff --git a/headers/enduro2d/utils/buffer_view.hpp b/headers/enduro2d/utils/buffer_view.hpp index 7d2b81d1..be2294ed 100644 --- a/headers/enduro2d/utils/buffer_view.hpp +++ b/headers/enduro2d/utils/buffer_view.hpp @@ -61,7 +61,7 @@ namespace e2d buffer_view::buffer_view(const std::array& buffer) noexcept : data_(buffer.data()) , size_(buffer.size() * sizeof(T)) {} - + template < typename T, std::size_t N > buffer_view::buffer_view(const T (&buffer)[N]) noexcept : data_(&buffer[0]) diff --git a/headers/enduro2d/utils/url.hpp b/headers/enduro2d/utils/url.hpp index 4e1c5102..115961f1 100644 --- a/headers/enduro2d/utils/url.hpp +++ b/headers/enduro2d/utils/url.hpp @@ -38,7 +38,7 @@ namespace e2d const str& scheme() const noexcept; const str& path() const noexcept; - + str schemepath() const; url& operator+=(str_view path); diff --git a/samples/sources/sample_00/sample_00.cpp b/samples/sources/sample_00/sample_00.cpp index a3ddca95..475374d9 100644 --- a/samples/sources/sample_00/sample_00.cpp +++ b/samples/sources/sample_00/sample_00.cpp @@ -96,7 +96,7 @@ namespace the().register_scheme_alias( "ships", url("piratepack://PNG/Retina/Ships")); - + image texture1_image; if ( !images::try_load_image(texture1_image, the().read(url("ships://ship (2).png"))) ) { return false; diff --git a/samples/sources/sample_01/sample_01.cpp b/samples/sources/sample_01/sample_01.cpp index 6e9a9930..7259897a 100644 --- a/samples/sources/sample_01/sample_01.cpp +++ b/samples/sources/sample_01/sample_01.cpp @@ -156,7 +156,7 @@ namespace the().register_scheme_alias( "ships", url("piratepack://PNG/Retina/Ships")); - + image texture_image; if ( !images::try_load_image(texture_image, the().read(url("ships://ship (3).png"))) ) { return false; diff --git a/samples/sources/sample_02/sample_02.cpp b/samples/sources/sample_02/sample_02.cpp index 3f953597..7878d72b 100644 --- a/samples/sources/sample_02/sample_02.cpp +++ b/samples/sources/sample_02/sample_02.cpp @@ -111,7 +111,7 @@ namespace the().register_scheme_alias( "ships", url("piratepack://PNG/Retina/Ships")); - + image texture_image; if ( !images::try_load_image(texture_image, the().read(url("ships://ship (3).png"))) ) { return false; diff --git a/samples/sources/sample_03/sample_03.cpp b/samples/sources/sample_03/sample_03.cpp index 723995f4..b8b1e396 100644 --- a/samples/sources/sample_03/sample_03.cpp +++ b/samples/sources/sample_03/sample_03.cpp @@ -36,6 +36,20 @@ namespace if ( k.is_key_pressed(keyboard_key::lsuper) && k.is_key_just_released(keyboard_key::enter) ) { the().toggle_fullscreen(!the().fullscreen()); } + + if ( k.is_key_just_released(keyboard_key::space) ) { + the().record_for(std::chrono::seconds(1)) + .then([](const profiler::recording_info& info){ + the().trace("Profile done: %0", info.events.size()); + profilers::try_save_recording_info(info, the().write({"desktop", "trace.json"}, false)); + }); + the().do_in_main_thread([](){ + the().load_asset_async("scenes/spine_scene_prefab.json") + .then([](const prefab_asset::load_result& prefab_data){ + the().instantiate(prefab_data->content()); + }); + }); + } } }; diff --git a/samples/sources/sample_05/sample_05.cpp b/samples/sources/sample_05/sample_05.cpp index 24917718..a963c62d 100644 --- a/samples/sources/sample_05/sample_05.cpp +++ b/samples/sources/sample_05/sample_05.cpp @@ -19,7 +19,7 @@ namespace the().register_scheme_alias( "audio", url("rpgaudio://Audio")); - + auto sstream1 = the