SpiecsEngine
 
Loading...
Searching...
No Matches

◆ SetInternalCallBack()

void Spices::VulkanWindows::SetInternalCallBack ( ) const
private

Set all needed GLFW events call back.

Error event Callback.

Todo
Butter Log.

Framebuffer resize event Callback.

Note
Not in use now.

Window resize event Callback.

Reinterpretate the pointer to this class.

Set this class's variable.

Create an specific event.

Execute the global event function pointer by passing the specific event.

Window close event Callback.

Create an specific event.

Execute the global event function pointer by passing the specific event.

Key event Callback.

Create an specific event.

Execute the global event function pointer by passing the specific event.

Create an specific event.

Execute the global event function pointer by passing the specific event.

Create an specific event.

Execute the global event function pointer by passing the specific event.

Key Input event Callback.

Create an specific event.

Execute the global event function pointer by passing the specific event.

Mouse Button event Callback.

Create an specific event.

Execute the global event function pointer by passing the specific event.

Create an specific event.

Execute the global event function pointer by passing the specific event.

Mouse Scroll event Callback.

Create an specific event.

Execute the global event function pointer by passing the specific event.

Mouse Move event Callback.

Create an specific event.

Execute the global event function pointer by passing the specific event.

Error event Callback.

Todo
Butter Log.

Framebuffer resize event Callback.

Note
Not in use now.

Window resize event Callback.

Reinterpretate the pointer to this class.

Set this class's variable.

Create an specific event.

Execute the global event function pointer by passing the specific event.

Window close event Callback.

Create an specific event.

Execute the global event function pointer by passing the specific event.

Key event Callback.

Create an specific event.

Execute the global event function pointer by passing the specific event.

Create an specific event.

Execute the global event function pointer by passing the specific event.

Create an specific event.

Execute the global event function pointer by passing the specific event.

Key Input event Callback.

Create an specific event.

Execute the global event function pointer by passing the specific event.

Mouse Button event Callback.

Create an specific event.

Execute the global event function pointer by passing the specific event.

Create an specific event.

Execute the global event function pointer by passing the specific event.

Mouse Scroll event Callback.

Create an specific event.

Execute the global event function pointer by passing the specific event.

Mouse Move event Callback.

Create an specific event.

Execute the global event function pointer by passing the specific event.

Definition at line 80 of file VulkanWindows.cpp.

81 {
83
88 glfwSetErrorCallback([](int error, const char* description)
89 {
90 //SPICES_CORE_INFO(error);
91 SPICES_CORE_INFO(description);
92 });
93
98 //glfwSetFramebufferSizeCallback(vulkanState.m_Windows, WindowsResizeCallback);
99
103 glfwSetWindowSizeCallback(m_VulkanState.m_Windows, [](GLFWwindow* window, int width, int height)
104 {
108 const auto vulkanWindow = static_cast<VulkanWindows*>(glfwGetWindowUserPointer(window));
109
113 vulkanWindow->m_WindowsResized = true;
114 vulkanWindow->m_WindowInfo.width = width;
115 vulkanWindow->m_WindowInfo.height = height;
116
120 WindowResizeEvent event(width, height);
121
125 Event::GetEventCallbackFn()(event);
126 });
127
131 glfwSetWindowCloseCallback(m_VulkanState.m_Windows, [](GLFWwindow* window)
132 {
136 WindowCloseEvent event;
137
141 Event::GetEventCallbackFn()(event);
142 });
143
147 glfwSetKeyCallback(m_VulkanState.m_Windows, [](GLFWwindow* window, int key, int scancode, int action, int mods)
148 {
149 switch (action)
150 {
151 case GLFW_PRESS:
152 {
156 KeyPressedEvent event(key, 0);
157
161 Event::GetEventCallbackFn()(event);
162
163 break;
164 }
165 case GLFW_RELEASE:
166 {
170 KeyReleasedEvent event(key);
171
175 Event::GetEventCallbackFn()(event);
176
177 break;
178 }
179 case GLFW_REPEAT:
180 {
184 KeyPressedEvent event(key, 1);
185
189 Event::GetEventCallbackFn()(event);
190
191 break;
192 }
193 }
194 });
195
199 glfwSetCharCallback(m_VulkanState.m_Windows, [](GLFWwindow* window, unsigned int keycode)
200 {
204 KeyTypedEvent event(static_cast<int>(keycode));
205
209 Event::GetEventCallbackFn()(event);
210 });
211
215 glfwSetMouseButtonCallback(m_VulkanState.m_Windows, [](GLFWwindow* window, int button, int action, int mods)
216 {
217 switch (action)
218 {
219 case GLFW_PRESS:
220 {
224 MouseButtonPressedEvent event(button);
225
229 Event::GetEventCallbackFn()(event);
230
231 break;
232 }
233 case GLFW_RELEASE:
234 {
238 MouseButtonReleasedEvent event(button);
239
243 Event::GetEventCallbackFn()(event);
244
245 break;
246 }
247 }
248 });
249
253 glfwSetScrollCallback(m_VulkanState.m_Windows, [](GLFWwindow* window, double xOffset, double yOffset)
254 {
258 MouseScrolledEvent event(static_cast<float>(xOffset), static_cast<float>(yOffset));
259
263 Event::GetEventCallbackFn()(event);
264 });
265
269 glfwSetCursorPosCallback(m_VulkanState.m_Windows, [](GLFWwindow* window, double xPos, double yPos)
270 {
274 MouseMovedEvent event(static_cast<float>(xPos), static_cast<float>(yPos));
275
279 Event::GetEventCallbackFn()(event);
280 });
281 }
#define SPICES_PROFILE_ZONE
VulkanState & m_VulkanState
The global VulkanState Referenced from VulkanRenderBackend.
GLFWwindow * m_Windows
Definition VulkanUtils.h:92

References Spices::Event::GetEventCallbackFn(), Spices::KeyPressedEvent::KeyPressedEvent(), Spices::KeyReleasedEvent::KeyReleasedEvent(), Spices::KeyTypedEvent::KeyTypedEvent(), Spices::VulkanObject::m_VulkanState, Spices::MouseButtonPressedEvent::MouseButtonPressedEvent(), Spices::MouseButtonReleasedEvent::MouseButtonReleasedEvent(), Spices::MouseMovedEvent::MouseMovedEvent(), Spices::MouseScrolledEvent::MouseScrolledEvent(), and Spices::WindowResizeEvent::WindowResizeEvent().

Referenced by VulkanWindows().