consolodate NetworkEvents

This commit is contained in:
2025-05-02 00:48:29 -05:00
parent b4ac013f18
commit 6f322cadb8
8 changed files with 129 additions and 242 deletions

View File

@@ -43,13 +43,13 @@ namespace Archimedes {
glfwSetWindowSizeCallback(w, [](GLFWwindow* window, int w, int h){
WindowData& d = *(WindowData*) glfwGetWindowUserPointer(window);
d.sendEvent(new WindowResizeEvent(w, h));
d.sendEvent(new ResizeWindowEvent(w, h));
});
glfwSetWindowCloseCallback(w, [](GLFWwindow* window){
WindowData& d = *(WindowData*) glfwGetWindowUserPointer(window);
d.sendEvent(new WindowCloseEvent(d.window));
d.sendEvent(new CloseWindowEvent(d.window));
});
glfwSetKeyCallback(w, [](GLFWwindow* window, int key, int scancode, int action, int mods){
@@ -57,13 +57,13 @@ namespace Archimedes {
switch(action) {
case GLFW_PRESS:
d.sendEvent(new WindowKeyPressedEvent(key, 0));
d.sendEvent(new KeyPressedWindowEvent(key, 0));
break;
case GLFW_RELEASE:
d.sendEvent(new WindowKeyReleasedEvent(key));
d.sendEvent(new KeyReleasedWindowEvent(key));
break;
case GLFW_REPEAT:
d.sendEvent(new WindowKeyPressedEvent(key, 1));
d.sendEvent(new KeyPressedWindowEvent(key, 1));
break;
}
});
@@ -73,10 +73,10 @@ namespace Archimedes {
switch(action) {
case GLFW_PRESS:
d.sendEvent(new WindowMouseButtonPressedEvent(button));
d.sendEvent(new MouseButtonPressedWindowEvent(button));
break;
case GLFW_RELEASE:
d.sendEvent(new WindowMouseButtonReleasedEvent(button));
d.sendEvent(new MouseButtonReleasedWindowEvent(button));
break;
}
});
@@ -84,13 +84,13 @@ namespace Archimedes {
glfwSetScrollCallback(w, [](GLFWwindow* window, double dx, double dy){
WindowData& d = *(WindowData*) glfwGetWindowUserPointer(window);
d.sendEvent(new WindowScrollEvent(dx, dy));
d.sendEvent(new ScrollWindowEvent(dx, dy));
});
glfwSetCursorPosCallback(w, [](GLFWwindow* window, double dx, double dy){
WindowData& d = *(WindowData*) glfwGetWindowUserPointer(window);
d.sendEvent(new WindowMouseMovedEvent(dx, dy));
d.sendEvent(new MouseMovedWindowEvent(dx, dy));
});
}