#include #include #include #include #include #include #include int main() { Log::initialize(); flecs::world world; world.import (); world.import (); world.import (); Asset::AssetManager manager; manager.register_asset_type(world); auto handle0 = manager.load(world, "hi"); auto handle1 = manager.load(world, "hi"); auto handle2 = manager.load(world, "hi2"); #ifndef NDEBUG world.import (); world.set({}); #endif world.system const>("CatchMouse") .each([](flecs::entity e, Window::Window, Input::ButtonInput const& button_input) { if (button_input.just_pressed(Input::KeyCode(GLFW_KEY_LEFT_CONTROL))) { auto glfw_window = e.get>(); auto input_mode = glfwGetInputMode(glfw_window->get(), GLFW_CURSOR); if (input_mode == GLFW_CURSOR_NORMAL) { glfwSetInputMode(glfw_window->get(), GLFW_CURSOR, GLFW_CURSOR_HIDDEN); } else { glfwSetInputMode(glfw_window->get(), GLFW_CURSOR, GLFW_CURSOR_NORMAL); } } }); world.system const>("CloseOnEsc") .each([](flecs::entity e, Window::Window, Input::ButtonInput const& button_input) { if (button_input.just_pressed(Input::KeyCode(GLFW_KEY_ESCAPE))) { e.world().quit(); } }); world.system("PollEvents").kind(flecs::PreUpdate).run([](flecs::iter&) { glfwPollEvents(); }); world.system>("Render") .kind(flecs::PostUpdate) .each([](std::shared_ptr& glfw_window) { glfwSwapBuffers(glfw_window.get()); }); while (world.progress()) { } }