summaryrefslogtreecommitdiff
path: root/src/SFML/Window/iOS/WindowImplUIKit.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/SFML/Window/iOS/WindowImplUIKit.mm')
-rw-r--r--src/SFML/Window/iOS/WindowImplUIKit.mm60
1 files changed, 43 insertions, 17 deletions
diff --git a/src/SFML/Window/iOS/WindowImplUIKit.mm b/src/SFML/Window/iOS/WindowImplUIKit.mm
index 35337db..6978205 100644
--- a/src/SFML/Window/iOS/WindowImplUIKit.mm
+++ b/src/SFML/Window/iOS/WindowImplUIKit.mm
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org)
+// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
@@ -33,12 +33,20 @@
#include <SFML/System/Err.hpp>
#include <UIKit/UIKit.h>
+#if defined(__APPLE__)
+ #if defined(__clang__)
+ #pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ #elif defined(__GNUC__)
+ #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+ #endif
+#endif
+
namespace sf
{
namespace priv
{
////////////////////////////////////////////////////////////
-WindowImplUIKit::WindowImplUIKit(WindowHandle handle)
+WindowImplUIKit::WindowImplUIKit(WindowHandle /* handle */)
{
// Not implemented
}
@@ -46,11 +54,11 @@ WindowImplUIKit::WindowImplUIKit(WindowHandle handle)
////////////////////////////////////////////////////////////
WindowImplUIKit::WindowImplUIKit(VideoMode mode,
- const String& title,
+ const String& /* title */,
unsigned long style,
- const ContextSettings& /*settings*/)
+ const ContextSettings& /* settings */)
{
- m_backingScale = [SFAppDelegate getInstance].backingScaleFactor;
+ m_backingScale = static_cast<float>([SFAppDelegate getInstance].backingScaleFactor);
// Apply the fullscreen flag
[UIApplication sharedApplication].statusBarHidden = !(style & Style::Titlebar) || (style & Style::Fullscreen);
@@ -77,7 +85,7 @@ WindowImplUIKit::WindowImplUIKit(VideoMode mode,
std::swap(viewRect.size.width, viewRect.size.height);
// Create the view
- m_view = [[SFView alloc] initWithFrame:viewRect andContentScaleFactor:m_backingScale];
+ m_view = [[SFView alloc] initWithFrame:viewRect andContentScaleFactor:(static_cast<double>(m_backingScale))];
[m_view resignFirstResponder];
// Create the view controller
@@ -108,7 +116,25 @@ void WindowImplUIKit::processEvents()
////////////////////////////////////////////////////////////
WindowHandle WindowImplUIKit::getSystemHandle() const
{
+#if defined(__APPLE__)
+ #if defined(__clang__)
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wold-style-cast"
+ #elif defined(__GNUC__)
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wold-style-cast"
+ #endif
+#endif
+
return (__bridge WindowHandle)m_window;
+
+#if defined(__APPLE__)
+ #if defined(__clang__)
+ #pragma clang diagnostic pop
+ #elif defined(__GNUC__)
+ #pragma GCC diagnostic pop
+ #endif
+#endif
}
@@ -116,12 +142,12 @@ WindowHandle WindowImplUIKit::getSystemHandle() const
Vector2i WindowImplUIKit::getPosition() const
{
CGPoint origin = m_window.frame.origin;
- return Vector2i(origin.x * m_backingScale, origin.y * m_backingScale);
+ return Vector2i(static_cast<int>(origin.x * static_cast<double>(m_backingScale)), static_cast<int>(origin.y * static_cast<double>(m_backingScale)));
}
////////////////////////////////////////////////////////////
-void WindowImplUIKit::setPosition(const Vector2i& position)
+void WindowImplUIKit::setPosition(const Vector2i& /* position */)
{
}
@@ -129,12 +155,12 @@ void WindowImplUIKit::setPosition(const Vector2i& position)
////////////////////////////////////////////////////////////
Vector2u WindowImplUIKit::getSize() const
{
- auto physicalFrame = m_window.frame;
+ CGRect physicalFrame = m_window.frame;
// iOS 7 and 8 do different stuff here. In iOS 7 frame.x<frame.y always! In iOS 8 it correctly depends on orientation
if ((NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_7_1)
&& UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]))
std::swap(physicalFrame.size.width, physicalFrame.size.height);
- return Vector2u(physicalFrame.size.width * m_backingScale, physicalFrame.size.height * m_backingScale);
+ return Vector2u(static_cast<unsigned int>(physicalFrame.size.width * static_cast<double>(m_backingScale)), static_cast<unsigned int>(physicalFrame.size.height * static_cast<double>(m_backingScale)));
}
@@ -156,49 +182,49 @@ void WindowImplUIKit::setSize(const Vector2u& size)
////////////////////////////////////////////////////////////
-void WindowImplUIKit::setTitle(const String& title)
+void WindowImplUIKit::setTitle(const String& /* title */)
{
// Not applicable
}
////////////////////////////////////////////////////////////
-void WindowImplUIKit::setIcon(unsigned int width, unsigned int height, const Uint8* pixels)
+void WindowImplUIKit::setIcon(unsigned int /* width */, unsigned int /* height */, const Uint8* /* pixels */)
{
// Not applicable
}
////////////////////////////////////////////////////////////
-void WindowImplUIKit::setVisible(bool visible)
+void WindowImplUIKit::setVisible(bool /* visible */)
{
// Not applicable
}
////////////////////////////////////////////////////////////
-void WindowImplUIKit::setMouseCursorVisible(bool visible)
+void WindowImplUIKit::setMouseCursorVisible(bool /* visible */)
{
// Not applicable
}
////////////////////////////////////////////////////////////
-void WindowImplUIKit::setMouseCursorGrabbed(bool grabbed)
+void WindowImplUIKit::setMouseCursorGrabbed(bool /* grabbed */)
{
// Not applicable
}
////////////////////////////////////////////////////////////
-void WindowImplUIKit::setMouseCursor(const CursorImpl& cursor)
+void WindowImplUIKit::setMouseCursor(const CursorImpl& /* cursor */)
{
// Not applicable
}
////////////////////////////////////////////////////////////
-void WindowImplUIKit::setKeyRepeatEnabled(bool enabled)
+void WindowImplUIKit::setKeyRepeatEnabled(bool /* enabled */)
{
// Not applicable
}