mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Merge branch '2.6.x' into feature/backmerge
This commit is contained in:
commit
3cd45a283b
@ -70,17 +70,16 @@ function(set_file_warnings)
|
|||||||
${NON_ANDROID_CLANG_AND_GCC_WARNINGS}
|
${NON_ANDROID_CLANG_AND_GCC_WARNINGS}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(WARNINGS_AS_ERRORS)
|
||||||
|
set(CLANG_AND_GCC_WARNINGS ${CLANG_AND_GCC_WARNINGS} -Werror)
|
||||||
|
set(MSVC_WARNINGS ${MSVC_WARNINGS} /WX)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(CLANG_WARNINGS
|
set(CLANG_WARNINGS
|
||||||
${CLANG_AND_GCC_WARNINGS}
|
${CLANG_AND_GCC_WARNINGS}
|
||||||
-Wno-unknown-warning-option # do not warn on GCC-specific warning diagnostic pragmas
|
-Wno-unknown-warning-option # do not warn on GCC-specific warning diagnostic pragmas
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WARNINGS_AS_ERRORS)
|
|
||||||
set(CLANG_AND_GCC_WARNINGS ${CLANG_AND_GCC_WARNINGS} -Werror)
|
|
||||||
set(MSVC_WARNINGS ${MSVC_WARNINGS} /WX)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(GCC_WARNINGS
|
set(GCC_WARNINGS
|
||||||
${CLANG_AND_GCC_WARNINGS}
|
${CLANG_AND_GCC_WARNINGS}
|
||||||
${NON_ANDROID_GCC_WARNINGS}
|
${NON_ANDROID_GCC_WARNINGS}
|
||||||
|
@ -31,6 +31,14 @@
|
|||||||
#define GREEN @"Green"
|
#define GREEN @"Green"
|
||||||
#define RED @"Red"
|
#define RED @"Red"
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// Our PIMPL
|
// Our PIMPL
|
||||||
struct SFMLmainWindow
|
struct SFMLmainWindow
|
||||||
{
|
{
|
||||||
@ -117,7 +125,7 @@ struct SFMLmainWindow
|
|||||||
self.visible = YES;
|
self.visible = YES;
|
||||||
|
|
||||||
// Launch the timer to periodically display our stuff into the Cocoa view.
|
// Launch the timer to periodically display our stuff into the Cocoa view.
|
||||||
self.renderTimer = [NSTimer timerWithTimeInterval:1.f/60.f
|
self.renderTimer = [NSTimer timerWithTimeInterval:1.0/60.0
|
||||||
target:self
|
target:self
|
||||||
selector:@selector(renderMainWindow:)
|
selector:@selector(renderMainWindow:)
|
||||||
userInfo:nil
|
userInfo:nil
|
||||||
@ -148,7 +156,7 @@ struct SFMLmainWindow
|
|||||||
self.sfmlView = nil;
|
self.sfmlView = nil;
|
||||||
self.textField = nil;
|
self.textField = nil;
|
||||||
|
|
||||||
delete (SFMLmainWindow*) self.mainWindow;
|
delete static_cast<SFMLmainWindow*>(self.mainWindow);
|
||||||
self.mainWindow = 0;
|
self.mainWindow = 0;
|
||||||
self.renderTimer = nil;
|
self.renderTimer = nil;
|
||||||
|
|
||||||
|
@ -42,8 +42,8 @@
|
|||||||
|
|
||||||
+(id)stringWithstdwstring:(const std::wstring&)string
|
+(id)stringWithstdwstring:(const std::wstring&)string
|
||||||
{
|
{
|
||||||
char* data = (char*)string.data();
|
const void* data = static_cast<const void*>(string.data());
|
||||||
unsigned size = string.size() * sizeof(wchar_t);
|
unsigned size = static_cast<unsigned>(string.size() * sizeof(wchar_t));
|
||||||
|
|
||||||
NSString* str = [[[NSString alloc] initWithBytes:data length:size
|
NSString* str = [[[NSString alloc] initWithBytes:data length:size
|
||||||
encoding:NSUTF32LittleEndianStringEncoding] autorelease];
|
encoding:NSUTF32LittleEndianStringEncoding] autorelease];
|
||||||
@ -67,7 +67,7 @@
|
|||||||
// According to Wikipedia, Mac OS X is Little Endian on x86 and x86-64
|
// According to Wikipedia, Mac OS X is Little Endian on x86 and x86-64
|
||||||
// https://en.wikipedia.org/wiki/Endianness
|
// https://en.wikipedia.org/wiki/Endianness
|
||||||
NSData* asData = [self dataUsingEncoding:NSUTF32LittleEndianStringEncoding];
|
NSData* asData = [self dataUsingEncoding:NSUTF32LittleEndianStringEncoding];
|
||||||
return std::wstring((wchar_t*)[asData bytes], [asData length] / sizeof(wchar_t));
|
return std::wstring(static_cast<const wchar_t*>([asData bytes]), [asData length] / sizeof(wchar_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -228,8 +228,8 @@ public:
|
|||||||
for (std::size_t i = 0; i < m_entities.size(); ++i)
|
for (std::size_t i = 0; i < m_entities.size(); ++i)
|
||||||
{
|
{
|
||||||
sf::Vector2f position;
|
sf::Vector2f position;
|
||||||
position.x = std::cos(0.25f * (time * static_cast<float>(i + (m_entities.size() - i)))) * 300 + 350;
|
position.x = std::cos(0.25f * (time * static_cast<float>(i) + static_cast<float>(m_entities.size() - i))) * 300 + 350;
|
||||||
position.y = std::sin(0.25f * (time * static_cast<float>((m_entities.size() - i) + i))) * 200 + 250;
|
position.y = std::sin(0.25f * (time * static_cast<float>(m_entities.size() - i) + static_cast<float>(i))) * 200 + 250;
|
||||||
m_entities[i].setPosition(position);
|
m_entities[i].setPosition(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,8 +194,15 @@ namespace sf
|
|||||||
using Int64 = signed __int64;
|
using Int64 = signed __int64;
|
||||||
using Uint64 = unsigned __int64;
|
using Uint64 = unsigned __int64;
|
||||||
#else
|
#else
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wc++11-long-long"
|
||||||
|
#endif
|
||||||
using Int64 = long long;
|
using Int64 = long long;
|
||||||
using Uint64 = unsigned long long;
|
using Uint64 = unsigned long long;
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Config.hpp>
|
#include <SFML/Config.hpp>
|
||||||
|
#include <iterator>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
@ -39,7 +39,7 @@ template <typename InputIt, typename OutputIt>
|
|||||||
OutputIt priv::copy(InputIt first, InputIt last, OutputIt d_first)
|
OutputIt priv::copy(InputIt first, InputIt last, OutputIt d_first)
|
||||||
{
|
{
|
||||||
while (first != last)
|
while (first != last)
|
||||||
*d_first++ = *first++;
|
*d_first++ = static_cast<typename OutputIt::container_type::value_type>(*first++);
|
||||||
|
|
||||||
return d_first;
|
return d_first;
|
||||||
}
|
}
|
||||||
@ -106,7 +106,7 @@ Out Utf<8>::encode(Uint32 input, Out output, Uint8 replacement)
|
|||||||
{
|
{
|
||||||
// Invalid character
|
// Invalid character
|
||||||
if (replacement)
|
if (replacement)
|
||||||
*output++ = replacement;
|
*output++ = static_cast<typename Out::container_type::value_type>(replacement);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -29,6 +29,13 @@
|
|||||||
#include <SFML/System/Err.hpp>
|
#include <SFML/System/Err.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#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 sf
|
||||||
{
|
{
|
||||||
|
@ -30,6 +30,16 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Config.hpp>
|
#include <SFML/Config.hpp>
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <al.h>
|
#include <al.h>
|
||||||
#include <alc.h>
|
#include <alc.h>
|
||||||
|
|
||||||
@ -70,3 +80,11 @@ void alCheckError(const char* file, unsigned int line, const char* expression);
|
|||||||
|
|
||||||
|
|
||||||
#endif // SFML_ALCHECK_HPP
|
#endif // SFML_ALCHECK_HPP
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
@ -31,6 +31,13 @@
|
|||||||
#include <SFML/System/Err.hpp>
|
#include <SFML/System/Err.hpp>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -32,6 +32,13 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
|
#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 sf
|
||||||
{
|
{
|
||||||
|
@ -29,6 +29,13 @@
|
|||||||
#include <SFML/Audio/SoundBuffer.hpp>
|
#include <SFML/Audio/SoundBuffer.hpp>
|
||||||
#include <SFML/Audio/ALCheck.hpp>
|
#include <SFML/Audio/ALCheck.hpp>
|
||||||
|
|
||||||
|
#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 sf
|
||||||
{
|
{
|
||||||
|
@ -34,6 +34,13 @@
|
|||||||
#include <SFML/System/Err.hpp>
|
#include <SFML/System/Err.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#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 sf
|
||||||
{
|
{
|
||||||
|
@ -37,6 +37,13 @@
|
|||||||
#pragma warning(disable: 4355) // 'this' used in base member initializer list
|
#pragma warning(disable: 4355) // 'this' used in base member initializer list
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -28,6 +28,13 @@
|
|||||||
#include <SFML/Audio/SoundSource.hpp>
|
#include <SFML/Audio/SoundSource.hpp>
|
||||||
#include <SFML/Audio/ALCheck.hpp>
|
#include <SFML/Audio/ALCheck.hpp>
|
||||||
|
|
||||||
|
#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 sf
|
||||||
{
|
{
|
||||||
|
@ -37,6 +37,13 @@
|
|||||||
#pragma warning(disable: 4355) // 'this' used in base member initializer list
|
#pragma warning(disable: 4355) // 'this' used in base member initializer list
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#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 sf
|
||||||
{
|
{
|
||||||
|
@ -498,7 +498,10 @@ void RenderTarget::resetGLStates()
|
|||||||
// Workaround for states not being properly reset on
|
// Workaround for states not being properly reset on
|
||||||
// macOS unless a context switch really takes place
|
// macOS unless a context switch really takes place
|
||||||
#if defined(SFML_SYSTEM_MACOS)
|
#if defined(SFML_SYSTEM_MACOS)
|
||||||
setActive(false);
|
if (!setActive(false))
|
||||||
|
{
|
||||||
|
err() << "Failed to set render target inactive" << std::endl;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (RenderTargetImpl::isActive(m_id) || setActive(true))
|
if (RenderTargetImpl::isActive(m_id) || setActive(true))
|
||||||
|
@ -976,196 +976,196 @@ Shader::~Shader()
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool Shader::loadFromFile(const std::string& filename, Type type)
|
bool Shader::loadFromFile(const std::string& /* filename */, Type /* type */)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool Shader::loadFromFile(const std::string& vertexShaderFilename, const std::string& fragmentShaderFilename)
|
bool Shader::loadFromFile(const std::string& /* vertexShaderFilename */, const std::string& /* fragmentShaderFilename */)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool Shader::loadFromFile(const std::string& vertexShaderFilename, const std::string& geometryShaderFilename, const std::string& fragmentShaderFilename)
|
bool Shader::loadFromFile(const std::string& /* vertexShaderFilename */, const std::string& /* geometryShaderFilename */, const std::string& /* fragmentShaderFilename */)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool Shader::loadFromMemory(const std::string& shader, Type type)
|
bool Shader::loadFromMemory(const std::string& /* shader */, Type /* type */)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool Shader::loadFromMemory(const std::string& vertexShader, const std::string& fragmentShader)
|
bool Shader::loadFromMemory(const std::string& /* vertexShader */, const std::string& /* fragmentShader */)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool Shader::loadFromMemory(const std::string& vertexShader, const std::string& geometryShader, const std::string& fragmentShader)
|
bool Shader::loadFromMemory(const std::string& /* vertexShader */, const std::string& /* geometryShader */, const std::string& /* fragmentShader */)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool Shader::loadFromStream(InputStream& stream, Type type)
|
bool Shader::loadFromStream(InputStream& /* stream */, Type /* type */)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool Shader::loadFromStream(InputStream& vertexShaderStream, InputStream& fragmentShaderStream)
|
bool Shader::loadFromStream(InputStream& /* vertexShaderStream */, InputStream& /* fragmentShaderStream */)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool Shader::loadFromStream(InputStream& vertexShaderStream, InputStream& geometryShaderStream, InputStream& fragmentShaderStream)
|
bool Shader::loadFromStream(InputStream& /* vertexShaderStream */, InputStream& /* geometryShaderStream */, InputStream& /* fragmentShaderStream */)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Shader::setUniform(const std::string& name, float x)
|
void Shader::setUniform(const std::string& /* name */, float)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Shader::setUniform(const std::string& name, const Glsl::Vec2& v)
|
void Shader::setUniform(const std::string& /* name */, const Glsl::Vec2&)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Shader::setUniform(const std::string& name, const Glsl::Vec3& v)
|
void Shader::setUniform(const std::string& /* name */, const Glsl::Vec3&)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Shader::setUniform(const std::string& name, const Glsl::Vec4& v)
|
void Shader::setUniform(const std::string& /* name */, const Glsl::Vec4&)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Shader::setUniform(const std::string& name, int x)
|
void Shader::setUniform(const std::string& /* name */, int)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Shader::setUniform(const std::string& name, const Glsl::Ivec2& v)
|
void Shader::setUniform(const std::string& /* name */, const Glsl::Ivec2&)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Shader::setUniform(const std::string& name, const Glsl::Ivec3& v)
|
void Shader::setUniform(const std::string& /* name */, const Glsl::Ivec3&)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Shader::setUniform(const std::string& name, const Glsl::Ivec4& v)
|
void Shader::setUniform(const std::string& /* name */, const Glsl::Ivec4&)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Shader::setUniform(const std::string& name, bool x)
|
void Shader::setUniform(const std::string& /* name */, bool)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Shader::setUniform(const std::string& name, const Glsl::Bvec2& v)
|
void Shader::setUniform(const std::string& /* name */, const Glsl::Bvec2&)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Shader::setUniform(const std::string& name, const Glsl::Bvec3& v)
|
void Shader::setUniform(const std::string& /* name */, const Glsl::Bvec3&)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Shader::setUniform(const std::string& name, const Glsl::Bvec4& v)
|
void Shader::setUniform(const std::string& /* name */, const Glsl::Bvec4&)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Shader::setUniform(const std::string& name, const Glsl::Mat3& matrix)
|
void Shader::setUniform(const std::string& /* name */, const Glsl::Mat3& /* matrix */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Shader::setUniform(const std::string& name, const Glsl::Mat4& matrix)
|
void Shader::setUniform(const std::string& /* name */, const Glsl::Mat4& /* matrix */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Shader::setUniform(const std::string& name, const Texture& texture)
|
void Shader::setUniform(const std::string& /* name */, const Texture& /* texture */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Shader::setUniform(const std::string& name, CurrentTextureType)
|
void Shader::setUniform(const std::string& /* name */, CurrentTextureType)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Shader::setUniformArray(const std::string& name, const float* scalarArray, std::size_t length)
|
void Shader::setUniformArray(const std::string& /* name */, const float* /* scalarArray */, std::size_t /* length */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Shader::setUniformArray(const std::string& name, const Glsl::Vec2* vectorArray, std::size_t length)
|
void Shader::setUniformArray(const std::string& /* name */, const Glsl::Vec2* /* vectorArray */, std::size_t /* length */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Shader::setUniformArray(const std::string& name, const Glsl::Vec3* vectorArray, std::size_t length)
|
void Shader::setUniformArray(const std::string& /* name */, const Glsl::Vec3* /* vectorArray */, std::size_t /* length */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Shader::setUniformArray(const std::string& name, const Glsl::Vec4* vectorArray, std::size_t length)
|
void Shader::setUniformArray(const std::string& /* name */, const Glsl::Vec4* /* vectorArray */, std::size_t /* length */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Shader::setUniformArray(const std::string& name, const Glsl::Mat3* matrixArray, std::size_t length)
|
void Shader::setUniformArray(const std::string& /* name */, const Glsl::Mat3* /* matrixArray */, std::size_t /* length */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Shader::setUniformArray(const std::string& name, const Glsl::Mat4* matrixArray, std::size_t length)
|
void Shader::setUniformArray(const std::string& /* name */, const Glsl::Mat4* /* matrixArray */, std::size_t /* length */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1178,7 +1178,7 @@ unsigned int Shader::getNativeHandle() const
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Shader::bind(const Shader* shader)
|
void Shader::bind(const Shader* /* shader */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1198,7 +1198,7 @@ bool Shader::isGeometryAvailable()
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool Shader::compile(const char* vertexShaderCode, const char* geometryShaderCode, const char* fragmentShaderCode)
|
bool Shader::compile(const char* /* vertexShaderCode */, const char* /* geometryShaderCode */, const char* /* fragmentShaderCode */)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -209,6 +209,7 @@ bool VertexBuffer::update(const VertexBuffer& vertexBuffer)
|
|||||||
{
|
{
|
||||||
#ifdef SFML_OPENGL_ES
|
#ifdef SFML_OPENGL_ES
|
||||||
|
|
||||||
|
(void) vertexBuffer;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -68,7 +68,7 @@ const char *getLibraryName(JNIEnv* lJNIEnv, jobject& objectActivityInfo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Convert the application name to a C++ string and return it
|
// Convert the application name to a C++ string and return it
|
||||||
const jsize applicationNameLength = lJNIEnv->GetStringUTFLength(valueString);
|
const size_t applicationNameLength = static_cast<size_t>(lJNIEnv->GetStringUTFLength(valueString));
|
||||||
const char* applicationName = lJNIEnv->GetStringUTFChars(valueString, nullptr);
|
const char* applicationName = lJNIEnv->GetStringUTFChars(valueString, nullptr);
|
||||||
|
|
||||||
if (applicationNameLength >= 256)
|
if (applicationNameLength >= 256)
|
||||||
@ -77,7 +77,7 @@ const char *getLibraryName(JNIEnv* lJNIEnv, jobject& objectActivityInfo)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(name, applicationName, applicationNameLength);
|
strncpy(name, applicationName, static_cast<size_t>(applicationNameLength));
|
||||||
name[applicationNameLength] = '\0';
|
name[applicationNameLength] = '\0';
|
||||||
lJNIEnv->ReleaseStringUTFChars(valueString, applicationName);
|
lJNIEnv->ReleaseStringUTFChars(valueString, applicationName);
|
||||||
|
|
||||||
@ -141,7 +141,6 @@ void ANativeActivity_onCreate(ANativeActivity* activity, void* savedState, size_
|
|||||||
// With libname being the library name such as "jpeg".
|
// With libname being the library name such as "jpeg".
|
||||||
|
|
||||||
// Retrieve JNI environment and JVM instance
|
// Retrieve JNI environment and JVM instance
|
||||||
JavaVM* lJavaVM = activity->vm;
|
|
||||||
JNIEnv* lJNIEnv = activity->env;
|
JNIEnv* lJNIEnv = activity->env;
|
||||||
|
|
||||||
// Retrieve the NativeActivity
|
// Retrieve the NativeActivity
|
||||||
|
@ -158,7 +158,7 @@ bool SocketSelector::wait(Time timeout)
|
|||||||
// Setup the timeout
|
// Setup the timeout
|
||||||
timeval time;
|
timeval time;
|
||||||
time.tv_sec = static_cast<long>(timeout.asMicroseconds() / 1000000);
|
time.tv_sec = static_cast<long>(timeout.asMicroseconds() / 1000000);
|
||||||
time.tv_usec = static_cast<long>(timeout.asMicroseconds() % 1000000);
|
time.tv_usec = static_cast<int>(timeout.asMicroseconds() % 1000000);
|
||||||
|
|
||||||
// Initialize the set that will contain the sockets that are ready
|
// Initialize the set that will contain the sockets that are ready
|
||||||
m_impl->socketsReady = m_impl->allSockets;
|
m_impl->socketsReady = m_impl->allSockets;
|
||||||
|
@ -175,7 +175,7 @@ Socket::Status TcpSocket::connect(const IpAddress& remoteAddress, unsigned short
|
|||||||
// Setup the timeout
|
// Setup the timeout
|
||||||
timeval time;
|
timeval time;
|
||||||
time.tv_sec = static_cast<long>(timeout.asMicroseconds() / 1000000);
|
time.tv_sec = static_cast<long>(timeout.asMicroseconds() / 1000000);
|
||||||
time.tv_usec = static_cast<long>(timeout.asMicroseconds() % 1000000);
|
time.tv_usec = static_cast<int>(timeout.asMicroseconds() % 1000000);
|
||||||
|
|
||||||
// Wait for something to write on our socket (which means that the connection request has returned)
|
// Wait for something to write on our socket (which means that the connection request has returned)
|
||||||
if (select(static_cast<int>(getHandle() + 1), nullptr, &selector, nullptr, &time) > 0)
|
if (select(static_cast<int>(getHandle() + 1), nullptr, &selector, nullptr, &time) > 0)
|
||||||
|
@ -41,14 +41,14 @@ std::streambuf()
|
|||||||
|
|
||||||
std::streambuf::int_type LogcatStream::overflow (std::streambuf::int_type c)
|
std::streambuf::int_type LogcatStream::overflow (std::streambuf::int_type c)
|
||||||
{
|
{
|
||||||
if (c == "\n"[0])
|
if (c == '\n')
|
||||||
{
|
{
|
||||||
m_message.push_back(c);
|
m_message.push_back(static_cast<char>(c));
|
||||||
LOGE("%s", m_message.c_str());
|
LOGE("%s", m_message.c_str());
|
||||||
m_message.clear();
|
m_message.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_message.push_back(c);
|
m_message.push_back(static_cast<char>(c));
|
||||||
|
|
||||||
return traits_type::not_eof(c);
|
return traits_type::not_eof(c);
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ Int64 ResourceStream::read(void *data, Int64 size)
|
|||||||
{
|
{
|
||||||
if (m_file)
|
if (m_file)
|
||||||
{
|
{
|
||||||
return AAsset_read(m_file, data, size);
|
return AAsset_read(m_file, data, static_cast<size_t>(size));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -75,7 +75,7 @@ Int64 ResourceStream::seek(Int64 position)
|
|||||||
{
|
{
|
||||||
if (m_file)
|
if (m_file)
|
||||||
{
|
{
|
||||||
return AAsset_seek(m_file, position, SEEK_SET);
|
return AAsset_seek(m_file, static_cast<off_t>(position), SEEK_SET);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ String ClipboardImpl::getString()
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void ClipboardImpl::setString(const String& text)
|
void ClipboardImpl::setString(const String& /* text */)
|
||||||
{
|
{
|
||||||
sf::err() << "Clipboard API not implemented for Android.\n";
|
sf::err() << "Clipboard API not implemented for Android.\n";
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ CursorImpl::~CursorImpl()
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool CursorImpl::loadFromPixels(const Uint8* pixels, Vector2u size, Vector2u hotspot)
|
bool CursorImpl::loadFromPixels(const Uint8* /* pixels */, Vector2u /* size */, Vector2u /* hotspot */)
|
||||||
{
|
{
|
||||||
// Not supported
|
// Not supported
|
||||||
return false;
|
return false;
|
||||||
@ -55,7 +55,7 @@ bool CursorImpl::loadFromPixels(const Uint8* pixels, Vector2u size, Vector2u hot
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool CursorImpl::loadFromSystem(Cursor::Type type)
|
bool CursorImpl::loadFromSystem(Cursor::Type /* type */)
|
||||||
{
|
{
|
||||||
// Not supported
|
// Not supported
|
||||||
return false;
|
return false;
|
||||||
|
@ -37,7 +37,7 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool InputImpl::isKeyPressed(Keyboard::Key key)
|
bool InputImpl::isKeyPressed(Keyboard::Key /* key */)
|
||||||
{
|
{
|
||||||
// Not applicable
|
// Not applicable
|
||||||
return false;
|
return false;
|
||||||
@ -52,7 +52,6 @@ void InputImpl::setVirtualKeyboardVisible(bool visible)
|
|||||||
std::scoped_lock lock(states.mutex);
|
std::scoped_lock lock(states.mutex);
|
||||||
|
|
||||||
// Initializes JNI
|
// Initializes JNI
|
||||||
jint lResult;
|
|
||||||
jint lFlags = 0;
|
jint lFlags = 0;
|
||||||
|
|
||||||
JavaVM* lJavaVM = states.activity->vm;
|
JavaVM* lJavaVM = states.activity->vm;
|
||||||
@ -63,7 +62,7 @@ void InputImpl::setVirtualKeyboardVisible(bool visible)
|
|||||||
lJavaVMAttachArgs.name = "NativeThread";
|
lJavaVMAttachArgs.name = "NativeThread";
|
||||||
lJavaVMAttachArgs.group = nullptr;
|
lJavaVMAttachArgs.group = nullptr;
|
||||||
|
|
||||||
lResult=lJavaVM->AttachCurrentThread(&lJNIEnv, &lJavaVMAttachArgs);
|
jint lResult = lJavaVM->AttachCurrentThread(&lJNIEnv, &lJavaVMAttachArgs);
|
||||||
|
|
||||||
if (lResult == JNI_ERR)
|
if (lResult == JNI_ERR)
|
||||||
err() << "Failed to initialize JNI, couldn't switch the keyboard visibility" << std::endl;
|
err() << "Failed to initialize JNI, couldn't switch the keyboard visibility" << std::endl;
|
||||||
@ -105,7 +104,7 @@ void InputImpl::setVirtualKeyboardVisible(bool visible)
|
|||||||
// Runs lInputMethodManager.showSoftInput(...)
|
// Runs lInputMethodManager.showSoftInput(...)
|
||||||
jmethodID MethodShowSoftInput = lJNIEnv->GetMethodID(ClassInputMethodManager,
|
jmethodID MethodShowSoftInput = lJNIEnv->GetMethodID(ClassInputMethodManager,
|
||||||
"showSoftInput", "(Landroid/view/View;I)Z");
|
"showSoftInput", "(Landroid/view/View;I)Z");
|
||||||
jboolean lResult = lJNIEnv->CallBooleanMethod(lInputMethodManager,
|
lJNIEnv->CallBooleanMethod(lInputMethodManager,
|
||||||
MethodShowSoftInput, lDecorView, lFlags);
|
MethodShowSoftInput, lDecorView, lFlags);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -121,7 +120,7 @@ void InputImpl::setVirtualKeyboardVisible(bool visible)
|
|||||||
// lInputMethodManager.hideSoftInput(...)
|
// lInputMethodManager.hideSoftInput(...)
|
||||||
jmethodID MethodHideSoftInput = lJNIEnv->GetMethodID(ClassInputMethodManager,
|
jmethodID MethodHideSoftInput = lJNIEnv->GetMethodID(ClassInputMethodManager,
|
||||||
"hideSoftInputFromWindow", "(Landroid/os/IBinder;I)Z");
|
"hideSoftInputFromWindow", "(Landroid/os/IBinder;I)Z");
|
||||||
jboolean lRes = lJNIEnv->CallBooleanMethod(lInputMethodManager,
|
lJNIEnv->CallBooleanMethod(lInputMethodManager,
|
||||||
MethodHideSoftInput, lBinder, lFlags);
|
MethodHideSoftInput, lBinder, lFlags);
|
||||||
lJNIEnv->DeleteLocalRef(lBinder);
|
lJNIEnv->DeleteLocalRef(lBinder);
|
||||||
}
|
}
|
||||||
@ -158,21 +157,21 @@ Vector2i InputImpl::getMousePosition()
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Vector2i InputImpl::getMousePosition(const WindowBase& relativeTo)
|
Vector2i InputImpl::getMousePosition(const WindowBase& /* relativeTo */)
|
||||||
{
|
{
|
||||||
return getMousePosition();
|
return getMousePosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void InputImpl::setMousePosition(const Vector2i& position)
|
void InputImpl::setMousePosition(const Vector2i& /* position */)
|
||||||
{
|
{
|
||||||
// Injecting events is impossible on Android
|
// Injecting events is impossible on Android
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void InputImpl::setMousePosition(const Vector2i& position, const WindowBase& relativeTo)
|
void InputImpl::setMousePosition(const Vector2i& position, const WindowBase& /* relativeTo */)
|
||||||
{
|
{
|
||||||
setMousePosition(position);
|
setMousePosition(position);
|
||||||
}
|
}
|
||||||
@ -186,7 +185,7 @@ bool InputImpl::isTouchDown(unsigned int finger)
|
|||||||
ActivityStates& states = getActivity();
|
ActivityStates& states = getActivity();
|
||||||
std::scoped_lock lock(states.mutex);
|
std::scoped_lock lock(states.mutex);
|
||||||
|
|
||||||
return states.touchEvents.find(finger) != states.touchEvents.end();
|
return states.touchEvents.find(static_cast<int>(finger)) != states.touchEvents.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -198,12 +197,12 @@ Vector2i InputImpl::getTouchPosition(unsigned int finger)
|
|||||||
ActivityStates& states = getActivity();
|
ActivityStates& states = getActivity();
|
||||||
std::scoped_lock lock(states.mutex);
|
std::scoped_lock lock(states.mutex);
|
||||||
|
|
||||||
return states.touchEvents.find(finger)->second;
|
return states.touchEvents.find(static_cast<int>(finger))->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Vector2i InputImpl::getTouchPosition(unsigned int finger, const WindowBase& relativeTo)
|
Vector2i InputImpl::getTouchPosition(unsigned int finger, const WindowBase& /* relativeTo */)
|
||||||
{
|
{
|
||||||
return getTouchPosition(finger);
|
return getTouchPosition(finger);
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ void JoystickImpl::cleanup()
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool JoystickImpl::isConnected(unsigned int index)
|
bool JoystickImpl::isConnected(unsigned int /* index */)
|
||||||
{
|
{
|
||||||
// To implement
|
// To implement
|
||||||
return false;
|
return false;
|
||||||
@ -56,7 +56,7 @@ bool JoystickImpl::isConnected(unsigned int index)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool JoystickImpl::open(unsigned int index)
|
bool JoystickImpl::open(unsigned int /* index */)
|
||||||
{
|
{
|
||||||
// To implement
|
// To implement
|
||||||
return false;
|
return false;
|
||||||
|
@ -105,7 +105,6 @@ private:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
int m_index; ///< Index of the joystick
|
|
||||||
Joystick::Identification m_identification; ///< Joystick identification
|
Joystick::Identification m_identification; ///< Joystick identification
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -29,6 +29,12 @@
|
|||||||
#include <SFML/System/Time.hpp>
|
#include <SFML/System/Time.hpp>
|
||||||
#include <android/looper.h>
|
#include <android/looper.h>
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
|
||||||
// Define missing constants
|
// Define missing constants
|
||||||
#define ASENSOR_TYPE_GRAVITY 0x00000009
|
#define ASENSOR_TYPE_GRAVITY 0x00000009
|
||||||
#define ASENSOR_TYPE_LINEAR_ACCELERATION 0x0000000a
|
#define ASENSOR_TYPE_LINEAR_ACCELERATION 0x0000000a
|
||||||
@ -54,7 +60,11 @@ void SensorImpl::initialize()
|
|||||||
looper = ALooper_forThread();
|
looper = ALooper_forThread();
|
||||||
|
|
||||||
// Get the unique sensor manager
|
// Get the unique sensor manager
|
||||||
|
#if ANDROID_API >= 26 || __ANDROID_API__ >= 26
|
||||||
|
sensorManager = ASensorManager_getInstanceForPackage(nullptr);
|
||||||
|
#else
|
||||||
sensorManager = ASensorManager_getInstance();
|
sensorManager = ASensorManager_getInstance();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Create the sensor events queue and attach it to the looper
|
// Create the sensor events queue and attach it to the looper
|
||||||
sensorEventQueue = ASensorManager_createEventQueue(sensorManager, looper,
|
sensorEventQueue = ASensorManager_createEventQueue(sensorManager, looper,
|
||||||
@ -93,7 +103,7 @@ bool SensorImpl::open(Sensor::Type sensor)
|
|||||||
Time minimumDelay = microseconds(ASensor_getMinDelay(m_sensor));
|
Time minimumDelay = microseconds(ASensor_getMinDelay(m_sensor));
|
||||||
|
|
||||||
// Set the event rate (not to consume too much battery)
|
// Set the event rate (not to consume too much battery)
|
||||||
ASensorEventQueue_setEventRate(sensorEventQueue, m_sensor, minimumDelay.asMicroseconds());
|
ASensorEventQueue_setEventRate(sensorEventQueue, m_sensor, static_cast<Int32>(minimumDelay.asMicroseconds()));
|
||||||
|
|
||||||
// Save the index of the sensor
|
// Save the index of the sensor
|
||||||
m_index = static_cast<unsigned int>(sensor);
|
m_index = static_cast<unsigned int>(sensor);
|
||||||
@ -145,7 +155,7 @@ ASensor const* SensorImpl::getDefaultSensor(Sensor::Type sensor)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
int SensorImpl::processSensorEvents(int fd, int events, void* data)
|
int SensorImpl::processSensorEvents(int /* fd */, int /* events */, void* /* sensorData */)
|
||||||
{
|
{
|
||||||
ASensorEvent event;
|
ASensorEvent event;
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ VideoMode VideoModeImpl::getDesktopMode()
|
|||||||
priv::ActivityStates& states = priv::getActivity();
|
priv::ActivityStates& states = priv::getActivity();
|
||||||
std::scoped_lock lock(states.mutex);
|
std::scoped_lock lock(states.mutex);
|
||||||
|
|
||||||
return VideoMode(states.screenSize.x, states.screenSize.y);
|
return VideoMode(static_cast<unsigned int>(states.screenSize.x), static_cast<unsigned int>(states.screenSize.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace priv
|
} // namespace priv
|
||||||
|
@ -49,7 +49,7 @@ namespace priv
|
|||||||
WindowImplAndroid* WindowImplAndroid::singleInstance = nullptr;
|
WindowImplAndroid* WindowImplAndroid::singleInstance = nullptr;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImplAndroid::WindowImplAndroid(WindowHandle handle)
|
WindowImplAndroid::WindowImplAndroid(WindowHandle /* handle */)
|
||||||
: m_size(0, 0)
|
: m_size(0, 0)
|
||||||
, m_windowBeingCreated(false)
|
, m_windowBeingCreated(false)
|
||||||
, m_windowBeingDestroyed(false)
|
, m_windowBeingDestroyed(false)
|
||||||
@ -59,7 +59,7 @@ WindowImplAndroid::WindowImplAndroid(WindowHandle handle)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImplAndroid::WindowImplAndroid(VideoMode mode, const String& title, unsigned long style, const ContextSettings& settings)
|
WindowImplAndroid::WindowImplAndroid(VideoMode mode, const String& /* title */, unsigned long style, const ContextSettings& /* settings */)
|
||||||
: m_size(mode.width, mode.height)
|
: m_size(mode.width, mode.height)
|
||||||
, m_windowBeingCreated(false)
|
, m_windowBeingCreated(false)
|
||||||
, m_windowBeingDestroyed(false)
|
, m_windowBeingDestroyed(false)
|
||||||
@ -132,7 +132,7 @@ Vector2i WindowImplAndroid::getPosition() const
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplAndroid::setPosition(const Vector2i& position)
|
void WindowImplAndroid::setPosition(const Vector2i& /* position */)
|
||||||
{
|
{
|
||||||
// Not applicable
|
// Not applicable
|
||||||
}
|
}
|
||||||
@ -146,55 +146,55 @@ Vector2u WindowImplAndroid::getSize() const
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplAndroid::setSize(const Vector2u& size)
|
void WindowImplAndroid::setSize(const Vector2u& /* size */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplAndroid::setTitle(const String& title)
|
void WindowImplAndroid::setTitle(const String& /* title */)
|
||||||
{
|
{
|
||||||
// Not applicable
|
// Not applicable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplAndroid::setIcon(unsigned int width, unsigned int height, const Uint8* pixels)
|
void WindowImplAndroid::setIcon(unsigned int /* width */, unsigned int /* height */, const Uint8* /* pixels */)
|
||||||
{
|
{
|
||||||
// Not applicable
|
// Not applicable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplAndroid::setVisible(bool visible)
|
void WindowImplAndroid::setVisible(bool /* visible */)
|
||||||
{
|
{
|
||||||
// Not applicable
|
// Not applicable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplAndroid::setMouseCursorVisible(bool visible)
|
void WindowImplAndroid::setMouseCursorVisible(bool /* visible */)
|
||||||
{
|
{
|
||||||
// Not applicable
|
// Not applicable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplAndroid::setMouseCursorGrabbed(bool grabbed)
|
void WindowImplAndroid::setMouseCursorGrabbed(bool /* grabbed */)
|
||||||
{
|
{
|
||||||
// Not applicable
|
// Not applicable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplAndroid::setMouseCursor(const CursorImpl& cursor)
|
void WindowImplAndroid::setMouseCursor(const CursorImpl& /* cursor */)
|
||||||
{
|
{
|
||||||
// Not applicable
|
// Not applicable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplAndroid::setKeyRepeatEnabled(bool enabled)
|
void WindowImplAndroid::setKeyRepeatEnabled(bool /* enabled */)
|
||||||
{
|
{
|
||||||
// Not applicable
|
// Not applicable
|
||||||
}
|
}
|
||||||
@ -223,8 +223,8 @@ void WindowImplAndroid::forwardEvent(const Event& event)
|
|||||||
|
|
||||||
if (event.type == Event::GainedFocus)
|
if (event.type == Event::GainedFocus)
|
||||||
{
|
{
|
||||||
WindowImplAndroid::singleInstance->m_size.x = ANativeWindow_getWidth(states.window);
|
WindowImplAndroid::singleInstance->m_size.x = static_cast<unsigned int>(ANativeWindow_getWidth(states.window));
|
||||||
WindowImplAndroid::singleInstance->m_size.y = ANativeWindow_getHeight(states.window);
|
WindowImplAndroid::singleInstance->m_size.y = static_cast<unsigned int>(ANativeWindow_getHeight(states.window));
|
||||||
WindowImplAndroid::singleInstance->m_windowBeingCreated = true;
|
WindowImplAndroid::singleInstance->m_windowBeingCreated = true;
|
||||||
WindowImplAndroid::singleInstance->m_hasFocus = true;
|
WindowImplAndroid::singleInstance->m_hasFocus = true;
|
||||||
}
|
}
|
||||||
@ -240,7 +240,7 @@ void WindowImplAndroid::forwardEvent(const Event& event)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
int WindowImplAndroid::processEvent(int fd, int events, void* data)
|
int WindowImplAndroid::processEvent(int /* fd */, int /* events */, void* /* data */)
|
||||||
{
|
{
|
||||||
ActivityStates& states = getActivity();
|
ActivityStates& states = getActivity();
|
||||||
std::scoped_lock lock(states.mutex);
|
std::scoped_lock lock(states.mutex);
|
||||||
@ -318,7 +318,6 @@ int WindowImplAndroid::processScrollEvent(AInputEvent* _event, ActivityStates& s
|
|||||||
{
|
{
|
||||||
// Prepare the Java virtual machine
|
// Prepare the Java virtual machine
|
||||||
jint lResult;
|
jint lResult;
|
||||||
jint lFlags = 0;
|
|
||||||
|
|
||||||
JavaVM* lJavaVM = states.activity->vm;
|
JavaVM* lJavaVM = states.activity->vm;
|
||||||
JNIEnv* lJNIEnv = states.activity->env;
|
JNIEnv* lJNIEnv = states.activity->env;
|
||||||
@ -336,23 +335,33 @@ int WindowImplAndroid::processScrollEvent(AInputEvent* _event, ActivityStates& s
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve everything we need to create this MotionEvent in Java
|
// Retrieve everything we need to create this MotionEvent in Java
|
||||||
jlong downTime = AMotionEvent_getDownTime(_event);
|
Int64 downTime = AMotionEvent_getDownTime(_event);
|
||||||
jlong eventTime = AMotionEvent_getEventTime(_event);
|
Int64 eventTime = AMotionEvent_getEventTime(_event);
|
||||||
jint action = AMotionEvent_getAction(_event);
|
Int32 action = AMotionEvent_getAction(_event);
|
||||||
jfloat x = AMotionEvent_getX(_event, 0);
|
float x = AMotionEvent_getX(_event, 0);
|
||||||
jfloat y = AMotionEvent_getY(_event, 0);
|
float y = AMotionEvent_getY(_event, 0);
|
||||||
jfloat pressure = AMotionEvent_getPressure(_event, 0);
|
float pressure = AMotionEvent_getPressure(_event, 0);
|
||||||
jfloat size = AMotionEvent_getSize(_event, 0);
|
float size = AMotionEvent_getSize(_event, 0);
|
||||||
jint metaState = AMotionEvent_getMetaState(_event);
|
Int32 metaState = AMotionEvent_getMetaState(_event);
|
||||||
jfloat xPrecision = AMotionEvent_getXPrecision(_event);
|
float xPrecision = AMotionEvent_getXPrecision(_event);
|
||||||
jfloat yPrecision = AMotionEvent_getYPrecision(_event);
|
float yPrecision = AMotionEvent_getYPrecision(_event);
|
||||||
jint deviceId = AInputEvent_getDeviceId(_event);
|
Int32 deviceId = AInputEvent_getDeviceId(_event);
|
||||||
jint edgeFlags = AMotionEvent_getEdgeFlags(_event);
|
Int32 edgeFlags = AMotionEvent_getEdgeFlags(_event);
|
||||||
|
|
||||||
// Create the MotionEvent object in Java trough its static constructor obtain()
|
// Create the MotionEvent object in Java trough its static constructor obtain()
|
||||||
jclass ClassMotionEvent = lJNIEnv->FindClass("android/view/MotionEvent");
|
jclass ClassMotionEvent = lJNIEnv->FindClass("android/view/MotionEvent");
|
||||||
jmethodID StaticMethodObtain = lJNIEnv->GetStaticMethodID(ClassMotionEvent, "obtain", "(JJIFFFFIFFII)Landroid/view/MotionEvent;");
|
jmethodID StaticMethodObtain = lJNIEnv->GetStaticMethodID(ClassMotionEvent, "obtain", "(JJIFFFFIFFII)Landroid/view/MotionEvent;");
|
||||||
jobject ObjectMotionEvent = lJNIEnv->CallStaticObjectMethod(ClassMotionEvent, StaticMethodObtain, downTime, eventTime, action, x, y, pressure, size, metaState, xPrecision, yPrecision, deviceId, edgeFlags);
|
// Note: C standard compatibility, varargs
|
||||||
|
// automatically promote floats to doubles
|
||||||
|
// even though the function signature declares float
|
||||||
|
jobject ObjectMotionEvent = lJNIEnv->CallStaticObjectMethod(
|
||||||
|
ClassMotionEvent, StaticMethodObtain, downTime,
|
||||||
|
eventTime, action, static_cast<double>(x),
|
||||||
|
static_cast<double>(y), static_cast<double>(pressure),
|
||||||
|
static_cast<double>(size), metaState,
|
||||||
|
static_cast<double>(xPrecision), static_cast<double>(yPrecision),
|
||||||
|
deviceId, edgeFlags
|
||||||
|
);
|
||||||
|
|
||||||
// Call its getAxisValue() method to get the delta value of our wheel move event
|
// Call its getAxisValue() method to get the delta value of our wheel move event
|
||||||
jmethodID MethodGetAxisValue = lJNIEnv->GetMethodID(ClassMotionEvent, "getAxisValue", "(I)F");
|
jmethodID MethodGetAxisValue = lJNIEnv->GetMethodID(ClassMotionEvent, "getAxisValue", "(I)F");
|
||||||
@ -365,9 +374,9 @@ int WindowImplAndroid::processScrollEvent(AInputEvent* _event, ActivityStates& s
|
|||||||
Event event;
|
Event event;
|
||||||
event.type = Event::MouseWheelScrolled;
|
event.type = Event::MouseWheelScrolled;
|
||||||
event.mouseWheelScroll.wheel = Mouse::VerticalWheel;
|
event.mouseWheelScroll.wheel = Mouse::VerticalWheel;
|
||||||
event.mouseWheelScroll.delta = static_cast<double>(delta);
|
event.mouseWheelScroll.delta = static_cast<float>(delta);
|
||||||
event.mouseWheelScroll.x = AMotionEvent_getX(_event, 0);
|
event.mouseWheelScroll.x = static_cast<int>(AMotionEvent_getX(_event, 0));
|
||||||
event.mouseWheelScroll.y = AMotionEvent_getY(_event, 0);
|
event.mouseWheelScroll.y = static_cast<int>(AMotionEvent_getY(_event, 0));
|
||||||
|
|
||||||
forwardEvent(event);
|
forwardEvent(event);
|
||||||
|
|
||||||
@ -379,9 +388,8 @@ int WindowImplAndroid::processScrollEvent(AInputEvent* _event, ActivityStates& s
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
int WindowImplAndroid::processKeyEvent(AInputEvent* _event, ActivityStates& states)
|
int WindowImplAndroid::processKeyEvent(AInputEvent* _event, ActivityStates& /* states */)
|
||||||
{
|
{
|
||||||
int32_t device = AInputEvent_getSource(_event);
|
|
||||||
int32_t action = AKeyEvent_getAction(_event);
|
int32_t action = AKeyEvent_getAction(_event);
|
||||||
|
|
||||||
int32_t key = AKeyEvent_getKeyCode(_event);
|
int32_t key = AKeyEvent_getKeyCode(_event);
|
||||||
@ -403,10 +411,10 @@ int WindowImplAndroid::processKeyEvent(AInputEvent* _event, ActivityStates& stat
|
|||||||
event.type = Event::KeyReleased;
|
event.type = Event::KeyReleased;
|
||||||
forwardEvent(event);
|
forwardEvent(event);
|
||||||
|
|
||||||
if (int unicode = getUnicode(_event))
|
if (Uint32 unicode = static_cast<Uint32>(getUnicode(_event)))
|
||||||
{
|
{
|
||||||
event.type = Event::TextEntered;
|
event.type = Event::TextEntered;
|
||||||
event.text.unicode = unicode;
|
event.text.unicode = static_cast<Uint32>(unicode);
|
||||||
forwardEvent(event);
|
forwardEvent(event);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@ -426,10 +434,10 @@ int WindowImplAndroid::processKeyEvent(AInputEvent* _event, ActivityStates& stat
|
|||||||
// https://code.google.com/p/android/issues/detail?id=33998
|
// https://code.google.com/p/android/issues/detail?id=33998
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (int unicode = getUnicode(_event)) // This is a repeated sequence
|
else if (Uint32 unicode = static_cast<Uint32>(getUnicode(_event))) // This is a repeated sequence
|
||||||
{
|
{
|
||||||
event.type = Event::TextEntered;
|
event.type = Event::TextEntered;
|
||||||
event.text.unicode = unicode;
|
event.text.unicode = static_cast<Uint32>(unicode);
|
||||||
|
|
||||||
int32_t repeats = AKeyEvent_getRepeatCount(_event);
|
int32_t repeats = AKeyEvent_getRepeatCount(_event);
|
||||||
for (int32_t i = 0; i < repeats; ++i)
|
for (int32_t i = 0; i < repeats; ++i)
|
||||||
@ -446,23 +454,22 @@ int WindowImplAndroid::processKeyEvent(AInputEvent* _event, ActivityStates& stat
|
|||||||
int WindowImplAndroid::processMotionEvent(AInputEvent* _event, ActivityStates& states)
|
int WindowImplAndroid::processMotionEvent(AInputEvent* _event, ActivityStates& states)
|
||||||
{
|
{
|
||||||
int32_t device = AInputEvent_getSource(_event);
|
int32_t device = AInputEvent_getSource(_event);
|
||||||
int32_t action = AMotionEvent_getAction(_event);
|
|
||||||
|
|
||||||
Event event;
|
Event event;
|
||||||
|
|
||||||
if (device == AINPUT_SOURCE_MOUSE)
|
if (device == AINPUT_SOURCE_MOUSE)
|
||||||
event.type = Event::MouseMoved;
|
event.type = Event::MouseMoved;
|
||||||
else if (device & AINPUT_SOURCE_TOUCHSCREEN)
|
else if (static_cast<Uint32>(device) & AINPUT_SOURCE_TOUCHSCREEN)
|
||||||
event.type = Event::TouchMoved;
|
event.type = Event::TouchMoved;
|
||||||
|
|
||||||
int pointerCount = AMotionEvent_getPointerCount(_event);
|
size_t pointerCount = AMotionEvent_getPointerCount(_event);
|
||||||
|
|
||||||
for (int p = 0; p < pointerCount; p++)
|
for (size_t p = 0; p < pointerCount; p++)
|
||||||
{
|
{
|
||||||
int id = AMotionEvent_getPointerId(_event, p);
|
int32_t id = AMotionEvent_getPointerId(_event, p);
|
||||||
|
|
||||||
float x = AMotionEvent_getX(_event, p);
|
int x = static_cast<int>(AMotionEvent_getX(_event, p));
|
||||||
float y = AMotionEvent_getY(_event, p);
|
int y = static_cast<int>(AMotionEvent_getY(_event, p));
|
||||||
|
|
||||||
if (device == AINPUT_SOURCE_MOUSE)
|
if (device == AINPUT_SOURCE_MOUSE)
|
||||||
{
|
{
|
||||||
@ -471,12 +478,12 @@ int WindowImplAndroid::processMotionEvent(AInputEvent* _event, ActivityStates& s
|
|||||||
|
|
||||||
states.mousePosition = Vector2i(event.mouseMove.x, event.mouseMove.y);
|
states.mousePosition = Vector2i(event.mouseMove.x, event.mouseMove.y);
|
||||||
}
|
}
|
||||||
else if (device & AINPUT_SOURCE_TOUCHSCREEN)
|
else if (static_cast<Uint32>(device) & AINPUT_SOURCE_TOUCHSCREEN)
|
||||||
{
|
{
|
||||||
if (states.touchEvents[id].x == x && states.touchEvents[id].y == y)
|
if (states.touchEvents[id].x == x && states.touchEvents[id].y == y)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
event.touch.finger = id;
|
event.touch.finger = static_cast<unsigned int>(id);
|
||||||
event.touch.x = x;
|
event.touch.x = x;
|
||||||
event.touch.y = y;
|
event.touch.y = y;
|
||||||
|
|
||||||
@ -495,11 +502,11 @@ int WindowImplAndroid::processPointerEvent(bool isDown, AInputEvent* _event, Act
|
|||||||
int32_t device = AInputEvent_getSource(_event);
|
int32_t device = AInputEvent_getSource(_event);
|
||||||
int32_t action = AMotionEvent_getAction(_event);
|
int32_t action = AMotionEvent_getAction(_event);
|
||||||
|
|
||||||
int index = (action & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
|
size_t index = (action & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
|
||||||
int id = AMotionEvent_getPointerId(_event, index);
|
int32_t id = AMotionEvent_getPointerId(_event, index);
|
||||||
|
|
||||||
float x = AMotionEvent_getX(_event, index);
|
int x = static_cast<int>(AMotionEvent_getX(_event, index));
|
||||||
float y = AMotionEvent_getY(_event, index);
|
int y = static_cast<int>(AMotionEvent_getY(_event, index));
|
||||||
|
|
||||||
Event event;
|
Event event;
|
||||||
|
|
||||||
@ -515,10 +522,10 @@ int WindowImplAndroid::processPointerEvent(bool isDown, AInputEvent* _event, Act
|
|||||||
if (id >= 0 && id < Mouse::ButtonCount)
|
if (id >= 0 && id < Mouse::ButtonCount)
|
||||||
states.isButtonPressed[id] = true;
|
states.isButtonPressed[id] = true;
|
||||||
}
|
}
|
||||||
else if (device & AINPUT_SOURCE_TOUCHSCREEN)
|
else if (static_cast<unsigned int>(device) & AINPUT_SOURCE_TOUCHSCREEN)
|
||||||
{
|
{
|
||||||
event.type = Event::TouchBegan;
|
event.type = Event::TouchBegan;
|
||||||
event.touch.finger = id;
|
event.touch.finger = static_cast<unsigned int>(id);
|
||||||
event.touch.x = x;
|
event.touch.x = x;
|
||||||
event.touch.y = y;
|
event.touch.y = y;
|
||||||
|
|
||||||
@ -537,10 +544,10 @@ int WindowImplAndroid::processPointerEvent(bool isDown, AInputEvent* _event, Act
|
|||||||
if (id >= 0 && id < Mouse::ButtonCount)
|
if (id >= 0 && id < Mouse::ButtonCount)
|
||||||
states.isButtonPressed[id] = false;
|
states.isButtonPressed[id] = false;
|
||||||
}
|
}
|
||||||
else if (device & AINPUT_SOURCE_TOUCHSCREEN)
|
else if (static_cast<Uint32>(device) & AINPUT_SOURCE_TOUCHSCREEN)
|
||||||
{
|
{
|
||||||
event.type = Event::TouchEnded;
|
event.type = Event::TouchEnded;
|
||||||
event.touch.finger = id;
|
event.touch.finger = static_cast<unsigned int>(id);
|
||||||
event.touch.x = x;
|
event.touch.x = x;
|
||||||
event.touch.y = y;
|
event.touch.y = y;
|
||||||
|
|
||||||
@ -684,7 +691,6 @@ int WindowImplAndroid::getUnicode(AInputEvent* event)
|
|||||||
|
|
||||||
// Initializes JNI
|
// Initializes JNI
|
||||||
jint lResult;
|
jint lResult;
|
||||||
jint lFlags = 0;
|
|
||||||
|
|
||||||
JavaVM* lJavaVM = states.activity->vm;
|
JavaVM* lJavaVM = states.activity->vm;
|
||||||
JNIEnv* lJNIEnv = states.activity->env;
|
JNIEnv* lJNIEnv = states.activity->env;
|
||||||
|
@ -163,6 +163,8 @@ m_config (nullptr)
|
|||||||
// Create EGL surface (except on Android because the window is created
|
// Create EGL surface (except on Android because the window is created
|
||||||
// asynchronously, its activity manager will call it for us)
|
// asynchronously, its activity manager will call it for us)
|
||||||
createSurface(owner->getSystemHandle());
|
createSurface(owner->getSystemHandle());
|
||||||
|
#else
|
||||||
|
(void) owner;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ namespace
|
|||||||
name += directoryEntry->d_name;
|
name += directoryEntry->d_name;
|
||||||
|
|
||||||
if (isJoystick(name.c_str()))
|
if (isJoystick(name.c_str()))
|
||||||
plugged[joystickCount++] = name;
|
plugged[static_cast<unsigned int>(joystickCount++)] = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
directoryEntry = readdir(directory);
|
directoryEntry = readdir(directory);
|
||||||
@ -149,8 +149,8 @@ namespace
|
|||||||
|
|
||||||
void hatValueToSfml(int value, sf::priv::JoystickState& state)
|
void hatValueToSfml(int value, sf::priv::JoystickState& state)
|
||||||
{
|
{
|
||||||
state.axes[sf::Joystick::PovX] = hatValueMap[value].first;
|
state.axes[sf::Joystick::PovX] = static_cast<float>(hatValueMap[value].first);
|
||||||
state.axes[sf::Joystick::PovY] = hatValueMap[value].second;
|
state.axes[sf::Joystick::PovY] = static_cast<float>(hatValueMap[value].second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,7 +220,7 @@ bool JoystickImpl::open(unsigned int index)
|
|||||||
|
|
||||||
// Then allocate a buffer for data retrieval
|
// Then allocate a buffer for data retrieval
|
||||||
m_length = hid_report_size(m_desc, hid_input, m_id);
|
m_length = hid_report_size(m_desc, hid_input, m_id);
|
||||||
m_buffer.resize(m_length);
|
m_buffer.resize(static_cast<size_t>(m_length));
|
||||||
|
|
||||||
m_state.connected = true;
|
m_state.connected = true;
|
||||||
|
|
||||||
@ -292,7 +292,7 @@ Joystick::Identification JoystickImpl::getIdentification() const
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
JoystickState JoystickImpl::JoystickImpl::update()
|
JoystickState JoystickImpl::JoystickImpl::update()
|
||||||
{
|
{
|
||||||
while (read(m_file, m_buffer.data(), m_length) == m_length)
|
while (read(m_file, m_buffer.data(), static_cast<size_t>(m_length)) == m_length)
|
||||||
{
|
{
|
||||||
hid_data_t data = hid_start_parse(m_desc, 1 << hid_input, m_id);
|
hid_data_t data = hid_start_parse(m_desc, 1 << hid_input, m_id);
|
||||||
|
|
||||||
@ -328,7 +328,7 @@ JoystickState JoystickImpl::JoystickImpl::update()
|
|||||||
int maximum = item.logical_maximum;
|
int maximum = item.logical_maximum;
|
||||||
|
|
||||||
value = (value - minimum) * 200 / (maximum - minimum) - 100;
|
value = (value - minimum) * 200 / (maximum - minimum) - 100;
|
||||||
m_state.axes[axis] = value;
|
m_state.axes[axis] = static_cast<float>(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ long HIDInputManager::getLocationID(IOHIDDeviceRef device)
|
|||||||
if (!typeRef || (CFGetTypeID(typeRef) != CFNumberGetTypeID()))
|
if (!typeRef || (CFGetTypeID(typeRef) != CFNumberGetTypeID()))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
CFNumberRef locRef = (CFNumberRef)typeRef;
|
CFNumberRef locRef = static_cast<CFNumberRef>(typeRef);
|
||||||
|
|
||||||
if (!CFNumberGetValue(locRef, kCFNumberLongType, &loc))
|
if (!CFNumberGetValue(locRef, kCFNumberLongType, &loc))
|
||||||
return 0;
|
return 0;
|
||||||
@ -100,8 +100,7 @@ m_manager(0)
|
|||||||
{
|
{
|
||||||
// Get the current keyboard layout
|
// Get the current keyboard layout
|
||||||
TISInputSourceRef tis = TISCopyCurrentKeyboardLayoutInputSource();
|
TISInputSourceRef tis = TISCopyCurrentKeyboardLayoutInputSource();
|
||||||
m_layoutData = (CFDataRef)TISGetInputSourceProperty(tis,
|
m_layoutData = static_cast<CFDataRef>(TISGetInputSourceProperty(tis, kTISPropertyUnicodeKeyLayoutData));
|
||||||
kTISPropertyUnicodeKeyLayoutData);
|
|
||||||
|
|
||||||
if (m_layoutData == 0)
|
if (m_layoutData == 0)
|
||||||
{
|
{
|
||||||
@ -112,7 +111,7 @@ m_manager(0)
|
|||||||
|
|
||||||
// Keep a reference for ourself
|
// Keep a reference for ourself
|
||||||
CFRetain(m_layoutData);
|
CFRetain(m_layoutData);
|
||||||
m_layout = (UCKeyboardLayout *)CFDataGetBytePtr(m_layoutData);
|
m_layout = reinterpret_cast<UCKeyboardLayout*>(const_cast<UInt8*>(CFDataGetBytePtr(m_layoutData)));
|
||||||
|
|
||||||
// The TIS is no more needed
|
// The TIS is no more needed
|
||||||
CFRelease(tis);
|
CFRelease(tis);
|
||||||
@ -160,12 +159,12 @@ void HIDInputManager::initializeKeyboard()
|
|||||||
CFIndex keyboardCount = CFSetGetCount(keyboards); // >= 1 (asserted by copyDevices)
|
CFIndex keyboardCount = CFSetGetCount(keyboards); // >= 1 (asserted by copyDevices)
|
||||||
|
|
||||||
// Get an iterable array
|
// Get an iterable array
|
||||||
CFTypeRef devicesArray[keyboardCount];
|
std::vector<CFTypeRef> devicesArray(static_cast<std::size_t>(keyboardCount));
|
||||||
CFSetGetValues(keyboards, devicesArray);
|
CFSetGetValues(keyboards, &devicesArray[0]);
|
||||||
|
|
||||||
for (CFIndex i = 0; i < keyboardCount; ++i)
|
for (CFIndex i = 0; i < keyboardCount; ++i)
|
||||||
{
|
{
|
||||||
IOHIDDeviceRef keyboard = (IOHIDDeviceRef)devicesArray[i];
|
IOHIDDeviceRef keyboard = static_cast<IOHIDDeviceRef>(const_cast<void*>(devicesArray[static_cast<std::size_t>(i)]));
|
||||||
loadKeyboard(keyboard);
|
loadKeyboard(keyboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,7 +201,7 @@ void HIDInputManager::loadKeyboard(IOHIDDeviceRef keyboard)
|
|||||||
// Go through all connected elements.
|
// Go through all connected elements.
|
||||||
for (CFIndex i = 0; i < keysCount; ++i)
|
for (CFIndex i = 0; i < keysCount; ++i)
|
||||||
{
|
{
|
||||||
IOHIDElementRef aKey = (IOHIDElementRef) CFArrayGetValueAtIndex(keys, i);
|
IOHIDElementRef aKey = static_cast<IOHIDElementRef>(const_cast<void*>(CFArrayGetValueAtIndex(keys, i)));
|
||||||
|
|
||||||
// Skip non-matching keys elements
|
// Skip non-matching keys elements
|
||||||
if (IOHIDElementGetUsagePage(aKey) != kHIDPage_KeyboardOrKeypad)
|
if (IOHIDElementGetUsagePage(aKey) != kHIDPage_KeyboardOrKeypad)
|
||||||
@ -233,7 +232,7 @@ void HIDInputManager::loadKey(IOHIDElementRef key)
|
|||||||
// Unicode string length is usually less or equal to 4
|
// Unicode string length is usually less or equal to 4
|
||||||
UniCharCount maxStringLength = 4;
|
UniCharCount maxStringLength = 4;
|
||||||
UniCharCount actualStringLength = 0;
|
UniCharCount actualStringLength = 0;
|
||||||
UniChar unicodeString[maxStringLength];
|
std::vector<UniChar> unicodeString(maxStringLength);
|
||||||
|
|
||||||
OSStatus error;
|
OSStatus error;
|
||||||
|
|
||||||
@ -246,7 +245,7 @@ void HIDInputManager::loadKey(IOHIDElementRef key)
|
|||||||
&deadKeyState, // unused stuff
|
&deadKeyState, // unused stuff
|
||||||
maxStringLength, // our memory limit
|
maxStringLength, // our memory limit
|
||||||
&actualStringLength, // length of what we get
|
&actualStringLength, // length of what we get
|
||||||
unicodeString); // what we get
|
unicodeString.data()); // what we get
|
||||||
|
|
||||||
if (error == noErr)
|
if (error == noErr)
|
||||||
{
|
{
|
||||||
|
@ -85,7 +85,7 @@ m_joystickCount(0)
|
|||||||
maskArray[0] = mask0;
|
maskArray[0] = mask0;
|
||||||
maskArray[1] = mask1;
|
maskArray[1] = mask1;
|
||||||
|
|
||||||
CFArrayRef mask = CFArrayCreate(nullptr, (const void**)maskArray, 2, nullptr);
|
CFArrayRef mask = CFArrayCreate(nullptr, reinterpret_cast<const void**>(maskArray), 2, nullptr);
|
||||||
|
|
||||||
IOHIDManagerSetDeviceMatchingMultiple(m_manager, mask);
|
IOHIDManagerSetDeviceMatchingMultiple(m_manager, mask);
|
||||||
CFRelease(mask);
|
CFRelease(mask);
|
||||||
|
@ -58,7 +58,7 @@ namespace priv
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
SFOpenGLView* getSFOpenGLViewFromSFMLWindow(const WindowBase& window)
|
SFOpenGLView* getSFOpenGLViewFromSFMLWindow(const WindowBase& window)
|
||||||
{
|
{
|
||||||
id nsHandle = (id)window.getSystemHandle();
|
id nsHandle = static_cast<id>(window.getSystemHandle());
|
||||||
|
|
||||||
// Get our SFOpenGLView from ...
|
// Get our SFOpenGLView from ...
|
||||||
SFOpenGLView* view = nil;
|
SFOpenGLView* view = nil;
|
||||||
@ -78,7 +78,7 @@ SFOpenGLView* getSFOpenGLViewFromSFMLWindow(const WindowBase& window)
|
|||||||
{
|
{
|
||||||
if ([subview isKindOfClass:[SFOpenGLView class]])
|
if ([subview isKindOfClass:[SFOpenGLView class]])
|
||||||
{
|
{
|
||||||
view = (SFOpenGLView*)subview;
|
view = static_cast<SFOpenGLView*>(subview);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -102,7 +102,7 @@ SFOpenGLView* getSFOpenGLViewFromSFMLWindow(const WindowBase& window)
|
|||||||
{
|
{
|
||||||
if ([subview isKindOfClass:[SFOpenGLView class]])
|
if ([subview isKindOfClass:[SFOpenGLView class]])
|
||||||
{
|
{
|
||||||
view = (SFOpenGLView*)subview;
|
view = static_cast<SFOpenGLView*>(subview);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -156,8 +156,8 @@ Vector2i InputImpl::getMousePosition()
|
|||||||
NSPoint pos = [NSEvent mouseLocation];
|
NSPoint pos = [NSEvent mouseLocation];
|
||||||
pos.y = sf::VideoMode::getDesktopMode().height - pos.y;
|
pos.y = sf::VideoMode::getDesktopMode().height - pos.y;
|
||||||
|
|
||||||
int scale = [[NSScreen mainScreen] backingScaleFactor];
|
int scale = static_cast<int>([[NSScreen mainScreen] backingScaleFactor]);
|
||||||
return Vector2i(pos.x, pos.y) * scale;
|
return Vector2i(static_cast<int>(pos.x), static_cast<int>(pos.y)) * scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -174,8 +174,8 @@ Vector2i InputImpl::getMousePosition(const WindowBase& relativeTo)
|
|||||||
// Use -cursorPositionFromEvent: with nil.
|
// Use -cursorPositionFromEvent: with nil.
|
||||||
NSPoint pos = [view cursorPositionFromEvent:nil];
|
NSPoint pos = [view cursorPositionFromEvent:nil];
|
||||||
|
|
||||||
int scale = [view displayScaleFactor];
|
int scale = static_cast<int>([view displayScaleFactor]);
|
||||||
return Vector2i(pos.x, pos.y) * scale;
|
return Vector2i(static_cast<int>(pos.x), static_cast<int>(pos.y)) * scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ void InputImpl::setMousePosition(const Vector2i& position)
|
|||||||
{
|
{
|
||||||
AutoreleasePool pool;
|
AutoreleasePool pool;
|
||||||
// Here we don't need to reverse the coordinates.
|
// Here we don't need to reverse the coordinates.
|
||||||
int scale = [[NSScreen mainScreen] backingScaleFactor];
|
int scale = static_cast<int>([[NSScreen mainScreen] backingScaleFactor]);
|
||||||
CGPoint pos = CGPointMake(position.x / scale, position.y / scale);
|
CGPoint pos = CGPointMake(position.x / scale, position.y / scale);
|
||||||
|
|
||||||
// Place the cursor.
|
// Place the cursor.
|
||||||
@ -209,10 +209,10 @@ void InputImpl::setMousePosition(const Vector2i& position, const WindowBase& rel
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Let SFOpenGLView compute the position in global coordinate
|
// Let SFOpenGLView compute the position in global coordinate
|
||||||
int scale = [view displayScaleFactor];
|
int scale = static_cast<int>([view displayScaleFactor]);
|
||||||
NSPoint p = NSMakePoint(position.x / scale, position.y / scale);
|
NSPoint p = NSMakePoint(position.x / scale, position.y / scale);
|
||||||
p = [view computeGlobalPositionOfRelativePoint:p];
|
p = [view computeGlobalPositionOfRelativePoint:p];
|
||||||
setMousePosition(sf::Vector2i(p.x, p.y) * scale);
|
setMousePosition(sf::Vector2i(static_cast<int>(p.x), static_cast<int>(p.y)) * scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ namespace
|
|||||||
std::string stringFromCFString(CFStringRef cfString)
|
std::string stringFromCFString(CFStringRef cfString)
|
||||||
{
|
{
|
||||||
CFIndex length = CFStringGetLength(cfString);
|
CFIndex length = CFStringGetLength(cfString);
|
||||||
std::vector<char> str(length);
|
std::vector<char> str(static_cast<std::size_t>(length));
|
||||||
CFIndex maxSize = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8);
|
CFIndex maxSize = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8);
|
||||||
CFStringGetCString(cfString, str.data(), maxSize, kCFStringEncodingUTF8);
|
CFStringGetCString(cfString, str.data(), maxSize, kCFStringEncodingUTF8);
|
||||||
return str.data();
|
return str.data();
|
||||||
@ -72,8 +72,8 @@ namespace
|
|||||||
if (typeRef && (CFGetTypeID(typeRef) == CFNumberGetTypeID()))
|
if (typeRef && (CFGetTypeID(typeRef) == CFNumberGetTypeID()))
|
||||||
{
|
{
|
||||||
SInt32 value;
|
SInt32 value;
|
||||||
CFNumberGetValue((CFNumberRef)typeRef, kCFNumberSInt32Type, &value);
|
CFNumberGetValue(static_cast<CFNumberRef>(typeRef), kCFNumberSInt32Type, &value);
|
||||||
return value;
|
return static_cast<unsigned int>(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
sf::err() << "Unable to read uint value for property '" << stringFromCFString(prop) << "' for joystick at index " << index << std::endl;
|
sf::err() << "Unable to read uint value for property '" << stringFromCFString(prop) << "' for joystick at index " << index << std::endl;
|
||||||
@ -143,15 +143,15 @@ bool JoystickImpl::isConnected(unsigned int index)
|
|||||||
CFIndex size = CFSetGetCount(devices);
|
CFIndex size = CFSetGetCount(devices);
|
||||||
if (size > 0)
|
if (size > 0)
|
||||||
{
|
{
|
||||||
CFTypeRef array[size]; // array of IOHIDDeviceRef
|
std::vector<CFTypeRef> array(static_cast<std::size_t>(size)); // array of IOHIDDeviceRef
|
||||||
CFSetGetValues(devices, array);
|
CFSetGetValues(devices, array.data());
|
||||||
|
|
||||||
// If there exists a device d s.t. there is no j s.t.
|
// If there exists a device d s.t. there is no j s.t.
|
||||||
// m_locationIDs[j] == d's location then we have a new device.
|
// m_locationIDs[j] == d's location then we have a new device.
|
||||||
|
|
||||||
for (CFIndex didx(0); !state && didx < size; ++didx)
|
for (CFIndex didx(0); !state && didx < size; ++didx)
|
||||||
{
|
{
|
||||||
IOHIDDeviceRef d = (IOHIDDeviceRef)array[didx];
|
IOHIDDeviceRef d = static_cast<IOHIDDeviceRef>(const_cast<void*>(array[static_cast<std::size_t>(didx)]));
|
||||||
Location dloc = HIDInputManager::getLocationID(d);
|
Location dloc = HIDInputManager::getLocationID(d);
|
||||||
|
|
||||||
bool foundJ = false;
|
bool foundJ = false;
|
||||||
@ -194,14 +194,14 @@ bool JoystickImpl::open(unsigned int index)
|
|||||||
|
|
||||||
// Get a usable copy of the joysticks devices.
|
// Get a usable copy of the joysticks devices.
|
||||||
CFIndex joysticksCount = CFSetGetCount(devices);
|
CFIndex joysticksCount = CFSetGetCount(devices);
|
||||||
CFTypeRef devicesArray[joysticksCount];
|
std::vector<CFTypeRef> devicesArray(static_cast<std::size_t>(joysticksCount));
|
||||||
CFSetGetValues(devices, devicesArray);
|
CFSetGetValues(devices, devicesArray.data());
|
||||||
|
|
||||||
// Get the desired joystick.
|
// Get the desired joystick.
|
||||||
IOHIDDeviceRef self = 0;
|
IOHIDDeviceRef self = 0;
|
||||||
for (CFIndex i(0); self == 0 && i < joysticksCount; ++i)
|
for (CFIndex i(0); self == 0 && i < joysticksCount; ++i)
|
||||||
{
|
{
|
||||||
IOHIDDeviceRef d = (IOHIDDeviceRef)devicesArray[i];
|
IOHIDDeviceRef d = static_cast<IOHIDDeviceRef>(const_cast<void*>(devicesArray[static_cast<std::size_t>(i)]));
|
||||||
if (deviceLoc == HIDInputManager::getLocationID(d))
|
if (deviceLoc == HIDInputManager::getLocationID(d))
|
||||||
self = d;
|
self = d;
|
||||||
}
|
}
|
||||||
@ -229,7 +229,7 @@ bool JoystickImpl::open(unsigned int index)
|
|||||||
CFIndex elementsCount = CFArrayGetCount(elements);
|
CFIndex elementsCount = CFArrayGetCount(elements);
|
||||||
for (int i = 0; i < elementsCount; ++i)
|
for (int i = 0; i < elementsCount; ++i)
|
||||||
{
|
{
|
||||||
IOHIDElementRef element = (IOHIDElementRef) CFArrayGetValueAtIndex(elements, i);
|
IOHIDElementRef element = static_cast<IOHIDElementRef>(const_cast<void*>(CFArrayGetValueAtIndex(elements, i)));
|
||||||
switch (IOHIDElementGetUsagePage(element))
|
switch (IOHIDElementGetUsagePage(element))
|
||||||
{
|
{
|
||||||
case kHIDPage_GenericDesktop:
|
case kHIDPage_GenericDesktop:
|
||||||
@ -359,7 +359,7 @@ JoystickCaps JoystickImpl::getCapabilities() const
|
|||||||
JoystickCaps caps;
|
JoystickCaps caps;
|
||||||
|
|
||||||
// Buttons:
|
// Buttons:
|
||||||
caps.buttonCount = m_buttons.size();
|
caps.buttonCount = static_cast<unsigned int>(m_buttons.size());
|
||||||
|
|
||||||
// Axis:
|
// Axis:
|
||||||
for (const auto& [axis, iohidElementRef] : m_axis)
|
for (const auto& [axis, iohidElementRef] : m_axis)
|
||||||
@ -401,14 +401,14 @@ JoystickState JoystickImpl::update()
|
|||||||
|
|
||||||
// Get a usable copy of the joysticks devices.
|
// Get a usable copy of the joysticks devices.
|
||||||
CFIndex joysticksCount = CFSetGetCount(devices);
|
CFIndex joysticksCount = CFSetGetCount(devices);
|
||||||
CFTypeRef devicesArray[joysticksCount];
|
std::vector<CFTypeRef> devicesArray(static_cast<std::size_t>(joysticksCount));
|
||||||
CFSetGetValues(devices, devicesArray);
|
CFSetGetValues(devices, devicesArray.data());
|
||||||
|
|
||||||
// Search for it
|
// Search for it
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (CFIndex i(0); !found && i < joysticksCount; ++i)
|
for (CFIndex i(0); !found && i < joysticksCount; ++i)
|
||||||
{
|
{
|
||||||
IOHIDDeviceRef d = (IOHIDDeviceRef)devicesArray[i];
|
IOHIDDeviceRef d = static_cast<IOHIDDeviceRef>(const_cast<void*>(devicesArray[static_cast<std::size_t>(i)]));
|
||||||
if (selfLoc == HIDInputManager::getLocationID(d))
|
if (selfLoc == HIDInputManager::getLocationID(d))
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
@ -459,12 +459,12 @@ JoystickState JoystickImpl::update()
|
|||||||
// This method might not be very accurate (the "0 position" can be
|
// This method might not be very accurate (the "0 position" can be
|
||||||
// slightly shift with some device) but we don't care because most
|
// slightly shift with some device) but we don't care because most
|
||||||
// of devices are so sensitive that this is not relevant.
|
// of devices are so sensitive that this is not relevant.
|
||||||
double physicalMax = IOHIDElementGetPhysicalMax(iohidElementRef);
|
double physicalMax = static_cast<double>(IOHIDElementGetPhysicalMax(iohidElementRef));
|
||||||
double physicalMin = IOHIDElementGetPhysicalMin(iohidElementRef);
|
double physicalMin = static_cast<double>(IOHIDElementGetPhysicalMin(iohidElementRef));
|
||||||
double scaledMin = -100;
|
double scaledMin = -100;
|
||||||
double scaledMax = 100;
|
double scaledMax = 100;
|
||||||
double physicalValue = IOHIDValueGetScaledValue(value, kIOHIDValueScaleTypePhysical);
|
double physicalValue = IOHIDValueGetScaledValue(value, kIOHIDValueScaleTypePhysical);
|
||||||
float scaledValue = (((physicalValue - physicalMin) * (scaledMax - scaledMin)) / (physicalMax - physicalMin)) + scaledMin;
|
float scaledValue = static_cast<float>((((physicalValue - physicalMin) * (scaledMax - scaledMin)) / (physicalMax - physicalMin)) + scaledMin);
|
||||||
state.axes[axis] = scaledValue;
|
state.axes[axis] = scaledValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,8 +35,8 @@
|
|||||||
// Create an empty image representation.
|
// Create an empty image representation.
|
||||||
NSBitmapImageRep* bitmap =
|
NSBitmapImageRep* bitmap =
|
||||||
[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:0 // if 0: only allocate memory
|
[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:0 // if 0: only allocate memory
|
||||||
pixelsWide:size.width
|
pixelsWide:(static_cast<NSInteger>(size.width))
|
||||||
pixelsHigh:size.height
|
pixelsHigh:(static_cast<NSInteger>(size.height))
|
||||||
bitsPerSample:8 // The number of bits used to specify
|
bitsPerSample:8 // The number of bits used to specify
|
||||||
// one pixel in a single component of the data.
|
// one pixel in a single component of the data.
|
||||||
samplesPerPixel:4 // 3 if no alpha, 4 with it
|
samplesPerPixel:4 // 3 if no alpha, 4 with it
|
||||||
|
@ -28,6 +28,14 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#import <SFML/Window/OSX/SFApplication.h>
|
#import <SFML/Window/OSX/SFApplication.h>
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@implementation SFApplication
|
@implementation SFApplication
|
||||||
|
@ -28,6 +28,14 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#import <SFML/Window/OSX/SFApplicationDelegate.h>
|
#import <SFML/Window/OSX/SFApplicationDelegate.h>
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@implementation SFApplicationDelegate
|
@implementation SFApplicationDelegate
|
||||||
|
|
||||||
|
@ -33,6 +33,14 @@
|
|||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <stdint.h>
|
#include <stdint.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 sf
|
||||||
{
|
{
|
||||||
namespace priv
|
namespace priv
|
||||||
@ -184,14 +192,14 @@ void SFContext::createContext(SFContext* shared,
|
|||||||
if (bitsPerPixel > 24)
|
if (bitsPerPixel > 24)
|
||||||
{
|
{
|
||||||
attrs.push_back(NSOpenGLPFAAlphaSize);
|
attrs.push_back(NSOpenGLPFAAlphaSize);
|
||||||
attrs.push_back((NSOpenGLPixelFormatAttribute)8);
|
attrs.push_back(static_cast<NSOpenGLPixelFormatAttribute>(8));
|
||||||
}
|
}
|
||||||
|
|
||||||
attrs.push_back(NSOpenGLPFADepthSize);
|
attrs.push_back(NSOpenGLPFADepthSize);
|
||||||
attrs.push_back((NSOpenGLPixelFormatAttribute)m_settings.depthBits);
|
attrs.push_back(static_cast<NSOpenGLPixelFormatAttribute>(m_settings.depthBits));
|
||||||
|
|
||||||
attrs.push_back(NSOpenGLPFAStencilSize);
|
attrs.push_back(NSOpenGLPFAStencilSize);
|
||||||
attrs.push_back((NSOpenGLPixelFormatAttribute)m_settings.stencilBits);
|
attrs.push_back(static_cast<NSOpenGLPixelFormatAttribute>(m_settings.stencilBits));
|
||||||
|
|
||||||
if (m_settings.antialiasingLevel > 0)
|
if (m_settings.antialiasingLevel > 0)
|
||||||
{
|
{
|
||||||
@ -211,11 +219,11 @@ void SFContext::createContext(SFContext* shared,
|
|||||||
|
|
||||||
// Only one buffer is currently available
|
// Only one buffer is currently available
|
||||||
attrs.push_back(NSOpenGLPFASampleBuffers);
|
attrs.push_back(NSOpenGLPFASampleBuffers);
|
||||||
attrs.push_back((NSOpenGLPixelFormatAttribute)1);
|
attrs.push_back(static_cast<NSOpenGLPixelFormatAttribute>(1));
|
||||||
|
|
||||||
// Antialiasing level
|
// Antialiasing level
|
||||||
attrs.push_back(NSOpenGLPFASamples);
|
attrs.push_back(NSOpenGLPFASamples);
|
||||||
attrs.push_back((NSOpenGLPixelFormatAttribute)m_settings.antialiasingLevel);
|
attrs.push_back(static_cast<NSOpenGLPixelFormatAttribute>(m_settings.antialiasingLevel));
|
||||||
|
|
||||||
// No software renderer - only hardware renderer
|
// No software renderer - only hardware renderer
|
||||||
attrs.push_back(NSOpenGLPFAAccelerated);
|
attrs.push_back(NSOpenGLPFAAccelerated);
|
||||||
@ -232,7 +240,7 @@ void SFContext::createContext(SFContext* shared,
|
|||||||
|
|
||||||
if (legacy)
|
if (legacy)
|
||||||
{
|
{
|
||||||
m_settings.attributeFlags &= ~ContextSettings::Core;
|
m_settings.attributeFlags &= ~static_cast<unsigned int>(ContextSettings::Core);
|
||||||
m_settings.majorVersion = 2;
|
m_settings.majorVersion = 2;
|
||||||
m_settings.minorVersion = 1;
|
m_settings.minorVersion = 1;
|
||||||
attrs.push_back(NSOpenGLPFAOpenGLProfile);
|
attrs.push_back(NSOpenGLPFAOpenGLProfile);
|
||||||
@ -254,10 +262,10 @@ void SFContext::createContext(SFContext* shared,
|
|||||||
if (m_settings.attributeFlags & ContextSettings::Debug)
|
if (m_settings.attributeFlags & ContextSettings::Debug)
|
||||||
{
|
{
|
||||||
sf::err() << "Warning. OpenGL debugging not supported on this platform." << std::endl;
|
sf::err() << "Warning. OpenGL debugging not supported on this platform." << std::endl;
|
||||||
m_settings.attributeFlags &= ~ContextSettings::Debug;
|
m_settings.attributeFlags &= ~static_cast<unsigned int>(ContextSettings::Debug);
|
||||||
}
|
}
|
||||||
|
|
||||||
attrs.push_back((NSOpenGLPixelFormatAttribute)0); // end of array
|
attrs.push_back(static_cast<NSOpenGLPixelFormatAttribute>(0)); // end of array
|
||||||
|
|
||||||
// All OS X pixel formats are sRGB capable
|
// All OS X pixel formats are sRGB capable
|
||||||
m_settings.sRgbCapable = true;
|
m_settings.sRgbCapable = true;
|
||||||
|
@ -30,6 +30,14 @@
|
|||||||
|
|
||||||
#import <SFML/Window/OSX/SFKeyboardModifiersHelper.h>
|
#import <SFML/Window/OSX/SFKeyboardModifiersHelper.h>
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Here are define the mask value for the 'modifiers'
|
/// Here are define the mask value for the 'modifiers'
|
||||||
|
@ -33,6 +33,14 @@
|
|||||||
#import <SFML/Window/OSX/SFOpenGLView.h>
|
#import <SFML/Window/OSX/SFOpenGLView.h>
|
||||||
#import <SFML/Window/OSX/SFOpenGLView+keyboard_priv.h>
|
#import <SFML/Window/OSX/SFOpenGLView+keyboard_priv.h>
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// In this file, we implement keyboard handling for SFOpenGLView
|
/// In this file, we implement keyboard handling for SFOpenGLView
|
||||||
///
|
///
|
||||||
|
@ -32,6 +32,14 @@
|
|||||||
#import <SFML/Window/OSX/SFOpenGLView.h>
|
#import <SFML/Window/OSX/SFOpenGLView.h>
|
||||||
#import <SFML/Window/OSX/SFOpenGLView+mouse_priv.h>
|
#import <SFML/Window/OSX/SFOpenGLView+mouse_priv.h>
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// In this file, we implement mouse handling for SFOpenGLView
|
/// In this file, we implement mouse handling for SFOpenGLView
|
||||||
@ -136,7 +144,7 @@
|
|||||||
NSPoint loc = [self cursorPositionFromEvent:theEvent];
|
NSPoint loc = [self cursorPositionFromEvent:theEvent];
|
||||||
|
|
||||||
if (button != sf::Mouse::ButtonCount)
|
if (button != sf::Mouse::ButtonCount)
|
||||||
m_requester->mouseDownAt(button, loc.x, loc.y);
|
m_requester->mouseDownAt(button, static_cast<int>(loc.x), static_cast<int>(loc.y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +189,7 @@
|
|||||||
NSPoint loc = [self cursorPositionFromEvent:theEvent];
|
NSPoint loc = [self cursorPositionFromEvent:theEvent];
|
||||||
|
|
||||||
if (button != sf::Mouse::ButtonCount)
|
if (button != sf::Mouse::ButtonCount)
|
||||||
m_requester->mouseUpAt(button, loc.x, loc.y);
|
m_requester->mouseUpAt(button, static_cast<int>(loc.x), static_cast<int>(loc.y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,7 +250,7 @@
|
|||||||
// when the mouse is dragged. That would be too easy!)
|
// when the mouse is dragged. That would be too easy!)
|
||||||
[self updateMouseState];
|
[self updateMouseState];
|
||||||
if ((m_requester != 0) && m_mouseIsIn)
|
if ((m_requester != 0) && m_mouseIsIn)
|
||||||
m_requester->mouseMovedAt(loc.x, loc.y);
|
m_requester->mouseMovedAt(static_cast<int>(loc.x), static_cast<int>(loc.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -290,7 +298,7 @@
|
|||||||
{
|
{
|
||||||
NSScreen* screen = [[self window] screen];
|
NSScreen* screen = [[self window] screen];
|
||||||
NSNumber* displayId = [[screen deviceDescription] objectForKey:@"NSScreenNumber"];
|
NSNumber* displayId = [[screen deviceDescription] objectForKey:@"NSScreenNumber"];
|
||||||
return [displayId intValue];
|
return static_cast<unsigned int>([displayId intValue]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -300,7 +308,7 @@
|
|||||||
if (m_requester != 0)
|
if (m_requester != 0)
|
||||||
{
|
{
|
||||||
NSPoint loc = [self cursorPositionFromEvent:theEvent];
|
NSPoint loc = [self cursorPositionFromEvent:theEvent];
|
||||||
m_requester->mouseWheelScrolledAt([theEvent deltaX], [theEvent deltaY], loc.x, loc.y);
|
m_requester->mouseWheelScrolledAt(static_cast<float>([theEvent deltaX]), static_cast<float>([theEvent deltaY]), static_cast<int>(loc.x), static_cast<int>(loc.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transmit to non-SFML responder
|
// Transmit to non-SFML responder
|
||||||
@ -396,7 +404,7 @@
|
|||||||
NSPoint loc = [self convertPoint:rawPos fromView:nil];
|
NSPoint loc = [self convertPoint:rawPos fromView:nil];
|
||||||
|
|
||||||
// Don't forget to change to SFML coord system.
|
// Don't forget to change to SFML coord system.
|
||||||
float h = [self frame].size.height;
|
const double h = [self frame].size.height;
|
||||||
loc.y = h - loc.y;
|
loc.y = h - loc.y;
|
||||||
|
|
||||||
return loc;
|
return loc;
|
||||||
|
@ -28,6 +28,16 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#import <AppKit/AppKit.h>
|
#import <AppKit/AppKit.h>
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace sf {
|
namespace sf {
|
||||||
namespace priv {
|
namespace priv {
|
||||||
class WindowImplCocoa;
|
class WindowImplCocoa;
|
||||||
@ -199,3 +209,11 @@ namespace sf {
|
|||||||
-(void)updateCursorGrabbed;
|
-(void)updateCursorGrabbed;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
@ -33,6 +33,14 @@
|
|||||||
#import <SFML/Window/OSX/SFOpenGLView+mouse_priv.h>
|
#import <SFML/Window/OSX/SFOpenGLView+mouse_priv.h>
|
||||||
#import <SFML/Window/OSX/SFSilentResponder.h>
|
#import <SFML/Window/OSX/SFSilentResponder.h>
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// SFOpenGLView class: Privates Methods Declaration
|
/// SFOpenGLView class: Privates Methods Declaration
|
||||||
@ -214,7 +222,7 @@
|
|||||||
point = [self convertPointToScreen:point];
|
point = [self convertPointToScreen:point];
|
||||||
|
|
||||||
// Flip screen coordinates to match CGDisplayMoveCursorToPoint referential.
|
// Flip screen coordinates to match CGDisplayMoveCursorToPoint referential.
|
||||||
const float screenHeight = [[[self window] screen] frame].size.height;
|
const double screenHeight = [[[self window] screen] frame].size.height;
|
||||||
point.y = screenHeight - point.y;
|
point.y = screenHeight - point.y;
|
||||||
|
|
||||||
return point;
|
return point;
|
||||||
@ -239,7 +247,7 @@
|
|||||||
// Send a resize event if the scaling factor changed
|
// Send a resize event if the scaling factor changed
|
||||||
if ((m_scaleFactor != oldScaleFactor) && (m_requester != 0)) {
|
if ((m_scaleFactor != oldScaleFactor) && (m_requester != 0)) {
|
||||||
NSSize newSize = [self frame].size;
|
NSSize newSize = [self frame].size;
|
||||||
m_requester->windowResized(newSize.width, newSize.height);
|
m_requester->windowResized(static_cast<unsigned int>(newSize.width), static_cast<unsigned int>(newSize.height));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,7 +279,7 @@
|
|||||||
|
|
||||||
// The new size
|
// The new size
|
||||||
NSSize newSize = [self frame].size;
|
NSSize newSize = [self frame].size;
|
||||||
m_requester->windowResized(newSize.width, newSize.height);
|
m_requester->windowResized(static_cast<unsigned int>(newSize.width), static_cast<unsigned int>(newSize.height));
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
|
@ -33,6 +33,14 @@
|
|||||||
#import <SFML/Window/OSX/SFOpenGLView.h>
|
#import <SFML/Window/OSX/SFOpenGLView.h>
|
||||||
#import <SFML/Window/OSX/SFViewController.h>
|
#import <SFML/Window/OSX/SFViewController.h>
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
@implementation SFViewController
|
@implementation SFViewController
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,6 +42,14 @@
|
|||||||
#import <SFML/Window/OSX/SFWindowController.h>
|
#import <SFML/Window/OSX/SFWindowController.h>
|
||||||
#import <OpenGL/OpenGL.h>
|
#import <OpenGL/OpenGL.h>
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// SFBlackView is a simple view filled with black, nothing more
|
/// SFBlackView is a simple view filled with black, nothing more
|
||||||
///
|
///
|
||||||
@ -153,7 +161,7 @@
|
|||||||
m_window = nil;
|
m_window = nil;
|
||||||
m_oglView = nil;
|
m_oglView = nil;
|
||||||
m_requester = 0;
|
m_requester = 0;
|
||||||
m_fullscreen = (style & sf::Style::Fullscreen);
|
m_fullscreen = ((style & sf::Style::Fullscreen) != 0) ? YES : NO;
|
||||||
m_restoreResize = NO;
|
m_restoreResize = NO;
|
||||||
m_highDpi = NO;
|
m_highDpi = NO;
|
||||||
|
|
||||||
@ -359,7 +367,7 @@
|
|||||||
-(void)setCursorGrabbed:(BOOL)grabbed
|
-(void)setCursorGrabbed:(BOOL)grabbed
|
||||||
{
|
{
|
||||||
// Remove or restore resizeable style if needed
|
// Remove or restore resizeable style if needed
|
||||||
BOOL resizeable = [m_window styleMask] & NSResizableWindowMask;
|
BOOL resizeable = (([m_window styleMask] & NSResizableWindowMask) != 0) ? YES : NO;
|
||||||
if (grabbed && resizeable)
|
if (grabbed && resizeable)
|
||||||
{
|
{
|
||||||
m_restoreResize = YES;
|
m_restoreResize = YES;
|
||||||
@ -403,7 +411,7 @@
|
|||||||
CGFloat y = screen.origin.y + [m_oglView frame].size.height;
|
CGFloat y = screen.origin.y + [m_oglView frame].size.height;
|
||||||
|
|
||||||
// Flip y-axis (titlebar was already taken into account above)
|
// Flip y-axis (titlebar was already taken into account above)
|
||||||
y = [self screenHeight] - y;
|
y = static_cast<double>([self screenHeight]) - y;
|
||||||
|
|
||||||
return NSMakePoint(x, y);
|
return NSMakePoint(x, y);
|
||||||
}
|
}
|
||||||
@ -415,7 +423,7 @@
|
|||||||
NSPoint point = NSMakePoint(x, y);
|
NSPoint point = NSMakePoint(x, y);
|
||||||
|
|
||||||
// Flip for SFML window coordinate system and take titlebar into account
|
// Flip for SFML window coordinate system and take titlebar into account
|
||||||
point.y = [self screenHeight] - point.y + [self titlebarHeight];
|
point.y = static_cast<double>([self screenHeight]) - point.y + static_cast<double>([self titlebarHeight]);
|
||||||
|
|
||||||
// Place the window.
|
// Place the window.
|
||||||
[m_window setFrameTopLeftPoint:point];
|
[m_window setFrameTopLeftPoint:point];
|
||||||
@ -461,7 +469,7 @@
|
|||||||
[m_window setStyleMask:styleMask ^ NSResizableWindowMask];
|
[m_window setStyleMask:styleMask ^ NSResizableWindowMask];
|
||||||
|
|
||||||
// Add titlebar height.
|
// Add titlebar height.
|
||||||
height += [self titlebarHeight];
|
height += static_cast<unsigned int>([self titlebarHeight]);
|
||||||
|
|
||||||
// Corner case: don't set the window height bigger than the screen height
|
// Corner case: don't set the window height bigger than the screen height
|
||||||
// or the view will be resized _later_ without generating a resize event.
|
// or the view will be resized _later_ without generating a resize event.
|
||||||
@ -469,11 +477,11 @@
|
|||||||
CGFloat maxVisibleHeight = screenFrame.size.height;
|
CGFloat maxVisibleHeight = screenFrame.size.height;
|
||||||
if (height > maxVisibleHeight)
|
if (height > maxVisibleHeight)
|
||||||
{
|
{
|
||||||
height = maxVisibleHeight;
|
height = static_cast<unsigned int>(maxVisibleHeight);
|
||||||
|
|
||||||
// The size is not the requested one, we fire an event
|
// The size is not the requested one, we fire an event
|
||||||
if (m_requester != 0)
|
if (m_requester != 0)
|
||||||
m_requester->windowResized(width, height - [self titlebarHeight]);
|
m_requester->windowResized(width, height - static_cast<unsigned int>([self titlebarHeight]));
|
||||||
}
|
}
|
||||||
|
|
||||||
NSRect frame = NSMakeRect([m_window frame].origin.x,
|
NSRect frame = NSMakeRect([m_window frame].origin.x,
|
||||||
@ -621,16 +629,16 @@
|
|||||||
{
|
{
|
||||||
NSDictionary* deviceDescription = [[m_window screen] deviceDescription];
|
NSDictionary* deviceDescription = [[m_window screen] deviceDescription];
|
||||||
NSNumber* screenNumber = [deviceDescription valueForKey:@"NSScreenNumber"];
|
NSNumber* screenNumber = [deviceDescription valueForKey:@"NSScreenNumber"];
|
||||||
CGDirectDisplayID screenID = (CGDirectDisplayID)[screenNumber intValue];
|
CGDirectDisplayID screenID = static_cast<CGDirectDisplayID>([screenNumber intValue]);
|
||||||
CGFloat height = CGDisplayPixelsHigh(screenID);
|
CGFloat height = CGDisplayPixelsHigh(screenID);
|
||||||
return height;
|
return static_cast<float>(height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
-(float)titlebarHeight
|
-(float)titlebarHeight
|
||||||
{
|
{
|
||||||
return NSHeight([m_window frame]) - NSHeight([[m_window contentView] frame]);
|
return static_cast<float>(NSHeight([m_window frame]) - NSHeight([[m_window contentView] frame]));
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -54,7 +54,7 @@ inline CGFloat getDefaultScaleFactor()
|
|||||||
template <class T>
|
template <class T>
|
||||||
void scaleIn(T& in, id<WindowImplDelegateProtocol> delegate)
|
void scaleIn(T& in, id<WindowImplDelegateProtocol> delegate)
|
||||||
{
|
{
|
||||||
in /= delegate ? [delegate displayScaleFactor] : getDefaultScaleFactor();
|
in /= static_cast<T>(delegate ? [delegate displayScaleFactor] : getDefaultScaleFactor());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
@ -81,7 +81,7 @@ void scaleInXY(T& in, id<WindowImplDelegateProtocol> delegate)
|
|||||||
template <class T>
|
template <class T>
|
||||||
void scaleOut(T& out, id<WindowImplDelegateProtocol> delegate)
|
void scaleOut(T& out, id<WindowImplDelegateProtocol> delegate)
|
||||||
{
|
{
|
||||||
out *= delegate ? [delegate displayScaleFactor] : getDefaultScaleFactor();
|
out = out * static_cast<T>(delegate ? [delegate displayScaleFactor] : getDefaultScaleFactor());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
@ -56,7 +56,7 @@ std::vector<VideoMode> VideoModeImpl::getFullscreenModes()
|
|||||||
const CFIndex modesCount = CFArrayGetCount(cgmodes);
|
const CFIndex modesCount = CFArrayGetCount(cgmodes);
|
||||||
for (CFIndex i = 0; i < modesCount; i++)
|
for (CFIndex i = 0; i < modesCount; i++)
|
||||||
{
|
{
|
||||||
CGDisplayModeRef cgmode = (CGDisplayModeRef)CFArrayGetValueAtIndex(cgmodes, i);
|
CGDisplayModeRef cgmode = static_cast<CGDisplayModeRef>(const_cast<void*>(CFArrayGetValueAtIndex(cgmodes, i)));
|
||||||
|
|
||||||
VideoMode mode = convertCGModeToSFMode(cgmode);
|
VideoMode mode = convertCGModeToSFMode(cgmode);
|
||||||
|
|
||||||
|
@ -32,6 +32,16 @@
|
|||||||
#include <SFML/Window/Event.hpp>
|
#include <SFML/Window/Event.hpp>
|
||||||
#include <SFML/Window/WindowImpl.hpp>
|
#include <SFML/Window/WindowImpl.hpp>
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Predefine OBJ-C classes
|
/// Predefine OBJ-C classes
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@ -374,5 +384,12 @@ private:
|
|||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // SFML_WINDOWIMPLCOCOA_HPP
|
#endif // SFML_WINDOWIMPLCOCOA_HPP
|
||||||
|
@ -89,7 +89,7 @@ m_showCursor(true)
|
|||||||
{
|
{
|
||||||
AutoreleasePool pool;
|
AutoreleasePool pool;
|
||||||
// Treat the handle as it real type
|
// Treat the handle as it real type
|
||||||
id nsHandle = (id)handle;
|
id nsHandle = static_cast<id>(handle);
|
||||||
if ([nsHandle isKindOfClass:[NSWindow class]])
|
if ([nsHandle isKindOfClass:[NSWindow class]])
|
||||||
{
|
{
|
||||||
// We have a window.
|
// We have a window.
|
||||||
@ -409,7 +409,7 @@ Vector2i WindowImplCocoa::getPosition() const
|
|||||||
{
|
{
|
||||||
AutoreleasePool pool;
|
AutoreleasePool pool;
|
||||||
NSPoint pos = [m_delegate position];
|
NSPoint pos = [m_delegate position];
|
||||||
sf::Vector2i ret(pos.x, pos.y);
|
sf::Vector2i ret(static_cast<int>(pos.x), static_cast<int>(pos.y));
|
||||||
scaleOutXY(ret, m_delegate);
|
scaleOutXY(ret, m_delegate);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -430,7 +430,7 @@ Vector2u WindowImplCocoa::getSize() const
|
|||||||
{
|
{
|
||||||
AutoreleasePool pool;
|
AutoreleasePool pool;
|
||||||
NSSize size = [m_delegate size];
|
NSSize size = [m_delegate size];
|
||||||
Vector2u ret(size.width, size.height);
|
Vector2u ret(static_cast<unsigned int>(size.width), static_cast<unsigned int>(size.height));
|
||||||
scaleOutXY(ret, m_delegate);
|
scaleOutXY(ret, m_delegate);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,16 @@
|
|||||||
|
|
||||||
#import <AppKit/AppKit.h>
|
#import <AppKit/AppKit.h>
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace sf {
|
namespace sf {
|
||||||
namespace priv {
|
namespace priv {
|
||||||
class WindowImplCocoa;
|
class WindowImplCocoa;
|
||||||
@ -232,3 +242,11 @@ namespace sf {
|
|||||||
-(void)applyContext:(NSOpenGLContext*)context;
|
-(void)applyContext:(NSOpenGLContext*)context;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
@ -31,6 +31,14 @@
|
|||||||
|
|
||||||
#import <SFML/Window/OSX/Scaling.h>
|
#import <SFML/Window/OSX/Scaling.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 sf
|
||||||
{
|
{
|
||||||
namespace priv
|
namespace priv
|
||||||
@ -87,7 +95,7 @@ VideoMode convertCGModeToSFMode(CGDisplayModeRef cgmode)
|
|||||||
//
|
//
|
||||||
// [1]: "APIs for Supporting High Resolution" > "Additions and Changes for OS X v10.8"
|
// [1]: "APIs for Supporting High Resolution" > "Additions and Changes for OS X v10.8"
|
||||||
// https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/APIs/APIs.html#//apple_ref/doc/uid/TP40012302-CH5-SW27
|
// https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/APIs/APIs.html#//apple_ref/doc/uid/TP40012302-CH5-SW27
|
||||||
VideoMode mode(CGDisplayModeGetWidth(cgmode), CGDisplayModeGetHeight(cgmode), modeBitsPerPixel(cgmode));
|
VideoMode mode(static_cast<unsigned int>(CGDisplayModeGetWidth(cgmode)), static_cast<unsigned int>(CGDisplayModeGetHeight(cgmode)), static_cast<unsigned int>(modeBitsPerPixel(cgmode)));
|
||||||
scaleOutWidthHeight(mode, nil);
|
scaleOutWidthHeight(mode, nil);
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ NSString* stringToNSString(const std::string& string)
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
NSString* sfStringToNSString(const sf::String& string)
|
NSString* sfStringToNSString(const sf::String& string)
|
||||||
{
|
{
|
||||||
sf::Uint32 length = string.getSize() * sizeof(sf::Uint32);
|
sf::Uint32 length = static_cast<sf::Uint32>(string.getSize() * sizeof(sf::Uint32));
|
||||||
const void* data = reinterpret_cast<const void*>(string.getData());
|
const void* data = reinterpret_cast<const void*>(string.getData());
|
||||||
|
|
||||||
NSStringEncoding encoding;
|
NSStringEncoding encoding;
|
||||||
|
@ -51,6 +51,7 @@ bool Vulkan::isAvailable(bool requireGraphics)
|
|||||||
{
|
{
|
||||||
#if defined(SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE)
|
#if defined(SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE)
|
||||||
|
|
||||||
|
(void) requireGraphics;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@ -66,6 +67,7 @@ VulkanFunctionPointer Vulkan::getFunction(const char* name)
|
|||||||
{
|
{
|
||||||
#if defined(SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE)
|
#if defined(SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE)
|
||||||
|
|
||||||
|
(void) name;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -288,6 +288,9 @@ bool WindowImpl::createVulkanSurface(const VkInstance& instance, VkSurfaceKHR& s
|
|||||||
{
|
{
|
||||||
#if defined(SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE)
|
#if defined(SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE)
|
||||||
|
|
||||||
|
(void) instance;
|
||||||
|
(void) surface;
|
||||||
|
(void) allocator;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -47,7 +47,7 @@ CursorImpl::~CursorImpl()
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool CursorImpl::loadFromPixels(const Uint8* pixels, Vector2u size, Vector2u hotspot)
|
bool CursorImpl::loadFromPixels(const Uint8* /* pixels */, Vector2u /* size */, Vector2u /* hotspot */)
|
||||||
{
|
{
|
||||||
// Not supported
|
// Not supported
|
||||||
return false;
|
return false;
|
||||||
@ -55,7 +55,7 @@ bool CursorImpl::loadFromPixels(const Uint8* pixels, Vector2u size, Vector2u hot
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool CursorImpl::loadFromSystem(Cursor::Type type)
|
bool CursorImpl::loadFromSystem(Cursor::Type /* type */)
|
||||||
{
|
{
|
||||||
// Not supported
|
// Not supported
|
||||||
return false;
|
return false;
|
||||||
|
@ -35,6 +35,14 @@
|
|||||||
#include <QuartzCore/CAEAGLLayer.h>
|
#include <QuartzCore/CAEAGLLayer.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.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
|
namespace
|
||||||
{
|
{
|
||||||
@ -114,8 +122,8 @@ m_clock ()
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
EaglContext::EaglContext(EaglContext* shared, const ContextSettings& settings,
|
EaglContext::EaglContext(EaglContext* /* shared */, const ContextSettings& /* settings */,
|
||||||
unsigned int width, unsigned int height) :
|
unsigned int /* width */, unsigned int /* height */) :
|
||||||
m_context (nil),
|
m_context (nil),
|
||||||
m_framebuffer (0),
|
m_framebuffer (0),
|
||||||
m_colorbuffer (0),
|
m_colorbuffer (0),
|
||||||
@ -179,7 +187,8 @@ GlFunctionPointer EaglContext::getFunction(const char* name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (module)
|
if (module)
|
||||||
return reinterpret_cast<GlFunctionPointer>(dlsym(module, name));
|
return reinterpret_cast<GlFunctionPointer>(
|
||||||
|
reinterpret_cast<uintptr_t>(dlsym(module, name)));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -205,7 +214,7 @@ void EaglContext::recreateRenderBuffers(SFView* glView)
|
|||||||
glGenRenderbuffersOESFunc(1, &m_colorbuffer);
|
glGenRenderbuffersOESFunc(1, &m_colorbuffer);
|
||||||
glBindRenderbufferOESFunc(GL_RENDERBUFFER_OES, m_colorbuffer);
|
glBindRenderbufferOESFunc(GL_RENDERBUFFER_OES, m_colorbuffer);
|
||||||
if (glView)
|
if (glView)
|
||||||
[m_context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(CAEAGLLayer*)glView.layer];
|
[m_context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(static_cast<CAEAGLLayer*>(glView.layer))];
|
||||||
glFramebufferRenderbufferOESFunc(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, m_colorbuffer);
|
glFramebufferRenderbufferOESFunc(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, m_colorbuffer);
|
||||||
|
|
||||||
// Create a depth buffer if requested
|
// Create a depth buffer if requested
|
||||||
@ -278,7 +287,7 @@ void EaglContext::setVerticalSyncEnabled(bool enabled)
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void EaglContext::createContext(EaglContext* shared,
|
void EaglContext::createContext(EaglContext* shared,
|
||||||
const WindowImplUIKit* window,
|
const WindowImplUIKit* window,
|
||||||
unsigned int bitsPerPixel,
|
unsigned int /* bitsPerPixel */,
|
||||||
const ContextSettings& settings)
|
const ContextSettings& settings)
|
||||||
{
|
{
|
||||||
// Save the settings
|
// Save the settings
|
||||||
|
@ -37,7 +37,7 @@ namespace sf
|
|||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool InputImpl::isKeyPressed(Keyboard::Key key)
|
bool InputImpl::isKeyPressed(Keyboard::Key /* key */)
|
||||||
{
|
{
|
||||||
// Not applicable
|
// Not applicable
|
||||||
return false;
|
return false;
|
||||||
@ -52,7 +52,7 @@ void InputImpl::setVirtualKeyboardVisible(bool visible)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool InputImpl::isMouseButtonPressed(Mouse::Button button)
|
bool InputImpl::isMouseButtonPressed(Mouse::Button /* button */)
|
||||||
{
|
{
|
||||||
// Not applicable
|
// Not applicable
|
||||||
return false;
|
return false;
|
||||||
@ -67,23 +67,21 @@ Vector2i InputImpl::getMousePosition()
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Vector2i InputImpl::getMousePosition(const WindowBase& relativeTo)
|
Vector2i InputImpl::getMousePosition(const WindowBase& /* relativeTo */)
|
||||||
{
|
{
|
||||||
(void)relativeTo;
|
|
||||||
|
|
||||||
return getMousePosition();
|
return getMousePosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void InputImpl::setMousePosition(const Vector2i& position)
|
void InputImpl::setMousePosition(const Vector2i& /* position */)
|
||||||
{
|
{
|
||||||
// Not applicable
|
// Not applicable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void InputImpl::setMousePosition(const Vector2i& position, const WindowBase& relativeTo)
|
void InputImpl::setMousePosition(const Vector2i& /* position */, const WindowBase& /* relativeTo */)
|
||||||
{
|
{
|
||||||
// Not applicable
|
// Not applicable
|
||||||
}
|
}
|
||||||
@ -104,10 +102,8 @@ Vector2i InputImpl::getTouchPosition(unsigned int finger)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Vector2i InputImpl::getTouchPosition(unsigned int finger, const WindowBase& relativeTo)
|
Vector2i InputImpl::getTouchPosition(unsigned int finger, const WindowBase& /* relativeTo */)
|
||||||
{
|
{
|
||||||
(void)relativeTo;
|
|
||||||
|
|
||||||
return getTouchPosition(finger);
|
return getTouchPosition(finger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ void JoystickImpl::cleanup()
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool JoystickImpl::isConnected(unsigned int index)
|
bool JoystickImpl::isConnected(unsigned int /* index */)
|
||||||
{
|
{
|
||||||
// Not implemented
|
// Not implemented
|
||||||
return false;
|
return false;
|
||||||
@ -55,7 +55,7 @@ bool JoystickImpl::isConnected(unsigned int index)
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
bool JoystickImpl::open(unsigned int index)
|
bool JoystickImpl::open(unsigned int /* index */)
|
||||||
{
|
{
|
||||||
// Not implemented
|
// Not implemented
|
||||||
return false;
|
return false;
|
||||||
|
@ -171,7 +171,26 @@ namespace
|
|||||||
if (!self.sfWindow)
|
if (!self.sfWindow)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
UIViewController* rootViewController = [((__bridge UIWindow*)(self.sfWindow->getSystemHandle())) rootViewController];
|
UIViewController* rootViewController = [((__bridge UIWindow*)(self.sfWindow->getSystemHandle())) rootViewController];
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!rootViewController || ![rootViewController shouldAutorotate])
|
if (!rootViewController || ![rootViewController shouldAutorotate])
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -189,7 +208,7 @@ namespace
|
|||||||
if ([supportedOrientations containsObject:@"UIInterfaceOrientationLandscapeRight"])
|
if ([supportedOrientations containsObject:@"UIInterfaceOrientationLandscapeRight"])
|
||||||
appFlags += UIInterfaceOrientationMaskLandscapeRight;
|
appFlags += UIInterfaceOrientationMaskLandscapeRight;
|
||||||
|
|
||||||
return (1 << orientation) & [rootViewController supportedInterfaceOrientations] & appFlags;
|
return (1 << orientation) & [rootViewController supportedInterfaceOrientations] & static_cast<unsigned long>(appFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (bool)needsToFlipFrameForOrientation:(UIDeviceOrientation)orientation
|
- (bool)needsToFlipFrameForOrientation:(UIDeviceOrientation)orientation
|
||||||
@ -244,10 +263,10 @@ namespace
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
- (void)notifyTouchBegin:(unsigned int)index atPosition:(sf::Vector2i)position;
|
- (void)notifyTouchBegin:(unsigned int)index atPosition:(sf::Vector2i)position
|
||||||
{
|
{
|
||||||
position.x *= backingScaleFactor;
|
position.x *= static_cast<int>(backingScaleFactor);
|
||||||
position.y *= backingScaleFactor;
|
position.y *= static_cast<int>(backingScaleFactor);
|
||||||
|
|
||||||
// save the touch position
|
// save the touch position
|
||||||
if (index >= touchPositions.size())
|
if (index >= touchPositions.size())
|
||||||
@ -268,10 +287,10 @@ namespace
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
- (void)notifyTouchMove:(unsigned int)index atPosition:(sf::Vector2i)position;
|
- (void)notifyTouchMove:(unsigned int)index atPosition:(sf::Vector2i)position
|
||||||
{
|
{
|
||||||
position.x *= backingScaleFactor;
|
position.x *= static_cast<int>(backingScaleFactor);
|
||||||
position.y *= backingScaleFactor;
|
position.y *= static_cast<int>(backingScaleFactor);
|
||||||
|
|
||||||
// save the touch position
|
// save the touch position
|
||||||
if (index >= touchPositions.size())
|
if (index >= touchPositions.size())
|
||||||
@ -292,7 +311,7 @@ namespace
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
- (void)notifyTouchEnd:(unsigned int)index atPosition:(sf::Vector2i)position;
|
- (void)notifyTouchEnd:(unsigned int)index atPosition:(sf::Vector2i)position
|
||||||
{
|
{
|
||||||
// clear the touch position
|
// clear the touch position
|
||||||
if (index < touchPositions.size())
|
if (index < touchPositions.size())
|
||||||
@ -304,8 +323,8 @@ namespace
|
|||||||
sf::Event event;
|
sf::Event event;
|
||||||
event.type = sf::Event::TouchEnded;
|
event.type = sf::Event::TouchEnded;
|
||||||
event.touch.finger = index;
|
event.touch.finger = index;
|
||||||
event.touch.x = position.x * backingScaleFactor;
|
event.touch.x = position.x * static_cast<int>(backingScaleFactor);
|
||||||
event.touch.y = position.y * backingScaleFactor;
|
event.touch.y = position.y * static_cast<int>(backingScaleFactor);
|
||||||
sfWindow->forwardEvent(event);
|
sfWindow->forwardEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,14 @@
|
|||||||
#include <QuartzCore/CAEAGLLayer.h>
|
#include <QuartzCore/CAEAGLLayer.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
@interface SFView()
|
@interface SFView()
|
||||||
|
|
||||||
@property (nonatomic) NSMutableArray* touches;
|
@property (nonatomic) NSMutableArray* touches;
|
||||||
@ -103,7 +111,7 @@
|
|||||||
sf::Vector2i position(static_cast<int>(point.x), static_cast<int>(point.y));
|
sf::Vector2i position(static_cast<int>(point.x), static_cast<int>(point.y));
|
||||||
|
|
||||||
// notify the application delegate
|
// notify the application delegate
|
||||||
[[SFAppDelegate getInstance] notifyTouchBegin:index atPosition:position];
|
[[SFAppDelegate getInstance] notifyTouchBegin:(static_cast<unsigned int>(index)) atPosition:position];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +130,7 @@
|
|||||||
sf::Vector2i position(static_cast<int>(point.x), static_cast<int>(point.y));
|
sf::Vector2i position(static_cast<int>(point.x), static_cast<int>(point.y));
|
||||||
|
|
||||||
// notify the application delegate
|
// notify the application delegate
|
||||||
[[SFAppDelegate getInstance] notifyTouchMove:index atPosition:position];
|
[[SFAppDelegate getInstance] notifyTouchMove:(static_cast<unsigned int>(index)) atPosition:position];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,7 +150,7 @@
|
|||||||
sf::Vector2i position(static_cast<int>(point.x), static_cast<int>(point.y));
|
sf::Vector2i position(static_cast<int>(point.x), static_cast<int>(point.y));
|
||||||
|
|
||||||
// notify the application delegate
|
// notify the application delegate
|
||||||
[[SFAppDelegate getInstance] notifyTouchEnd:index atPosition:position];
|
[[SFAppDelegate getInstance] notifyTouchEnd:(static_cast<unsigned int>(index)) atPosition:position];
|
||||||
|
|
||||||
// remove the touch
|
// remove the touch
|
||||||
[self.touches replaceObjectAtIndex:index withObject:[NSNull null]];
|
[self.touches replaceObjectAtIndex:index withObject:[NSNull null]];
|
||||||
@ -187,7 +195,7 @@
|
|||||||
self.touches = [NSMutableArray array];
|
self.touches = [NSMutableArray array];
|
||||||
|
|
||||||
// Configure the EAGL layer
|
// Configure the EAGL layer
|
||||||
CAEAGLLayer* eaglLayer = (CAEAGLLayer*)self.layer;
|
CAEAGLLayer* eaglLayer = static_cast<CAEAGLLayer*>(self.layer);
|
||||||
eaglLayer.opaque = YES;
|
eaglLayer.opaque = YES;
|
||||||
eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
|
eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
[NSNumber numberWithBool:FALSE], kEAGLDrawablePropertyRetainedBacking,
|
[NSNumber numberWithBool:FALSE], kEAGLDrawablePropertyRetainedBacking,
|
||||||
|
@ -139,37 +139,37 @@ Vector3f SensorImpl::update()
|
|||||||
{
|
{
|
||||||
case Sensor::Accelerometer:
|
case Sensor::Accelerometer:
|
||||||
// Acceleration is given in G, convert to m/s^2
|
// Acceleration is given in G, convert to m/s^2
|
||||||
value.x = manager.accelerometerData.acceleration.x * 9.81f;
|
value.x = static_cast<float>(manager.accelerometerData.acceleration.x * 9.81);
|
||||||
value.y = manager.accelerometerData.acceleration.y * 9.81f;
|
value.y = static_cast<float>(manager.accelerometerData.acceleration.y * 9.81);
|
||||||
value.z = manager.accelerometerData.acceleration.z * 9.81f;
|
value.z = static_cast<float>(manager.accelerometerData.acceleration.z * 9.81);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Sensor::Gyroscope:
|
case Sensor::Gyroscope:
|
||||||
// Rotation rates are given in rad/s, convert to deg/s
|
// Rotation rates are given in rad/s, convert to deg/s
|
||||||
value.x = toDegrees(manager.gyroData.rotationRate.x);
|
value.x = toDegrees(static_cast<float>(manager.gyroData.rotationRate.x));
|
||||||
value.y = toDegrees(manager.gyroData.rotationRate.y);
|
value.y = toDegrees(static_cast<float>(manager.gyroData.rotationRate.y));
|
||||||
value.z = toDegrees(manager.gyroData.rotationRate.z);
|
value.z = toDegrees(static_cast<float>(manager.gyroData.rotationRate.z));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Sensor::Magnetometer:
|
case Sensor::Magnetometer:
|
||||||
// Magnetic field is given in microteslas
|
// Magnetic field is given in microteslas
|
||||||
value.x = manager.magnetometerData.magneticField.x;
|
value.x = static_cast<float>(manager.magnetometerData.magneticField.x);
|
||||||
value.y = manager.magnetometerData.magneticField.y;
|
value.y = static_cast<float>(manager.magnetometerData.magneticField.y);
|
||||||
value.z = manager.magnetometerData.magneticField.z;
|
value.z = static_cast<float>(manager.magnetometerData.magneticField.z);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Sensor::UserAcceleration:
|
case Sensor::UserAcceleration:
|
||||||
// User acceleration is given in G, convert to m/s^2
|
// User acceleration is given in G, convert to m/s^2
|
||||||
value.x = manager.deviceMotion.userAcceleration.x * 9.81f;
|
value.x = static_cast<float>(manager.deviceMotion.userAcceleration.x * 9.81);
|
||||||
value.y = manager.deviceMotion.userAcceleration.y * 9.81f;
|
value.y = static_cast<float>(manager.deviceMotion.userAcceleration.y * 9.81);
|
||||||
value.z = manager.deviceMotion.userAcceleration.z * 9.81f;
|
value.z = static_cast<float>(manager.deviceMotion.userAcceleration.z * 9.81);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Sensor::Orientation:
|
case Sensor::Orientation:
|
||||||
// Absolute rotation (Euler) angles are given in radians, convert to degrees
|
// Absolute rotation (Euler) angles are given in radians, convert to degrees
|
||||||
value.x = toDegrees(manager.deviceMotion.attitude.yaw);
|
value.x = toDegrees(static_cast<float>(manager.deviceMotion.attitude.yaw));
|
||||||
value.y = toDegrees(manager.deviceMotion.attitude.pitch);
|
value.y = toDegrees(static_cast<float>(manager.deviceMotion.attitude.pitch));
|
||||||
value.z = toDegrees(manager.deviceMotion.attitude.roll);
|
value.z = toDegrees(static_cast<float>(manager.deviceMotion.attitude.roll));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -50,8 +50,8 @@ std::vector<VideoMode> VideoModeImpl::getFullscreenModes()
|
|||||||
VideoMode VideoModeImpl::getDesktopMode()
|
VideoMode VideoModeImpl::getDesktopMode()
|
||||||
{
|
{
|
||||||
CGRect bounds = [[UIScreen mainScreen] bounds];
|
CGRect bounds = [[UIScreen mainScreen] bounds];
|
||||||
float backingScale = [SFAppDelegate getInstance].backingScaleFactor;
|
double backingScale = [SFAppDelegate getInstance].backingScaleFactor;
|
||||||
return VideoMode(bounds.size.width * backingScale, bounds.size.height * backingScale);
|
return VideoMode(static_cast<unsigned int>(bounds.size.width * backingScale), static_cast<unsigned int>(bounds.size.height * backingScale));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace priv
|
} // namespace priv
|
||||||
|
@ -33,12 +33,20 @@
|
|||||||
#include <SFML/System/Err.hpp>
|
#include <SFML/System/Err.hpp>
|
||||||
#include <UIKit/UIKit.h>
|
#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 sf
|
||||||
{
|
{
|
||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImplUIKit::WindowImplUIKit(WindowHandle handle)
|
WindowImplUIKit::WindowImplUIKit(WindowHandle /* handle */)
|
||||||
{
|
{
|
||||||
// Not implemented
|
// Not implemented
|
||||||
}
|
}
|
||||||
@ -46,11 +54,11 @@ WindowImplUIKit::WindowImplUIKit(WindowHandle handle)
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowImplUIKit::WindowImplUIKit(VideoMode mode,
|
WindowImplUIKit::WindowImplUIKit(VideoMode mode,
|
||||||
const String& title,
|
const String& /* title */,
|
||||||
unsigned long style,
|
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
|
// Apply the fullscreen flag
|
||||||
[UIApplication sharedApplication].statusBarHidden = !(style & Style::Titlebar) || (style & Style::Fullscreen);
|
[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);
|
std::swap(viewRect.size.width, viewRect.size.height);
|
||||||
|
|
||||||
// Create the view
|
// 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];
|
[m_view resignFirstResponder];
|
||||||
|
|
||||||
// Create the view controller
|
// Create the view controller
|
||||||
@ -108,7 +116,25 @@ void WindowImplUIKit::processEvents()
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowHandle WindowImplUIKit::getSystemHandle() const
|
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;
|
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
|
Vector2i WindowImplUIKit::getPosition() const
|
||||||
{
|
{
|
||||||
CGPoint origin = m_window.frame.origin;
|
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
|
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
|
// 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)
|
if ((NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_7_1)
|
||||||
&& UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]))
|
&& UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]))
|
||||||
std::swap(physicalFrame.size.width, physicalFrame.size.height);
|
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
|
// 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
|
// Not applicable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplUIKit::setVisible(bool visible)
|
void WindowImplUIKit::setVisible(bool /* visible */)
|
||||||
{
|
{
|
||||||
// Not applicable
|
// Not applicable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplUIKit::setMouseCursorVisible(bool visible)
|
void WindowImplUIKit::setMouseCursorVisible(bool /* visible */)
|
||||||
{
|
{
|
||||||
// Not applicable
|
// Not applicable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplUIKit::setMouseCursorGrabbed(bool grabbed)
|
void WindowImplUIKit::setMouseCursorGrabbed(bool /* grabbed */)
|
||||||
{
|
{
|
||||||
// Not applicable
|
// Not applicable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplUIKit::setMouseCursor(const CursorImpl& cursor)
|
void WindowImplUIKit::setMouseCursor(const CursorImpl& /* cursor */)
|
||||||
{
|
{
|
||||||
// Not applicable
|
// Not applicable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowImplUIKit::setKeyRepeatEnabled(bool enabled)
|
void WindowImplUIKit::setKeyRepeatEnabled(bool /* enabled */)
|
||||||
{
|
{
|
||||||
// Not applicable
|
// Not applicable
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user