66*/
77
88#include " Window.hpp"
9- #include " Buffer.hpp"
109#include " Inputs.hpp"
1110
12- #include < iostream>
13-
14- // sw::Input_buffer event_buffer;
15-
1611SW_GRAPH_MODULE_EXPORT char current_key_flags[sw::Keyboard::LAST];
1712SW_GRAPH_MODULE_EXPORT char previous_key_flags[sw::Keyboard::LAST];
1813
@@ -35,10 +30,6 @@ GLFWwindow *sw::Window::UpdateWindow()
3530 previous_mouse_position = current_mouse_position;
3631 previous_mouse_scroll = current_mouse_scroll;
3732
38- std::cout << " mouse x: " << previous_mouse_position.x << " , mouse y: " previous_mouse_position.y << std::endl;
39- std::cout << " mouse scroll x axis: " << previous_mouse_scroll.x << " , mouse scroll y axis: " previous_mouse_scroll.y << std::endl;
40-
41- // event_buffer.clear();
4233 glfwSwapBuffers (m_window);
4334 return (m_window);
4435}
@@ -69,27 +60,12 @@ void sw::Window::mouse_button_callback(GLFWwindow*, int button, int action, int)
6960
7061void sw::Window::position_callback (GLFWwindow*, double xpos, double ypos)
7162{
72- /*
73- std::pair<int,int> kys{};
74- std::pair<double,double> ipt{xpos,ypos};
75- sw::Type tpe = sw::Position;
76-
77- event_buffer.push(tpe, kys, ipt);
78- */
79-
80- current_mouse_position = {xpos, ypos};
63+ current_mouse_position = {static_cast <float >(xpos), static_cast <float >(ypos)};
8164}
8265
8366void sw::Window::scroll_callback (GLFWwindow*, double x, double y)
8467{
85- /*
86- std::pair<int,int> kys{};
87- std::pair<double,double> ipt{x,y};
88- sw::Type tpe = sw::Scroll;
89-
90- event_buffer.push(tpe, kys, ipt);
91- */
92- current_mouse_scroll = {x, y};
68+ current_mouse_scroll = {static_cast <float >(x), static_cast <float >(y)};
9369}
9470
9571void sw::Window::resizeCallBack (GLFWwindow *window, int width, int height)
@@ -156,44 +132,12 @@ bool sw::isMouseButtonUp(const int &btn)
156132 return !sw::isMouseButtonDown (btn);
157133}
158134
159- // DEPRECATED DO NOT USE
160- bool sw::mouseMoved ()
161- {
162- /*
163- const auto &tmp = event_buffer.get();
164-
165- for (size_t i = 0; i < event_buffer.getIdx(); ++i)
166- {
167- if (tmp[i].m_t == sw::Position)
168- return true;
169- }*/
170- return false ;
171- }
172-
173- sw::Vector2f sw::getMouseScroll (void )
135+ sw::Vector2f sw::getMouseScroll ()
174136{
175- /*
176- const auto& tmp = event_buffer.get();
177-
178- for (size_t i = 0; i < event_buffer.getIdx(); ++i)
179- {
180- if (tmp[i].m_t == sw::Scroll && tmp[i].m_os == evt)
181- return true;
182- }
183- */
184137 return current_mouse_scroll;
185138}
186139
187- sw::Vector2f sw::getMousePosition (void )
140+ sw::Vector2f sw::getMousePosition ()
188141{
189- /*
190- const auto& tmp = event_buffer.get();
191-
192- for (size_t i = 0; i < event_buffer.getIdx(); ++i)
193- {
194- if (tmp[i].m_t == sw::Scroll && tmp[i].m_os == evt)
195- return true;
196- }
197- */
198142 return current_mouse_position;
199143}
0 commit comments