Skip to content
This repository was archived by the owner on Oct 18, 2023. It is now read-only.

Commit e125231

Browse files
committed
Fix compilation
Clean code
1 parent 5375cd4 commit e125231

3 files changed

Lines changed: 7 additions & 74 deletions

File tree

module/includes/managers/AudioSourceManager.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace sw
2222
~AudioSourceManager() override = default;
2323

2424
YAML::Node save() const;
25-
void onUpdate() override {};
25+
void onUpdate() override;
2626
void onLoad(YAML::Node& node) override;
2727
}; // class AudioSourceManager
2828

module/includes/window/Window.hpp

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ namespace sw
187187
///
188188
/// @throw none
189189
////////////////////////////////////////////////////////////
190-
SW_GRAPH_MODULE_EXPORT sw::Vector2f getMousePosition(void);
190+
SW_GRAPH_MODULE_EXPORT sw::Vector2f getMousePosition();
191191

192192
////////////////////////////////////////////////////////////
193193
/// @brief Return current scroll of x and y axis
@@ -198,18 +198,7 @@ namespace sw
198198
///
199199
/// @throw none
200200
////////////////////////////////////////////////////////////
201-
SW_GRAPH_MODULE_EXPORT sw::Vector2f getMouseScroll(void);
202-
203-
////////////////////////////////////////////////////////////
204-
/// @brief Return True if mouse moved
205-
///
206-
/// @param void
207-
///
208-
/// @return bool
209-
///
210-
/// @throw none
211-
////////////////////////////////////////////////////////////
212-
SW_GRAPH_MODULE_EXPORT bool mouseMoved();
201+
SW_GRAPH_MODULE_EXPORT sw::Vector2f getMouseScroll();
213202
}
214203

215204
#endif //SHIPWRECK_ENGINE_WINDOW_HPP

module/sources/window/WindowCallBack.cpp

Lines changed: 4 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,8 @@
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-
1611
SW_GRAPH_MODULE_EXPORT char current_key_flags[sw::Keyboard::LAST];
1712
SW_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

7061
void 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

8366
void 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

9571
void 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

Comments
 (0)