diff --git a/sources/main.cpp b/sources/main.cpp index 8621151..8018caf 100644 --- a/sources/main.cpp +++ b/sources/main.cpp @@ -7,27 +7,28 @@ #include using namespace e2d; -int e2d_main() { - { - modules::initialize() - .register_scheme("file"); - modules::initialize() - .register_sink(); - modules::initialize(); - modules::initialize(v2u{640, 480}, "Enduro2D", false) - .register_event_listener(the()); - modules::initialize(the(), the()); - } - { - const keyboard& k = the().keyboard(); - while ( !the().should_close() && !k.is_key_just_released(keyboard_key::escape) ) { +namespace +{ + class game final : public application { + public: + bool frame_tick() final { + const keyboard& k = the().keyboard(); + while ( the().should_close() || k.is_key_just_released(keyboard_key::escape) ) { + return false; + } the().execute(render::command_block<64>() .add_command(render::clear_command() .color_value({1.f, 0.4f, 0.f, 1.f})) .add_command(render::swap_command(true))); - the().frame_tick(); - window::poll_events(); + return true; } - } + }; +} + +int e2d_main(int argc, char *argv[]) { + auto params = engine::parameters("bootstrap", "enduro2d") + .timer_params(engine::timer_parameters() + .maximal_framerate(100)); + modules::initialize(argc, argv, params).start(); return 0; }