mirror of
https://github.com/enduro2d/enduro2d.git
synced 2025-12-16 14:08:59 +07:00
code style fixes
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
|
||||
#include "_core.hpp"
|
||||
|
||||
#include "deferrer.hpp"
|
||||
|
||||
namespace e2d
|
||||
{
|
||||
class profiler final : public module<profiler> {
|
||||
|
||||
@@ -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());
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#include <enduro2d/core/profiler.hpp>
|
||||
|
||||
#include <enduro2d/core/deferrer.hpp>
|
||||
#include <enduro2d/core/engine.hpp>
|
||||
#include <enduro2d/core/vfs.hpp>
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user