mirror of
https://github.com/enduro2d/enduro2d-bootstrap.git
synced 2025-12-13 19:48:05 +07:00
code fixing after engine update
This commit is contained in:
@@ -9,17 +9,31 @@ using namespace e2d;
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
class game final : public application {
|
class game_system final : public ecs::system {
|
||||||
public:
|
public:
|
||||||
bool frame_tick() final {
|
void process(ecs::registry& owner) override {
|
||||||
|
E2D_UNUSED(owner);
|
||||||
const keyboard& k = the<input>().keyboard();
|
const keyboard& k = the<input>().keyboard();
|
||||||
while ( the<window>().should_close() || k.is_key_just_released(keyboard_key::escape) ) {
|
if ( k.is_key_just_released(keyboard_key::f12) ) {
|
||||||
return false;
|
the<dbgui>().toggle_visible(!the<dbgui>().visible());
|
||||||
}
|
}
|
||||||
the<render>().execute(render::command_block<64>()
|
if ( k.is_key_just_released(keyboard_key::escape) ) {
|
||||||
.add_command(render::clear_command()
|
the<window>().set_should_close(true);
|
||||||
.color_value({1.f, 0.4f, 0.f, 1.f}))
|
}
|
||||||
.add_command(render::swap_command(true)));
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class game final : public high_application {
|
||||||
|
public:
|
||||||
|
bool initialize() final{
|
||||||
|
ecs::registry_filler(the<world>().registry())
|
||||||
|
.system<game_system>(world::priority_update);
|
||||||
|
|
||||||
|
ecs::entity camera_e = the<world>().registry().create_entity();
|
||||||
|
ecs::entity_filler(camera_e)
|
||||||
|
.component<camera>(camera()
|
||||||
|
.background({1.f, 0.4f, 0.f, 1.f}))
|
||||||
|
.component<actor>(node::create(camera_e));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -31,5 +45,6 @@ int e2d_main(int argc, char *argv[]) {
|
|||||||
.timer_params(engine::timer_parameters()
|
.timer_params(engine::timer_parameters()
|
||||||
.maximal_framerate(100)));
|
.maximal_framerate(100)));
|
||||||
modules::initialize<starter>(argc, argv, params).start<game>();
|
modules::initialize<starter>(argc, argv, params).start<game>();
|
||||||
|
modules::shutdown<starter>();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user