Fix warnings

This commit is contained in:
Jérôme Leclercq 2017-07-27 14:39:48 +02:00
parent 2b36516758
commit b64ab862fe
6 changed files with 26 additions and 26 deletions

View File

@ -44,13 +44,13 @@ namespace Ndk
void UnregisterWidget(std::size_t index); void UnregisterWidget(std::size_t index);
private: private:
void OnMouseButtonPressed(const Nz::EventHandler* eventHandler, const Nz::WindowEvent::MouseButtonEvent& event); void OnEventMouseButtonPressed(const Nz::EventHandler* eventHandler, const Nz::WindowEvent::MouseButtonEvent& event);
void OnMouseButtonRelease(const Nz::EventHandler* eventHandler, const Nz::WindowEvent::MouseButtonEvent& event); void OnEventMouseButtonRelease(const Nz::EventHandler* eventHandler, const Nz::WindowEvent::MouseButtonEvent& event);
void OnMouseMoved(const Nz::EventHandler* eventHandler, const Nz::WindowEvent::MouseMoveEvent& event); void OnEventMouseMoved(const Nz::EventHandler* eventHandler, const Nz::WindowEvent::MouseMoveEvent& event);
void OnMouseLeft(const Nz::EventHandler* eventHandler); void OnEventMouseLeft(const Nz::EventHandler* eventHandler);
void OnKeyPressed(const Nz::EventHandler* eventHandler, const Nz::WindowEvent::KeyEvent& event); void OnEventKeyPressed(const Nz::EventHandler* eventHandler, const Nz::WindowEvent::KeyEvent& event);
void OnKeyReleased(const Nz::EventHandler* eventHandler, const Nz::WindowEvent::KeyEvent& event); void OnEventKeyReleased(const Nz::EventHandler* eventHandler, const Nz::WindowEvent::KeyEvent& event);
void OnTextEntered(const Nz::EventHandler* eventHandler, const Nz::WindowEvent::TextEvent& event); void OnEventTextEntered(const Nz::EventHandler* eventHandler, const Nz::WindowEvent::TextEvent& event);
struct WidgetBox struct WidgetBox
{ {

View File

@ -20,13 +20,13 @@ namespace Ndk
RegisterToCanvas(); RegisterToCanvas();
// Connect to every meaningful event // Connect to every meaningful event
m_keyPressedSlot.Connect(eventHandler.OnKeyPressed, this, &Canvas::OnKeyPressed); m_keyPressedSlot.Connect(eventHandler.OnKeyPressed, this, &Canvas::OnEventKeyPressed);
m_keyReleasedSlot.Connect(eventHandler.OnKeyReleased, this, &Canvas::OnKeyReleased); m_keyReleasedSlot.Connect(eventHandler.OnKeyReleased, this, &Canvas::OnEventKeyReleased);
m_mouseButtonPressedSlot.Connect(eventHandler.OnMouseButtonPressed, this, &Canvas::OnMouseButtonPressed); m_mouseButtonPressedSlot.Connect(eventHandler.OnMouseButtonPressed, this, &Canvas::OnEventMouseButtonPressed);
m_mouseButtonReleasedSlot.Connect(eventHandler.OnMouseButtonReleased, this, &Canvas::OnMouseButtonRelease); m_mouseButtonReleasedSlot.Connect(eventHandler.OnMouseButtonReleased, this, &Canvas::OnEventMouseButtonRelease);
m_mouseMovedSlot.Connect(eventHandler.OnMouseMoved, this, &Canvas::OnMouseMoved); m_mouseMovedSlot.Connect(eventHandler.OnMouseMoved, this, &Canvas::OnEventMouseMoved);
m_mouseLeftSlot.Connect(eventHandler.OnMouseLeft, this, &Canvas::OnMouseLeft); m_mouseLeftSlot.Connect(eventHandler.OnMouseLeft, this, &Canvas::OnEventMouseLeft);
m_textEnteredSlot.Connect(eventHandler.OnTextEntered, this, &Canvas::OnTextEntered); m_textEnteredSlot.Connect(eventHandler.OnTextEntered, this, &Canvas::OnEventTextEntered);
// Disable padding by default // Disable padding by default
SetPadding(0.f, 0.f, 0.f, 0.f); SetPadding(0.f, 0.f, 0.f, 0.f);

View File

@ -48,7 +48,7 @@ namespace Ndk
m_widgetBoxes.pop_back(); m_widgetBoxes.pop_back();
} }
void Canvas::OnMouseButtonPressed(const Nz::EventHandler* /*eventHandler*/, const Nz::WindowEvent::MouseButtonEvent& event) void Canvas::OnEventMouseButtonPressed(const Nz::EventHandler* /*eventHandler*/, const Nz::WindowEvent::MouseButtonEvent& event)
{ {
if (m_hoveredWidget) if (m_hoveredWidget)
{ {
@ -59,7 +59,7 @@ namespace Ndk
} }
} }
void Canvas::OnMouseButtonRelease(const Nz::EventHandler* /*eventHandler*/, const Nz::WindowEvent::MouseButtonEvent & event) void Canvas::OnEventMouseButtonRelease(const Nz::EventHandler* /*eventHandler*/, const Nz::WindowEvent::MouseButtonEvent & event)
{ {
if (m_hoveredWidget) if (m_hoveredWidget)
{ {
@ -70,7 +70,7 @@ namespace Ndk
} }
} }
void Canvas::OnMouseMoved(const Nz::EventHandler* /*eventHandler*/, const Nz::WindowEvent::MouseMoveEvent& event) void Canvas::OnEventMouseMoved(const Nz::EventHandler* /*eventHandler*/, const Nz::WindowEvent::MouseMoveEvent& event)
{ {
const WidgetBox* bestEntry = nullptr; const WidgetBox* bestEntry = nullptr;
float bestEntryArea = std::numeric_limits<float>::infinity(); float bestEntryArea = std::numeric_limits<float>::infinity();

View File

@ -788,16 +788,17 @@ namespace Nz
template<typename T> template<typename T>
std::enable_if_t<std::is_unsigned<T>::value, T> LuaState::CheckBounds(int index, long long value) const std::enable_if_t<std::is_unsigned<T>::value, T> LuaState::CheckBounds(int index, long long value) const
{ {
unsigned long long uValue = static_cast<unsigned long long>(value);
constexpr unsigned long long minBounds = 0; constexpr unsigned long long minBounds = 0;
constexpr unsigned long long maxBounds = std::numeric_limits<T>::max(); constexpr unsigned long long maxBounds = std::numeric_limits<T>::max();
if (value < minBounds || value > maxBounds) if (uValue < minBounds || uValue > maxBounds)
{ {
Nz::StringStream stream; Nz::StringStream stream;
stream << "Argument #" << index << " is outside value range [" << minBounds << ", " << maxBounds << "] (" << value << ')'; stream << "Argument #" << index << " is outside value range [" << minBounds << ", " << maxBounds << "] (" << value << ')';
Error(stream); Error(stream);
} }
return static_cast<T>(value); return static_cast<T>(uValue);
} }
inline LuaState LuaState::GetState(lua_State* internalState) inline LuaState LuaState::GetState(lua_State* internalState)

View File

@ -697,7 +697,7 @@ namespace Nz
auto it = layers.find(i); auto it = layers.find(i);
if (it == layers.end()) if (it == layers.end())
it = layers.insert(std::make_pair(i, Layer())).first; it = layers.insert(std::make_pair(i, Layer())).first;
Layer& layer = it->second; Layer& layer = it->second;
layer.clearCount = 0; layer.clearCount = 0;
@ -729,7 +729,6 @@ namespace Nz
void ForwardRenderQueue::SortForOrthographic(const AbstractViewer * viewer) void ForwardRenderQueue::SortForOrthographic(const AbstractViewer * viewer)
{ {
Planef nearPlane = viewer->GetFrustum().GetPlane(FrustumPlane_Near); Planef nearPlane = viewer->GetFrustum().GetPlane(FrustumPlane_Near);
Vector3f viewerPos = viewer->GetEyePosition();
for (auto& pair : layers) for (auto& pair : layers)
{ {

View File

@ -60,12 +60,12 @@ namespace Nz
{ {
cpPointQueryInfo queryInfo; cpPointQueryInfo queryInfo;
if (cpShape* shape = cpSpacePointQueryNearest(m_handle, { from.x, from.y }, maxDistance, filter, &queryInfo)) if (cpSpacePointQueryNearest(m_handle, { from.x, from.y }, maxDistance, filter, &queryInfo))
{ {
result->closestPoint.Set(Nz::Vector2<cpFloat>(queryInfo.point.x, queryInfo.point.y)); result->closestPoint.Set(Nz::Vector2<cpFloat>(queryInfo.point.x, queryInfo.point.y));
result->distance = float(queryInfo.distance); result->distance = float(queryInfo.distance);
result->fraction.Set(Nz::Vector2<cpFloat>(queryInfo.gradient.x, queryInfo.gradient.y)); result->fraction.Set(Nz::Vector2<cpFloat>(queryInfo.gradient.x, queryInfo.gradient.y));
result->nearestBody = static_cast<Nz::RigidBody2D*>(cpShapeGetUserData(shape)); result->nearestBody = static_cast<Nz::RigidBody2D*>(cpShapeGetUserData(queryInfo.shape));
return true; return true;
} }
@ -74,7 +74,7 @@ namespace Nz
} }
else else
{ {
if (cpShape* shape = cpSpacePointQueryNearest(m_handle, { from.x, from.y }, maxDistance, filter, nullptr)) if (cpSpacePointQueryNearest(m_handle, { from.x, from.y }, maxDistance, filter, nullptr))
return true; return true;
else else
return false; return false;
@ -114,7 +114,7 @@ namespace Nz
{ {
cpSegmentQueryInfo queryInfo; cpSegmentQueryInfo queryInfo;
if (cpShape* shape = cpSpaceSegmentQueryFirst(m_handle, { from.x, from.y }, { to.x, to.y }, radius, filter, &queryInfo)) if (cpSpaceSegmentQueryFirst(m_handle, { from.x, from.y }, { to.x, to.y }, radius, filter, &queryInfo))
{ {
hitInfo->fraction = float(queryInfo.alpha); hitInfo->fraction = float(queryInfo.alpha);
hitInfo->hitNormal.Set(Nz::Vector2<cpFloat>(queryInfo.normal.x, queryInfo.normal.y)); hitInfo->hitNormal.Set(Nz::Vector2<cpFloat>(queryInfo.normal.x, queryInfo.normal.y));
@ -128,7 +128,7 @@ namespace Nz
} }
else else
{ {
if (cpShape* shape = cpSpaceSegmentQueryFirst(m_handle, { from.x, from.y }, { to.x, to.y }, radius, filter, nullptr)) if (cpSpaceSegmentQueryFirst(m_handle, { from.x, from.y }, { to.x, to.y }, radius, filter, nullptr))
return true; return true;
else else
return false; return false;