Skip to main content

GLFWWindowCloseSystem.ixx File

System that converts native GLFW close requests into engine window-close commands. More...

Included Headers

#include <GLFW/glfw3.h> #include <helios.engine.platform.window.concepts.IsWindowHandle> #include <helios.ecs.components.Active> #include <helios.engine.runtime.messaging.command.NullCommandBuffer> #include <helios.engine.platform.window.components> #include <helios.engine.platform.window.commands.WindowCloseCommand> #include <helios.glfw.components> #include <helios.engine.runtime.world.tags.SystemRole> #include <helios.engine.runtime.messaging.command.concepts.IsCommandBufferLike> #include <helios.engine.runtime.world.UpdateContext>

Namespaces Index

namespacehelios
namespaceglfw
namespacesystems
namespacecomponents

Classes Index

classGLFWWindowCloseSystem<THandle, TCommandBuffer>

Emits WindowCloseCommand when GLFW reports a close request. More...

Description

System that converts native GLFW close requests into engine window-close commands.

File Listing

The file content with the documentation metadata removed is:

1
5module;
6
7#include <GLFW/glfw3.h>
8
9export module helios.glfw.systems.GLFWWindowCloseSystem;
10
11
12
13import helios.engine.runtime.world.UpdateContext;
14
15import helios.engine.runtime.world.tags.SystemRole;
16
17import helios.glfw.components;
18import helios.engine.platform.window.components;
19import helios.engine.platform.window.commands.WindowCloseCommand;
20import helios.engine.runtime.messaging.command.NullCommandBuffer;
21import helios.engine.runtime.messaging.command.concepts.IsCommandBufferLike;
22
23import helios.ecs.components.Active;
24import helios.engine.platform.window.concepts.IsWindowHandle;
25
26using namespace helios::engine::runtime::world::tags;
27using namespace helios::engine::runtime::world;
28using namespace helios::engine::runtime::messaging::command;
29using namespace helios::engine::runtime::messaging::command::concepts;
30using namespace helios::glfw::components;
31using namespace helios::engine::platform::window::commands;
32using namespace helios::engine::platform::window::components;
33using namespace helios::ecs::components;
34using namespace helios::engine::platform::window::concepts;
35export namespace helios::glfw::systems {
36
42 template<typename THandle, typename TCommandBuffer = NullCommandBuffer>
43 requires IsWindowHandle<THandle> && IsCommandBufferLike<TCommandBuffer>
45
46
47 public:
48
49 using CommandBuffer_type = TCommandBuffer;
50
54 using EngineRoleTag = SystemRole;
55
61 void update(UpdateContext& updateContext, TCommandBuffer& cmdBuffer) noexcept {
62
63 for (auto [entity, wc, glfw, wsc, active]: updateContext.view<
64 THandle,
65 WindowComponent<THandle>,
67 WindowShownComponent<THandle>,
68 Active<THandle>
69 >().whereEnabled()) {
70 if (glfwWindowShouldClose(glfw->handle)) {
71 cmdBuffer.template add<WindowCloseCommand<THandle>>(
72 entity.handle()
73 );
74 }
75 }
76 }
77
78 };
79
80}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.