diff --git a/src/SFML/Graphics/Shader.cpp b/src/SFML/Graphics/Shader.cpp index 90856b00..444a738e 100644 --- a/src/SFML/Graphics/Shader.cpp +++ b/src/SFML/Graphics/Shader.cpp @@ -1035,256 +1035,256 @@ Shader::~Shader() //////////////////////////////////////////////////////////// -bool Shader::loadFromFile(const std::string& filename, Type type) +bool Shader::loadFromFile(const std::string& /* filename */, Type /* type */) { 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; } //////////////////////////////////////////////////////////// -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; } //////////////////////////////////////////////////////////// -bool Shader::loadFromMemory(const std::string& shader, Type type) +bool Shader::loadFromMemory(const std::string& /* shader */, Type /* type */) { 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; } //////////////////////////////////////////////////////////// -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; } //////////////////////////////////////////////////////////// -bool Shader::loadFromStream(InputStream& stream, Type type) +bool Shader::loadFromStream(InputStream& /* stream */, Type /* type */) { return false; } //////////////////////////////////////////////////////////// -bool Shader::loadFromStream(InputStream& vertexShaderStream, InputStream& fragmentShaderStream) +bool Shader::loadFromStream(InputStream& /* vertexShaderStream */, InputStream& /* fragmentShaderStream */) { return false; } //////////////////////////////////////////////////////////// -bool Shader::loadFromStream(InputStream& vertexShaderStream, InputStream& geometryShaderStream, InputStream& fragmentShaderStream) +bool Shader::loadFromStream(InputStream& /* vertexShaderStream */, InputStream& /* geometryShaderStream */, InputStream& /* fragmentShaderStream */) { 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 */) { } //////////////////////////////////////////////////////////// -void Shader::setParameter(const std::string& name, float x) +void Shader::setParameter(const std::string& /* name */, float) { } //////////////////////////////////////////////////////////// -void Shader::setParameter(const std::string& name, float x, float y) +void Shader::setParameter(const std::string& /* name */, float, float) { } //////////////////////////////////////////////////////////// -void Shader::setParameter(const std::string& name, float x, float y, float z) +void Shader::setParameter(const std::string& /* name */, float, float, float) { } //////////////////////////////////////////////////////////// -void Shader::setParameter(const std::string& name, float x, float y, float z, float w) +void Shader::setParameter(const std::string& /* name */, float, float, float, float) { } //////////////////////////////////////////////////////////// -void Shader::setParameter(const std::string& name, const Vector2f& v) +void Shader::setParameter(const std::string& /* name */, const Vector2f&) { } //////////////////////////////////////////////////////////// -void Shader::setParameter(const std::string& name, const Vector3f& v) +void Shader::setParameter(const std::string& /* name */, const Vector3f&) { } //////////////////////////////////////////////////////////// -void Shader::setParameter(const std::string& name, const Color& color) +void Shader::setParameter(const std::string& /* name */, const Color& /* color */) { } //////////////////////////////////////////////////////////// -void Shader::setParameter(const std::string& name, const Transform& transform) +void Shader::setParameter(const std::string& /* name */, const Transform& /* transform */) { } //////////////////////////////////////////////////////////// -void Shader::setParameter(const std::string& name, const Texture& texture) +void Shader::setParameter(const std::string& /* name */, const Texture& /* texture */) { } //////////////////////////////////////////////////////////// -void Shader::setParameter(const std::string& name, CurrentTextureType) +void Shader::setParameter(const std::string& /* name */, CurrentTextureType) { } @@ -1297,7 +1297,7 @@ unsigned int Shader::getNativeHandle() const //////////////////////////////////////////////////////////// -void Shader::bind(const Shader* shader) +void Shader::bind(const Shader* /* shader */) { } @@ -1317,7 +1317,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; } diff --git a/src/SFML/Graphics/VertexBuffer.cpp b/src/SFML/Graphics/VertexBuffer.cpp index 3c09716c..1116addf 100644 --- a/src/SFML/Graphics/VertexBuffer.cpp +++ b/src/SFML/Graphics/VertexBuffer.cpp @@ -208,6 +208,7 @@ bool VertexBuffer::update(const VertexBuffer& vertexBuffer) { #ifdef SFML_OPENGL_ES + (void) vertexBuffer; return false; #else diff --git a/src/SFML/Main/SFMLActivity.cpp b/src/SFML/Main/SFMLActivity.cpp index caf191b2..f6b5c327 100644 --- a/src/SFML/Main/SFMLActivity.cpp +++ b/src/SFML/Main/SFMLActivity.cpp @@ -68,7 +68,7 @@ const char *getLibraryName(JNIEnv* lJNIEnv, jobject& objectActivityInfo) } // Convert the application name to a C++ string and return it - const jsize applicationNameLength = lJNIEnv->GetStringUTFLength(valueString); + const size_t applicationNameLength = static_cast(lJNIEnv->GetStringUTFLength(valueString)); const char* applicationName = lJNIEnv->GetStringUTFChars(valueString, NULL); if (applicationNameLength >= 256) @@ -141,7 +141,7 @@ void ANativeActivity_onCreate(ANativeActivity* activity, void* savedState, size_ // With libname being the library name such as "jpeg". // Retrieve JNI environment and JVM instance - JavaVM* lJavaVM = activity->vm; + // JavaVM* lJavaVM = activity->vm; JNIEnv* lJNIEnv = activity->env; // Retrieve the NativeActivity diff --git a/src/SFML/System/Android/Activity.cpp b/src/SFML/System/Android/Activity.cpp index 3e32ccde..14b3dbce 100644 --- a/src/SFML/System/Android/Activity.cpp +++ b/src/SFML/System/Android/Activity.cpp @@ -41,14 +41,14 @@ std::streambuf() 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(c)); LOGE("%s", m_message.c_str()); m_message.clear(); } - m_message.push_back(c); + m_message.push_back(static_cast(c)); return traits_type::not_eof(c); } diff --git a/src/SFML/System/Android/ResourceStream.cpp b/src/SFML/System/Android/ResourceStream.cpp index adfde852..fa595d38 100644 --- a/src/SFML/System/Android/ResourceStream.cpp +++ b/src/SFML/System/Android/ResourceStream.cpp @@ -61,7 +61,7 @@ Int64 ResourceStream::read(void *data, Int64 size) { if (m_file) { - return AAsset_read(m_file, data, size); + return AAsset_read(m_file, data, static_cast(size)); } else { @@ -75,7 +75,7 @@ Int64 ResourceStream::seek(Int64 position) { if (m_file) { - return AAsset_seek(m_file, position, SEEK_SET); + return AAsset_seek(m_file, static_cast(position), SEEK_SET); } else { diff --git a/src/SFML/Window/Android/ClipboardImpl.cpp b/src/SFML/Window/Android/ClipboardImpl.cpp index 5aceb0e7..f6410b5b 100644 --- a/src/SFML/Window/Android/ClipboardImpl.cpp +++ b/src/SFML/Window/Android/ClipboardImpl.cpp @@ -42,7 +42,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"; } diff --git a/src/SFML/Window/Android/CursorImpl.cpp b/src/SFML/Window/Android/CursorImpl.cpp index 53d287e8..9d064a74 100644 --- a/src/SFML/Window/Android/CursorImpl.cpp +++ b/src/SFML/Window/Android/CursorImpl.cpp @@ -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 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 return false; diff --git a/src/SFML/Window/Android/InputImpl.cpp b/src/SFML/Window/Android/InputImpl.cpp index 6c19f779..3a096e3f 100644 --- a/src/SFML/Window/Android/InputImpl.cpp +++ b/src/SFML/Window/Android/InputImpl.cpp @@ -37,7 +37,7 @@ namespace sf namespace priv { //////////////////////////////////////////////////////////// -bool InputImpl::isKeyPressed(Keyboard::Key key) +bool InputImpl::isKeyPressed(Keyboard::Key /* key */) { // Not applicable return false; @@ -52,7 +52,6 @@ void InputImpl::setVirtualKeyboardVisible(bool visible) Lock lock(states.mutex); // Initializes JNI - jint lResult; jint lFlags = 0; JavaVM* lJavaVM = states.activity->vm; @@ -63,7 +62,7 @@ void InputImpl::setVirtualKeyboardVisible(bool visible) lJavaVMAttachArgs.name = "NativeThread"; lJavaVMAttachArgs.group = NULL; - lResult=lJavaVM->AttachCurrentThread(&lJNIEnv, &lJavaVMAttachArgs); + jint lResult = lJavaVM->AttachCurrentThread(&lJNIEnv, &lJavaVMAttachArgs); if (lResult == JNI_ERR) 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(...) jmethodID MethodShowSoftInput = lJNIEnv->GetMethodID(ClassInputMethodManager, "showSoftInput", "(Landroid/view/View;I)Z"); - jboolean lResult = lJNIEnv->CallBooleanMethod(lInputMethodManager, + lJNIEnv->CallBooleanMethod(lInputMethodManager, MethodShowSoftInput, lDecorView, lFlags); } else @@ -121,7 +120,7 @@ void InputImpl::setVirtualKeyboardVisible(bool visible) // lInputMethodManager.hideSoftInput(...) jmethodID MethodHideSoftInput = lJNIEnv->GetMethodID(ClassInputMethodManager, "hideSoftInputFromWindow", "(Landroid/os/IBinder;I)Z"); - jboolean lRes = lJNIEnv->CallBooleanMethod(lInputMethodManager, + lJNIEnv->CallBooleanMethod(lInputMethodManager, MethodHideSoftInput, lBinder, lFlags); lJNIEnv->DeleteLocalRef(lBinder); } @@ -158,21 +157,21 @@ Vector2i InputImpl::getMousePosition() //////////////////////////////////////////////////////////// -Vector2i InputImpl::getMousePosition(const WindowBase& relativeTo) +Vector2i InputImpl::getMousePosition(const WindowBase& /* relativeTo */) { return getMousePosition(); } //////////////////////////////////////////////////////////// -void InputImpl::setMousePosition(const Vector2i& position) +void InputImpl::setMousePosition(const Vector2i& /* position */) { // 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); } @@ -186,7 +185,7 @@ bool InputImpl::isTouchDown(unsigned int finger) priv::ActivityStates& states = priv::getActivity(); Lock lock(states.mutex); - return states.touchEvents.find(finger) != states.touchEvents.end(); + return states.touchEvents.find(static_cast(finger)) != states.touchEvents.end(); } @@ -198,12 +197,12 @@ Vector2i InputImpl::getTouchPosition(unsigned int finger) priv::ActivityStates& states = priv::getActivity(); Lock lock(states.mutex); - return states.touchEvents.find(finger)->second; + return states.touchEvents.find(static_cast(finger))->second; } //////////////////////////////////////////////////////////// -Vector2i InputImpl::getTouchPosition(unsigned int finger, const WindowBase& relativeTo) +Vector2i InputImpl::getTouchPosition(unsigned int finger, const WindowBase& /* relativeTo */) { return getTouchPosition(finger); } diff --git a/src/SFML/Window/Android/JoystickImpl.cpp b/src/SFML/Window/Android/JoystickImpl.cpp index 58dfc829..802e6f85 100644 --- a/src/SFML/Window/Android/JoystickImpl.cpp +++ b/src/SFML/Window/Android/JoystickImpl.cpp @@ -48,7 +48,7 @@ void JoystickImpl::cleanup() //////////////////////////////////////////////////////////// -bool JoystickImpl::isConnected(unsigned int index) +bool JoystickImpl::isConnected(unsigned int /* index */) { // To implement 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 return false; diff --git a/src/SFML/Window/Android/JoystickImpl.hpp b/src/SFML/Window/Android/JoystickImpl.hpp index 2fb8cd30..bad9932f 100644 --- a/src/SFML/Window/Android/JoystickImpl.hpp +++ b/src/SFML/Window/Android/JoystickImpl.hpp @@ -105,7 +105,6 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - int m_index; ///< Index of the joystick Joystick::Identification m_identification; ///< Joystick identification }; diff --git a/src/SFML/Window/Android/SensorImpl.cpp b/src/SFML/Window/Android/SensorImpl.cpp index 7142e1d9..2afe6ae4 100644 --- a/src/SFML/Window/Android/SensorImpl.cpp +++ b/src/SFML/Window/Android/SensorImpl.cpp @@ -54,7 +54,11 @@ void SensorImpl::initialize() looper = ALooper_forThread(); // Get the unique sensor manager - sensorManager = ASensorManager_getInstance(); + #if ANDROID_API >= 26 || __ANDROID_API__ >= 26 + sensorManager = ASensorManager_getInstanceForPackage(nullptr); + #else + sensorManager = ASensorManager_getInstance(); + #endif // Create the sensor events queue and attach it to the looper sensorEventQueue = ASensorManager_createEventQueue(sensorManager, looper, @@ -93,7 +97,7 @@ bool SensorImpl::open(Sensor::Type sensor) Time minimumDelay = microseconds(ASensor_getMinDelay(m_sensor)); // Set the event rate (not to consume too much battery) - ASensorEventQueue_setEventRate(sensorEventQueue, m_sensor, minimumDelay.asMicroseconds()); + ASensorEventQueue_setEventRate(sensorEventQueue, m_sensor, static_cast(minimumDelay.asMicroseconds())); // Save the index of the sensor m_index = static_cast(sensor); @@ -145,7 +149,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; diff --git a/src/SFML/Window/Android/VideoModeImpl.cpp b/src/SFML/Window/Android/VideoModeImpl.cpp index 9a7fce6a..71535a4a 100644 --- a/src/SFML/Window/Android/VideoModeImpl.cpp +++ b/src/SFML/Window/Android/VideoModeImpl.cpp @@ -55,7 +55,7 @@ VideoMode VideoModeImpl::getDesktopMode() priv::ActivityStates& states = priv::getActivity(); Lock lock(states.mutex); - return VideoMode(states.screenSize.x, states.screenSize.y); + return VideoMode(static_cast(states.screenSize.x), static_cast(states.screenSize.y)); } } // namespace priv diff --git a/src/SFML/Window/Android/WindowImplAndroid.cpp b/src/SFML/Window/Android/WindowImplAndroid.cpp index ba36524f..6adccd77 100644 --- a/src/SFML/Window/Android/WindowImplAndroid.cpp +++ b/src/SFML/Window/Android/WindowImplAndroid.cpp @@ -49,7 +49,7 @@ namespace priv WindowImplAndroid* WindowImplAndroid::singleInstance = NULL; //////////////////////////////////////////////////////////// -WindowImplAndroid::WindowImplAndroid(WindowHandle handle) +WindowImplAndroid::WindowImplAndroid(WindowHandle /* handle */) : m_size(0, 0) , m_windowBeingCreated(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_windowBeingCreated(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 } @@ -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 } //////////////////////////////////////////////////////////// -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 } //////////////////////////////////////////////////////////// -void WindowImplAndroid::setVisible(bool visible) +void WindowImplAndroid::setVisible(bool /* visible */) { // Not applicable } //////////////////////////////////////////////////////////// -void WindowImplAndroid::setMouseCursorVisible(bool visible) +void WindowImplAndroid::setMouseCursorVisible(bool /* visible */) { // Not applicable } //////////////////////////////////////////////////////////// -void WindowImplAndroid::setMouseCursorGrabbed(bool grabbed) +void WindowImplAndroid::setMouseCursorGrabbed(bool /* grabbed */) { // Not applicable } //////////////////////////////////////////////////////////// -void WindowImplAndroid::setMouseCursor(const CursorImpl& cursor) +void WindowImplAndroid::setMouseCursor(const CursorImpl& /* cursor */) { // Not applicable } //////////////////////////////////////////////////////////// -void WindowImplAndroid::setKeyRepeatEnabled(bool enabled) +void WindowImplAndroid::setKeyRepeatEnabled(bool /* enabled */) { // Not applicable } @@ -223,8 +223,8 @@ void WindowImplAndroid::forwardEvent(const Event& event) if (event.type == Event::GainedFocus) { - WindowImplAndroid::singleInstance->m_size.x = ANativeWindow_getWidth(states.window); - WindowImplAndroid::singleInstance->m_size.y = ANativeWindow_getHeight(states.window); + WindowImplAndroid::singleInstance->m_size.x = static_cast(ANativeWindow_getWidth(states.window)); + WindowImplAndroid::singleInstance->m_size.y = static_cast(ANativeWindow_getHeight(states.window)); WindowImplAndroid::singleInstance->m_windowBeingCreated = 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(); Lock lock(states.mutex); @@ -318,7 +318,7 @@ int WindowImplAndroid::processScrollEvent(AInputEvent* _event, ActivityStates& s { // Prepare the Java virtual machine jint lResult; - jint lFlags = 0; + // jint lFlags = 0; JavaVM* lJavaVM = states.activity->vm; JNIEnv* lJNIEnv = states.activity->env; @@ -336,23 +336,30 @@ int WindowImplAndroid::processScrollEvent(AInputEvent* _event, ActivityStates& s } // Retrieve everything we need to create this MotionEvent in Java - jlong downTime = AMotionEvent_getDownTime(_event); - jlong eventTime = AMotionEvent_getEventTime(_event); - jint action = AMotionEvent_getAction(_event); - jfloat x = AMotionEvent_getX(_event, 0); - jfloat y = AMotionEvent_getY(_event, 0); - jfloat pressure = AMotionEvent_getPressure(_event, 0); - jfloat size = AMotionEvent_getSize(_event, 0); - jint metaState = AMotionEvent_getMetaState(_event); - jfloat xPrecision = AMotionEvent_getXPrecision(_event); - jfloat yPrecision = AMotionEvent_getYPrecision(_event); - jint deviceId = AInputEvent_getDeviceId(_event); - jint edgeFlags = AMotionEvent_getEdgeFlags(_event); + sf::Int64 downTime = AMotionEvent_getDownTime(_event); + sf::Int64 eventTime = AMotionEvent_getEventTime(_event); + sf::Int32 action = AMotionEvent_getAction(_event); + float x = AMotionEvent_getX(_event, 0); + float y = AMotionEvent_getY(_event, 0); + float pressure = AMotionEvent_getPressure(_event, 0); + float size = AMotionEvent_getSize(_event, 0); + sf::Int32 metaState = AMotionEvent_getMetaState(_event); + float xPrecision = AMotionEvent_getXPrecision(_event); + float yPrecision = AMotionEvent_getYPrecision(_event); + sf::Int32 deviceId = AInputEvent_getDeviceId(_event); + sf::Int32 edgeFlags = AMotionEvent_getEdgeFlags(_event); // Create the MotionEvent object in Java trough its static constructor obtain() jclass ClassMotionEvent = lJNIEnv->FindClass("android/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); + // Harmless warning related to C standard compatibility + // varargs automatically promote floats to doubles + // even though the function signature declares float + #pragma clang diagnostic ignored "-Wdouble-promotion" + jobject ObjectMotionEvent = lJNIEnv->CallStaticObjectMethod( + ClassMotionEvent, StaticMethodObtain, downTime, + eventTime, action, x, y, pressure, size, metaState, + xPrecision, yPrecision, deviceId, edgeFlags); // Call its getAxisValue() method to get the delta value of our wheel move event jmethodID MethodGetAxisValue = lJNIEnv->GetMethodID(ClassMotionEvent, "getAxisValue", "(I)F"); @@ -364,9 +371,9 @@ int WindowImplAndroid::processScrollEvent(AInputEvent* _event, ActivityStates& s // Create and send our mouse wheel event Event event; event.type = Event::MouseWheelMoved; - event.mouseWheel.delta = static_cast(delta); - event.mouseWheel.x = AMotionEvent_getX(_event, 0); - event.mouseWheel.y = AMotionEvent_getY(_event, 0); + event.mouseWheel.delta = static_cast(delta); + event.mouseWheel.x = static_cast(AMotionEvent_getX(_event, 0)); + event.mouseWheel.y = static_cast(AMotionEvent_getY(_event, 0)); forwardEvent(event); @@ -378,9 +385,9 @@ 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 device = AInputEvent_getSource(_event); int32_t action = AKeyEvent_getAction(_event); int32_t key = AKeyEvent_getKeyCode(_event); @@ -402,7 +409,7 @@ int WindowImplAndroid::processKeyEvent(AInputEvent* _event, ActivityStates& stat event.type = Event::KeyReleased; forwardEvent(event); - if (int unicode = getUnicode(_event)) + if (sf::Uint32 unicode = static_cast(getUnicode(_event))) { event.type = Event::TextEntered; event.text.unicode = unicode; @@ -425,7 +432,7 @@ int WindowImplAndroid::processKeyEvent(AInputEvent* _event, ActivityStates& stat // https://code.google.com/p/android/issues/detail?id=33998 return 0; } - else if (int unicode = getUnicode(_event)) // This is a repeated sequence + else if (sf::Uint32 unicode = static_cast(getUnicode(_event))) // This is a repeated sequence { event.type = Event::TextEntered; event.text.unicode = unicode; @@ -445,23 +452,23 @@ int WindowImplAndroid::processKeyEvent(AInputEvent* _event, ActivityStates& stat int WindowImplAndroid::processMotionEvent(AInputEvent* _event, ActivityStates& states) { int32_t device = AInputEvent_getSource(_event); - int32_t action = AMotionEvent_getAction(_event); + // int32_t action = AMotionEvent_getAction(_event); Event event; if (device == AINPUT_SOURCE_MOUSE) event.type = Event::MouseMoved; - else if (device & AINPUT_SOURCE_TOUCHSCREEN) + else if (static_cast(device) & AINPUT_SOURCE_TOUCHSCREEN) 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); - float x = AMotionEvent_getX(_event, p); - float y = AMotionEvent_getY(_event, p); + int x = static_cast(AMotionEvent_getX(_event, p)); + int y = static_cast(AMotionEvent_getY(_event, p)); if (device == AINPUT_SOURCE_MOUSE) { @@ -470,12 +477,12 @@ int WindowImplAndroid::processMotionEvent(AInputEvent* _event, ActivityStates& s states.mousePosition = Vector2i(event.mouseMove.x, event.mouseMove.y); } - else if (device & AINPUT_SOURCE_TOUCHSCREEN) + else if (static_cast(device) & AINPUT_SOURCE_TOUCHSCREEN) { if (states.touchEvents[id].x == x && states.touchEvents[id].y == y) continue; - event.touch.finger = id; + event.touch.finger = static_cast(id); event.touch.x = x; event.touch.y = y; @@ -494,11 +501,11 @@ int WindowImplAndroid::processPointerEvent(bool isDown, AInputEvent* _event, Act int32_t device = AInputEvent_getSource(_event); int32_t action = AMotionEvent_getAction(_event); - int index = (action & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT; - int id = AMotionEvent_getPointerId(_event, index); + size_t index = (action & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT; + int32_t id = AMotionEvent_getPointerId(_event, index); - float x = AMotionEvent_getX(_event, index); - float y = AMotionEvent_getY(_event, index); + int x = static_cast(AMotionEvent_getX(_event, index)); + int y = static_cast(AMotionEvent_getY(_event, index)); Event event; @@ -514,10 +521,10 @@ int WindowImplAndroid::processPointerEvent(bool isDown, AInputEvent* _event, Act if (id >= 0 && id < Mouse::ButtonCount) states.isButtonPressed[id] = true; } - else if (device & AINPUT_SOURCE_TOUCHSCREEN) + else if (static_cast(device) & AINPUT_SOURCE_TOUCHSCREEN) { event.type = Event::TouchBegan; - event.touch.finger = id; + event.touch.finger = static_cast(id); event.touch.x = x; event.touch.y = y; @@ -536,10 +543,10 @@ int WindowImplAndroid::processPointerEvent(bool isDown, AInputEvent* _event, Act if (id >= 0 && id < Mouse::ButtonCount) states.isButtonPressed[id] = false; } - else if (device & AINPUT_SOURCE_TOUCHSCREEN) + else if (static_cast(device) & AINPUT_SOURCE_TOUCHSCREEN) { event.type = Event::TouchEnded; - event.touch.finger = id; + event.touch.finger = static_cast(id); event.touch.x = x; event.touch.y = y; @@ -683,7 +690,7 @@ int WindowImplAndroid::getUnicode(AInputEvent* event) // Initializes JNI jint lResult; - jint lFlags = 0; + // jint lFlags = 0; JavaVM* lJavaVM = states.activity->vm; JNIEnv* lJNIEnv = states.activity->env; diff --git a/src/SFML/Window/EglContext.cpp b/src/SFML/Window/EglContext.cpp index f9b50c8f..de1b1670 100644 --- a/src/SFML/Window/EglContext.cpp +++ b/src/SFML/Window/EglContext.cpp @@ -138,6 +138,7 @@ m_context (EGL_NO_CONTEXT), m_surface (EGL_NO_SURFACE), m_config (NULL) { + (void) owner; EglContextImpl::ensureInit(); #ifdef SFML_SYSTEM_ANDROID diff --git a/src/SFML/Window/Vulkan.cpp b/src/SFML/Window/Vulkan.cpp index 39958f88..368d44fb 100644 --- a/src/SFML/Window/Vulkan.cpp +++ b/src/SFML/Window/Vulkan.cpp @@ -51,6 +51,7 @@ bool Vulkan::isAvailable(bool requireGraphics) { #if defined(SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE) + (void) requireGraphics; return false; #else @@ -66,6 +67,7 @@ VulkanFunctionPointer Vulkan::getFunction(const char* name) { #if defined(SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE) + (void) name; return NULL; #else diff --git a/src/SFML/Window/WindowImpl.cpp b/src/SFML/Window/WindowImpl.cpp index a13ce40d..7d290596 100644 --- a/src/SFML/Window/WindowImpl.cpp +++ b/src/SFML/Window/WindowImpl.cpp @@ -280,6 +280,9 @@ bool WindowImpl::createVulkanSurface(const VkInstance& instance, VkSurfaceKHR& s { #if defined(SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE) + (void) instance; + (void) surface; + (void) allocator; return false; #else