code style fixes

This commit is contained in:
BlackMATov
2020-01-10 12:03:56 +07:00
parent 0c16d58253
commit 95fee92b20
22 changed files with 49 additions and 34 deletions

View File

@@ -8,6 +8,8 @@
#include "_core.hpp"
#include "deferrer.hpp"
namespace e2d
{
class profiler final : public module<profiler> {

View File

@@ -36,6 +36,20 @@ namespace
if ( k.is_key_pressed(keyboard_key::lsuper) && k.is_key_just_released(keyboard_key::enter) ) {
the<window>().toggle_fullscreen(!the<window>().fullscreen());
}
if ( k.is_key_just_released(keyboard_key::space) ) {
the<profiler>().record_for(std::chrono::seconds(1))
.then([](const profiler::recording_info& info){
the<debug>().trace("Profile done: %0", info.events.size());
profilers::try_save_recording_info(info, the<vfs>().write({"desktop", "trace.json"}, false));
});
the<deferrer>().do_in_main_thread([](){
the<library>().load_asset_async<prefab_asset>("scenes/spine_scene_prefab.json")
.then([](const prefab_asset::load_result& prefab_data){
the<world>().instantiate(prefab_data->content());
});
});
}
}
};

View File

@@ -6,7 +6,6 @@
#include <enduro2d/core/profiler.hpp>
#include <enduro2d/core/deferrer.hpp>
#include <enduro2d/core/engine.hpp>
#include <enduro2d/core/vfs.hpp>

View File

@@ -179,7 +179,7 @@ namespace e2d
{"url", url.schemepath()}
});
return load_async(url).then([](auto&& src){
return std::optional(std::forward<decltype(src)>(src));
return std::optional<buffer>(std::forward<decltype(src)>(src));
}).get_or_default(std::nullopt);
}
@@ -202,7 +202,7 @@ namespace e2d
{"url", url.schemepath()}
});
return load_as_string_async(url).then([](auto&& src){
return std::optional(std::forward<decltype(src)>(src));
return std::optional<str>(std::forward<decltype(src)>(src));
}).get_or_default(std::nullopt);
}