Merge branch '2.6.x'

This commit is contained in:
Chris Thrasher 2022-10-12 21:35:20 -06:00
commit a5dbe59f07
No known key found for this signature in database
GPG Key ID: 56FB686C9DFC8E2C
37 changed files with 694 additions and 315 deletions

View File

@ -11,12 +11,13 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
platform: platform:
- { name: Windows VS2019, os: windows-2019 } - { name: Windows VS2019, os: windows-2019 }
- { name: Windows VS2022, os: windows-2022 } - { name: Windows VS2022, os: windows-2022 }
- { name: Linux GCC, os: ubuntu-latest } - { name: Windows VS2022 Clang, os: windows-2022, flags: -T ClangCL }
- { name: Linux Clang, os: ubuntu-latest, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++, gcovr_options: '--gcov-executable="llvm-cov-$CLANG_VERSION gcov"' } - { name: Linux GCC, os: ubuntu-latest }
- { name: MacOS, os: macos-latest } - { name: Linux Clang, os: ubuntu-latest, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++, gcovr_options: '--gcov-executable="llvm-cov-$CLANG_VERSION gcov"' }
- { name: MacOS Xcode, os: macos-latest, flags: -GXcode } - { name: MacOS, os: macos-latest }
- { name: MacOS Xcode, os: macos-latest, flags: -GXcode }
config: config:
- { name: Shared, flags: -DBUILD_SHARED_LIBS=TRUE } - { name: Shared, flags: -DBUILD_SHARED_LIBS=TRUE }
- { name: Static, flags: -DBUILD_SHARED_LIBS=FALSE } - { name: Static, flags: -DBUILD_SHARED_LIBS=FALSE }
@ -39,6 +40,10 @@ jobs:
config: { name: x86, flags: -DCMAKE_ANDROID_ARCH_ABI=x86 -DCMAKE_SYSTEM_NAME=Android -DSFML_BUILD_TEST_SUITE=FALSE -DCMAKE_ANDROID_NDK=$GITHUB_WORKSPACE/android-ndk-r23b -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang -DCMAKE_ANDROID_STL_TYPE=c++_shared -DCMAKE_ANDROID_API=26 } config: { name: x86, flags: -DCMAKE_ANDROID_ARCH_ABI=x86 -DCMAKE_SYSTEM_NAME=Android -DSFML_BUILD_TEST_SUITE=FALSE -DCMAKE_ANDROID_NDK=$GITHUB_WORKSPACE/android-ndk-r23b -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang -DCMAKE_ANDROID_STL_TYPE=c++_shared -DCMAKE_ANDROID_API=26 }
- platform: { name: Android, os: ubuntu-latest } - platform: { name: Android, os: ubuntu-latest }
config: { name: armeabi-v7a, flags: -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a -DCMAKE_SYSTEM_NAME=Android -DSFML_BUILD_TEST_SUITE=FALSE -DCMAKE_ANDROID_NDK=$GITHUB_WORKSPACE/android-ndk-r23b -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang -DCMAKE_ANDROID_STL_TYPE=c++_shared -DCMAKE_ANDROID_API=26 } config: { name: armeabi-v7a, flags: -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a -DCMAKE_SYSTEM_NAME=Android -DSFML_BUILD_TEST_SUITE=FALSE -DCMAKE_ANDROID_NDK=$GITHUB_WORKSPACE/android-ndk-r23b -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang -DCMAKE_ANDROID_STL_TYPE=c++_shared -DCMAKE_ANDROID_API=26 }
- platform: { name: Android, os: ubuntu-latest }
config: { name: arm64-v8a, flags: -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a -DCMAKE_SYSTEM_NAME=Android -DSFML_BUILD_TEST_SUITE=FALSE -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/android-ndk-r23b/build/cmake/android.toolchain.cmake -DCMAKE_ANDROID_NDK=$GITHUB_WORKSPACE/android-ndk-r23b -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang -DCMAKE_ANDROID_STL_TYPE=c++_shared -DCMAKE_ANDROID_API=26 -DANDROID_PLATFORM=26 }
- platform: { name: Android, os: ubuntu-latest }
config: { name: x86_64, flags: -DCMAKE_ANDROID_ARCH_ABI=x86_64 -DCMAKE_SYSTEM_NAME=Android -DSFML_BUILD_TEST_SUITE=FALSE -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/android-ndk-r23b/build/cmake/android.toolchain.cmake -DCMAKE_ANDROID_NDK=$GITHUB_WORKSPACE/android-ndk-r23b -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang -DCMAKE_ANDROID_STL_TYPE=c++_shared -DCMAKE_ANDROID_API=26 -DANDROID_PLATFORM=26 }
- platform: { name: Linux GCC, os: ubuntu-latest } - platform: { name: Linux GCC, os: ubuntu-latest }
config: { name: Static DRM, flags: -DBUILD_SHARED_LIBS=FALSE -DSFML_USE_DRM=TRUE } config: { name: Static DRM, flags: -DBUILD_SHARED_LIBS=FALSE -DSFML_USE_DRM=TRUE }
- platform: { name: Linux GCC, os: ubuntu-latest } - platform: { name: Linux GCC, os: ubuntu-latest }

View File

@ -6,6 +6,12 @@
function(set_target_warnings target) function(set_target_warnings target)
option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" TRUE) option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" TRUE)
# For now if we're using MSVC-like clang interface on Windows
# we'll disable warnings as errors
if(SFML_OS_WINDOWS AND SFML_COMPILER_CLANG_CL)
set(WARNINGS_AS_ERRORS FALSE)
endif()
if(SFML_COMPILER_MSVC) if(SFML_COMPILER_MSVC)
target_compile_options(${target} PRIVATE target_compile_options(${target} PRIVATE
$<$<BOOL:${WARNINGS_AS_ERRORS}>:/WX> $<$<BOOL:${WARNINGS_AS_ERRORS}>:/WX>

View File

@ -79,6 +79,10 @@ endif()
# - GNUCXX can still be set on macOS when using Clang # - GNUCXX can still be set on macOS when using Clang
if(MSVC) if(MSVC)
set(SFML_COMPILER_MSVC 1) set(SFML_COMPILER_MSVC 1)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(SFML_COMPILER_CLANG_CL 1)
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(SFML_COMPILER_CLANG 1) set(SFML_COMPILER_CLANG 1)
elseif(CMAKE_COMPILER_IS_GNUCXX) elseif(CMAKE_COMPILER_IS_GNUCXX)

File diff suppressed because it is too large Load Diff

View File

@ -1062,18 +1062,26 @@ tr.heading h2 {
display: table; display: table;
} }
.tablist {
width: 100%;
}
.tablist li { .tablist li {
float: left; float: left;
display: table-cell; display: table-cell;
list-style: none; list-style: none;
} }
#navrow1 .tablist li:last-child {
float: right;
}
#navrow1 { #navrow1 {
border-top: 1px solid #999; border-top: 1px solid #999;
margin-top: 2em; margin-top: 2em;
} }
#navrow1 .tablist a, #navrow2 .tablist a, #navrow3 .tablist a, #navrow4 .tablist a { #navrow1 .tablist a:not(#MSearchClose), #navrow2 .tablist a, #navrow3 .tablist a, #navrow4 .tablist a {
display: block; display: block;
margin: 8px 0; margin: 8px 0;
padding: 0 8px; padding: 0 8px;
@ -1246,7 +1254,7 @@ div.contents ul li {
width: 24px; width: 24px;
height: 18px; height: 18px;
margin-bottom: 4px; margin-bottom: 4px;
background-image:url('ftv2folderopen.png'); background-image:url('folderopen.png');
background-position: 0px -4px; background-position: 0px -4px;
background-repeat: repeat-y; background-repeat: repeat-y;
vertical-align:top; vertical-align:top;
@ -1257,7 +1265,7 @@ div.contents ul li {
width: 24px; width: 24px;
height: 18px; height: 18px;
margin-bottom: 4px; margin-bottom: 4px;
background-image:url('ftv2folderclosed.png'); background-image:url('folderclosed.png');
background-position: 0px -4px; background-position: 0px -4px;
background-repeat: repeat-y; background-repeat: repeat-y;
vertical-align:top; vertical-align:top;
@ -1268,7 +1276,7 @@ div.contents ul li {
width: 24px; width: 24px;
height: 18px; height: 18px;
margin-bottom: 4px; margin-bottom: 4px;
background-image:url('ftv2doc.png'); background-image:url('doc.png');
background-position: 0px -4px; background-position: 0px -4px;
background-repeat: repeat-y; background-repeat: repeat-y;
vertical-align:top; vertical-align:top;

View File

@ -8,6 +8,25 @@
<link rel="stylesheet" type="text/css" href="doxygen.css" title="default" media="screen,print" /> <link rel="stylesheet" type="text/css" href="doxygen.css" title="default" media="screen,print" />
<script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script> <script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<style>
/* Override search/search.css rules to adjust seach box placement */
#MSearchBox {
position: relative;
display: block;
}
.right #MSearchClose {
margin: 0;
right: auto;
}
</style>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function() { init_search(); });
/* @license-end */
</script>
</head> </head>
<body> <body>
<div id="banner-container"> <div id="banner-container">

View File

@ -1,5 +1,5 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \mainpage /// \mainpage SFML Documentation
/// ///
/// \section welcome Welcome /// \section welcome Welcome
/// Welcome to the official SFML documentation. Here you will find a detailed /// Welcome to the official SFML documentation. Here you will find a detailed

View File

@ -82,7 +82,7 @@ private:
// (don't forget that we run in two separate threads) // (don't forget that we run in two separate threads)
{ {
std::scoped_lock lock(m_mutex); std::scoped_lock lock(m_mutex);
m_tempBuffer.assign(m_samples.begin() + static_cast<std::vector<std::int64_t>::difference_type>(m_offset), m_tempBuffer.assign(m_samples.begin() + static_cast<std::vector<std::int16_t>::difference_type>(m_offset),
m_samples.end()); m_samples.end());
} }

View File

@ -1,5 +1,5 @@
/** /**
* Loader generated by glad 2.0.0-beta on Wed Jul 17 02:11:09 2019 * Loader generated by glad 2.0.0-beta on Sun Jun 26 11:35:02 2022
* *
* Generator: C/C++ * Generator: C/C++
* Specification: egl * Specification: egl
@ -9,19 +9,19 @@
* - egl=1.5 * - egl=1.5
* *
* Options: * Options:
* - ALIAS = True
* - DEBUG = False
* - HEADER_ONLY = True
* - LOADER = True
* - MX = False
* - MX_GLOBAL = False * - MX_GLOBAL = False
* - ON_DEMAND = False * - ON_DEMAND = False
* - LOADER = True
* - ALIAS = True
* - HEADER_ONLY = True
* - DEBUG = False
* - MX = False
* *
* Commandline: * Commandline:
* --api='egl=1.5' --extensions='EGL_KHR_cl_event2,EGL_KHR_fence_sync,EGL_KHR_image,EGL_KHR_image_base,EGL_KHR_reusable_sync' c --loader --alias --header-only * --api='egl=1.5' --extensions='EGL_KHR_cl_event2,EGL_KHR_fence_sync,EGL_KHR_image,EGL_KHR_image_base,EGL_KHR_reusable_sync' c --alias --header-only --loader
* *
* Online: * Online:
* http://glad.sh/#api=egl%3D1.5&extensions=EGL_KHR_cl_event2%2CEGL_KHR_fence_sync%2CEGL_KHR_image%2CEGL_KHR_image_base%2CEGL_KHR_reusable_sync&generator=c&options=LOADER%2CALIAS%2CHEADER_ONLY * http://glad.sh/#api=egl%3D1.5&extensions=EGL_KHR_cl_event2%2CEGL_KHR_fence_sync%2CEGL_KHR_image%2CEGL_KHR_image_base%2CEGL_KHR_reusable_sync&generator=c&options=ALIAS%2CHEADER_ONLY%2CLOADER
* *
*/ */
@ -30,9 +30,9 @@
#define SF_GLAD_EGL #define SF_GLAD_EGL
#define GLAD_OPTION_EGL_LOADER
#define GLAD_OPTION_EGL_ALIAS #define GLAD_OPTION_EGL_ALIAS
#define GLAD_OPTION_EGL_HEADER_ONLY #define GLAD_OPTION_EGL_HEADER_ONLY
#define GLAD_OPTION_EGL_LOADER
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -459,7 +459,7 @@ typedef void (*GLADpostcallback)(void *ret, const char *name, GLADapiproc apipro
* This follows the return type of the function and precedes the function * This follows the return type of the function and precedes the function
* name in the function prototype. * name in the function prototype.
*/ */
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(KHRONOS_STATIC) #if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
/* Win32 but not WinCE */ /* Win32 but not WinCE */
# define KHRONOS_GLAD_API_PTR __stdcall # define KHRONOS_GLAD_API_PTR __stdcall
#else #else
@ -493,6 +493,20 @@ typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t; typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1 #define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1 #define KHRONOS_SUPPORT_FLOAT 1
/*
* To support platform where unsigned long cannot be used interchangeably with
* inptr_t (e.g. CHERI-extended ISAs), we can use the stdint.h intptr_t.
* Ideally, we could just use (u)intptr_t everywhere, but this could result in
* ABI breakage if khronos_uintptr_t is changed from unsigned long to
* unsigned long long or similar (this results in different C++ name mangling).
* To avoid changes for existing platforms, we restrict usage of intptr_t to
* platforms where the size of a pointer is larger than the size of long.
*/
#if defined(__SIZEOF_LONG__) && defined(__SIZEOF_POINTER__)
#if __SIZEOF_POINTER__ > __SIZEOF_LONG__
#define KHRONOS_USE_INTPTR_T
#endif
#endif
#elif defined(__VMS ) || defined(__sgi) #elif defined(__VMS ) || defined(__sgi)
@ -575,14 +589,21 @@ typedef unsigned short int khronos_uint16_t;
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
* to be the only LLP64 architecture in current use. * to be the only LLP64 architecture in current use.
*/ */
#ifdef _WIN64 #ifdef KHRONOS_USE_INTPTR_T
typedef intptr_t khronos_intptr_t;
typedef uintptr_t khronos_uintptr_t;
#elif defined(_WIN64)
typedef signed long long int khronos_intptr_t; typedef signed long long int khronos_intptr_t;
typedef unsigned long long int khronos_uintptr_t; typedef unsigned long long int khronos_uintptr_t;
typedef signed long long int khronos_ssize_t;
typedef unsigned long long int khronos_usize_t;
#else #else
typedef signed long int khronos_intptr_t; typedef signed long int khronos_intptr_t;
typedef unsigned long int khronos_uintptr_t; typedef unsigned long int khronos_uintptr_t;
#endif
#if defined(_WIN64)
typedef signed long long int khronos_ssize_t;
typedef unsigned long long int khronos_usize_t;
#else
typedef signed long int khronos_ssize_t; typedef signed long int khronos_ssize_t;
typedef unsigned long int khronos_usize_t; typedef unsigned long int khronos_usize_t;
#endif #endif
@ -632,36 +653,17 @@ typedef enum {
#define __eglplatform_h_ #define __eglplatform_h_
/* /*
** Copyright (c) 2007-2016 The Khronos Group Inc. ** Copyright 2007-2020 The Khronos Group Inc.
** ** SPDX-License-Identifier: Apache-2.0
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/ */
/* Platform-specific types and definitions for egl.h /* Platform-specific types and definitions for egl.h
* $Revision: 30994 $ on $Date: 2015-04-30 13:36:48 -0700 (Thu, 30 Apr 2015) $
* *
* Adopters may modify khrplatform.h and this file to suit their platform. * Adopters may modify khrplatform.h and this file to suit their platform.
* You are encouraged to submit all modifications to the Khronos group so that * You are encouraged to submit all modifications to the Khronos group so that
* they can be included in future versions of this file. Please submit changes * they can be included in future versions of this file. Please submit changes
* by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) * by filing an issue or pull request on the public Khronos EGL Registry, at
* by filing a bug against product "EGL" component "Registry". * https://www.github.com/KhronosGroup/EGL-Registry/
*/ */
/* */ /* */
@ -697,7 +699,13 @@ typedef enum {
* implementations. * implementations.
*/ */
#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ #if defined(EGL_NO_PLATFORM_SPECIFIC_TYPES)
typedef void *EGLNativeDisplayType;
typedef void *EGLNativePixmapType;
typedef void *EGLNativeWindowType;
#elif defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1 #define WIN32_LEAN_AND_MEAN 1
#endif #endif
@ -746,7 +754,7 @@ typedef intptr_t EGLNativeDisplayType;
typedef intptr_t EGLNativePixmapType; typedef intptr_t EGLNativePixmapType;
typedef intptr_t EGLNativeWindowType; typedef intptr_t EGLNativeWindowType;
#elif defined(__unix__) || defined(USE_X11) #elif defined(USE_X11)
/* X11 (tentative) */ /* X11 (tentative) */
#include <X11/Xlib.h> #include <X11/Xlib.h>
@ -756,6 +764,12 @@ typedef Display *EGLNativeDisplayType;
typedef Pixmap EGLNativePixmapType; typedef Pixmap EGLNativePixmapType;
typedef Window EGLNativeWindowType; typedef Window EGLNativeWindowType;
#elif defined(__unix__)
typedef void *EGLNativeDisplayType;
typedef khronos_uintptr_t EGLNativePixmapType;
typedef khronos_uintptr_t EGLNativeWindowType;
#elif defined(__APPLE__) #elif defined(__APPLE__)
typedef int EGLNativeDisplayType; typedef int EGLNativeDisplayType;
@ -770,6 +784,12 @@ typedef void *EGLNativeDisplayType;
typedef khronos_uintptr_t EGLNativePixmapType; typedef khronos_uintptr_t EGLNativePixmapType;
typedef khronos_uintptr_t EGLNativeWindowType; typedef khronos_uintptr_t EGLNativeWindowType;
#elif defined(__Fuchsia__)
typedef void *EGLNativeDisplayType;
typedef khronos_uintptr_t EGLNativePixmapType;
typedef khronos_uintptr_t EGLNativeWindowType;
#else #else
#error "Platform not recognized" #error "Platform not recognized"
#endif #endif
@ -810,6 +830,9 @@ typedef khronos_int32_t EGLint;
struct AHardwareBuffer; struct AHardwareBuffer;
struct wl_buffer;
struct wl_display;
struct wl_resource;
typedef unsigned int EGLBoolean; typedef unsigned int EGLBoolean;
typedef unsigned int EGLenum; typedef unsigned int EGLenum;
@ -848,7 +871,11 @@ struct EGLClientPixmapHI {
EGLint iHeight; EGLint iHeight;
EGLint iStride; EGLint iStride;
}; };
typedef void ( *EGLDEBUGPROCKHR)(EGLenum error,const char *command,EGLint messageType,EGLLabelKHR threadLabel,EGLLabelKHR objectLabel,const char* message); typedef void (GLAD_API_PTR *EGLDEBUGPROCKHR)(EGLenum error,const char *command,EGLint messageType,EGLLabelKHR threadLabel,EGLLabelKHR objectLabel,const char* message);
#define PFNEGLBINDWAYLANDDISPLAYWL PFNEGLBINDWAYLANDDISPLAYWLPROC
#define PFNEGLUNBINDWAYLANDDISPLAYWL PFNEGLUNBINDWAYLANDDISPLAYWLPROC
#define PFNEGLQUERYWAYLANDBUFFERWL PFNEGLQUERYWAYLANDBUFFERWLPROC
#define PFNEGLCREATEWAYLANDBUFFERFROMIMAGEWL PFNEGLCREATEWAYLANDBUFFERFROMIMAGEWLPROC
#define EGL_VERSION_1_0 1 #define EGL_VERSION_1_0 1
@ -1059,6 +1086,11 @@ GLAD_API_CALL PFNEGLWAITSYNCPROC sf_glad_eglWaitSync;
#endif /* GLAD_IMPL_UTIL_C_ */ #endif /* GLAD_IMPL_UTIL_C_ */
#ifdef __cplusplus
extern "C" {
#endif
int SF_GLAD_EGL_VERSION_1_0 = 0; int SF_GLAD_EGL_VERSION_1_0 = 0;
int SF_GLAD_EGL_VERSION_1_1 = 0; int SF_GLAD_EGL_VERSION_1_1 = 0;
@ -1189,41 +1221,46 @@ static void sf_glad_egl_load_EGL_VERSION_1_5( GLADuserptrloadfunc load, void* us
} }
static void sf_glad_egl_load_EGL_KHR_cl_event2( GLADuserptrloadfunc load, void* userptr) { static void sf_glad_egl_load_EGL_KHR_cl_event2( GLADuserptrloadfunc load, void* userptr) {
if(!SF_GLAD_EGL_KHR_cl_event2) return; if(!SF_GLAD_EGL_KHR_cl_event2) return;
sf_glad_eglCreateSync = (PFNEGLCREATESYNCPROC) load(userptr, "eglCreateSync");
sf_glad_eglCreateSync64KHR = (PFNEGLCREATESYNC64KHRPROC) load(userptr, "eglCreateSync64KHR"); sf_glad_eglCreateSync64KHR = (PFNEGLCREATESYNC64KHRPROC) load(userptr, "eglCreateSync64KHR");
} }
static void sf_glad_egl_load_EGL_KHR_fence_sync( GLADuserptrloadfunc load, void* userptr) { static void sf_glad_egl_load_EGL_KHR_fence_sync( GLADuserptrloadfunc load, void* userptr) {
if(!SF_GLAD_EGL_KHR_fence_sync) return; if(!SF_GLAD_EGL_KHR_fence_sync) return;
sf_glad_eglClientWaitSync = (PFNEGLCLIENTWAITSYNCPROC) load(userptr, "eglClientWaitSync");
sf_glad_eglClientWaitSyncKHR = (PFNEGLCLIENTWAITSYNCKHRPROC) load(userptr, "eglClientWaitSyncKHR"); sf_glad_eglClientWaitSyncKHR = (PFNEGLCLIENTWAITSYNCKHRPROC) load(userptr, "eglClientWaitSyncKHR");
sf_glad_eglCreateSyncKHR = (PFNEGLCREATESYNCKHRPROC) load(userptr, "eglCreateSyncKHR"); sf_glad_eglCreateSyncKHR = (PFNEGLCREATESYNCKHRPROC) load(userptr, "eglCreateSyncKHR");
sf_glad_eglDestroySync = (PFNEGLDESTROYSYNCPROC) load(userptr, "eglDestroySync");
sf_glad_eglDestroySyncKHR = (PFNEGLDESTROYSYNCKHRPROC) load(userptr, "eglDestroySyncKHR"); sf_glad_eglDestroySyncKHR = (PFNEGLDESTROYSYNCKHRPROC) load(userptr, "eglDestroySyncKHR");
sf_glad_eglGetSyncAttribKHR = (PFNEGLGETSYNCATTRIBKHRPROC) load(userptr, "eglGetSyncAttribKHR"); sf_glad_eglGetSyncAttribKHR = (PFNEGLGETSYNCATTRIBKHRPROC) load(userptr, "eglGetSyncAttribKHR");
} }
static void sf_glad_egl_load_EGL_KHR_image( GLADuserptrloadfunc load, void* userptr) { static void sf_glad_egl_load_EGL_KHR_image( GLADuserptrloadfunc load, void* userptr) {
if(!SF_GLAD_EGL_KHR_image) return; if(!SF_GLAD_EGL_KHR_image) return;
sf_glad_eglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC) load(userptr, "eglCreateImageKHR"); sf_glad_eglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC) load(userptr, "eglCreateImageKHR");
sf_glad_eglDestroyImage = (PFNEGLDESTROYIMAGEPROC) load(userptr, "eglDestroyImage");
sf_glad_eglDestroyImageKHR = (PFNEGLDESTROYIMAGEKHRPROC) load(userptr, "eglDestroyImageKHR"); sf_glad_eglDestroyImageKHR = (PFNEGLDESTROYIMAGEKHRPROC) load(userptr, "eglDestroyImageKHR");
} }
static void sf_glad_egl_load_EGL_KHR_image_base( GLADuserptrloadfunc load, void* userptr) { static void sf_glad_egl_load_EGL_KHR_image_base( GLADuserptrloadfunc load, void* userptr) {
if(!SF_GLAD_EGL_KHR_image_base) return; if(!SF_GLAD_EGL_KHR_image_base) return;
sf_glad_eglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC) load(userptr, "eglCreateImageKHR"); sf_glad_eglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC) load(userptr, "eglCreateImageKHR");
sf_glad_eglDestroyImage = (PFNEGLDESTROYIMAGEPROC) load(userptr, "eglDestroyImage");
sf_glad_eglDestroyImageKHR = (PFNEGLDESTROYIMAGEKHRPROC) load(userptr, "eglDestroyImageKHR"); sf_glad_eglDestroyImageKHR = (PFNEGLDESTROYIMAGEKHRPROC) load(userptr, "eglDestroyImageKHR");
} }
static void sf_glad_egl_load_EGL_KHR_reusable_sync( GLADuserptrloadfunc load, void* userptr) { static void sf_glad_egl_load_EGL_KHR_reusable_sync( GLADuserptrloadfunc load, void* userptr) {
if(!SF_GLAD_EGL_KHR_reusable_sync) return; if(!SF_GLAD_EGL_KHR_reusable_sync) return;
sf_glad_eglClientWaitSync = (PFNEGLCLIENTWAITSYNCPROC) load(userptr, "eglClientWaitSync");
sf_glad_eglClientWaitSyncKHR = (PFNEGLCLIENTWAITSYNCKHRPROC) load(userptr, "eglClientWaitSyncKHR"); sf_glad_eglClientWaitSyncKHR = (PFNEGLCLIENTWAITSYNCKHRPROC) load(userptr, "eglClientWaitSyncKHR");
sf_glad_eglCreateSyncKHR = (PFNEGLCREATESYNCKHRPROC) load(userptr, "eglCreateSyncKHR"); sf_glad_eglCreateSyncKHR = (PFNEGLCREATESYNCKHRPROC) load(userptr, "eglCreateSyncKHR");
sf_glad_eglDestroySync = (PFNEGLDESTROYSYNCPROC) load(userptr, "eglDestroySync");
sf_glad_eglDestroySyncKHR = (PFNEGLDESTROYSYNCKHRPROC) load(userptr, "eglDestroySyncKHR"); sf_glad_eglDestroySyncKHR = (PFNEGLDESTROYSYNCKHRPROC) load(userptr, "eglDestroySyncKHR");
sf_glad_eglGetSyncAttribKHR = (PFNEGLGETSYNCATTRIBKHRPROC) load(userptr, "eglGetSyncAttribKHR"); sf_glad_eglGetSyncAttribKHR = (PFNEGLGETSYNCATTRIBKHRPROC) load(userptr, "eglGetSyncAttribKHR");
sf_glad_eglSignalSyncKHR = (PFNEGLSIGNALSYNCKHRPROC) load(userptr, "eglSignalSyncKHR"); sf_glad_eglSignalSyncKHR = (PFNEGLSIGNALSYNCKHRPROC) load(userptr, "eglSignalSyncKHR");
} }
static void sf_glad_egl_resolve_aliases(void) {
if (sf_glad_eglClientWaitSync == NULL && sf_glad_eglClientWaitSyncKHR != NULL) sf_glad_eglClientWaitSync = (PFNEGLCLIENTWAITSYNCPROC)sf_glad_eglClientWaitSyncKHR;
if (sf_glad_eglClientWaitSyncKHR == NULL && sf_glad_eglClientWaitSync != NULL) sf_glad_eglClientWaitSyncKHR = (PFNEGLCLIENTWAITSYNCKHRPROC)sf_glad_eglClientWaitSync;
if (sf_glad_eglCreateSync == NULL && sf_glad_eglCreateSync64KHR != NULL) sf_glad_eglCreateSync = (PFNEGLCREATESYNCPROC)sf_glad_eglCreateSync64KHR;
if (sf_glad_eglCreateSync64KHR == NULL && sf_glad_eglCreateSync != NULL) sf_glad_eglCreateSync64KHR = (PFNEGLCREATESYNC64KHRPROC)sf_glad_eglCreateSync;
if (sf_glad_eglDestroyImage == NULL && sf_glad_eglDestroyImageKHR != NULL) sf_glad_eglDestroyImage = (PFNEGLDESTROYIMAGEPROC)sf_glad_eglDestroyImageKHR;
if (sf_glad_eglDestroyImageKHR == NULL && sf_glad_eglDestroyImage != NULL) sf_glad_eglDestroyImageKHR = (PFNEGLDESTROYIMAGEKHRPROC)sf_glad_eglDestroyImage;
if (sf_glad_eglDestroySync == NULL && sf_glad_eglDestroySyncKHR != NULL) sf_glad_eglDestroySync = (PFNEGLDESTROYSYNCPROC)sf_glad_eglDestroySyncKHR;
if (sf_glad_eglDestroySyncKHR == NULL && sf_glad_eglDestroySync != NULL) sf_glad_eglDestroySyncKHR = (PFNEGLDESTROYSYNCKHRPROC)sf_glad_eglDestroySync;
}
static int sf_glad_egl_get_extensions(EGLDisplay display, const char **extensions) { static int sf_glad_egl_get_extensions(EGLDisplay display, const char **extensions) {
*extensions = eglQueryString(display, EGL_EXTENSIONS); *extensions = eglQueryString(display, EGL_EXTENSIONS);
@ -1250,6 +1287,10 @@ static int sf_glad_egl_has_extension(const char *extensions, const char *ext) {
} }
} }
static GLADapiproc sf_glad_egl_get_proc_from_userptr(void *userptr, const char *name) {
return (GLAD_GNUC_EXTENSION (GLADapiproc (*)(const char *name)) userptr)(name);
}
static int sf_glad_egl_find_extensions_egl(EGLDisplay display) { static int sf_glad_egl_find_extensions_egl(EGLDisplay display) {
const char *extensions; const char *extensions;
if (!sf_glad_egl_get_extensions(display, &extensions)) return 0; if (!sf_glad_egl_get_extensions(display, &extensions)) return 0;
@ -1278,9 +1319,11 @@ static int sf_glad_egl_find_core_egl(EGLDisplay display) {
display = eglGetDisplay(EGL_DEFAULT_DISPLAY); display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
} }
#endif #endif
#ifndef EGL_VERSION_1_5
if (display == EGL_NO_DISPLAY) { if (display == EGL_NO_DISPLAY) {
return 0; return 0;
} }
#endif
version = eglQueryString(display, EGL_VERSION); version = eglQueryString(display, EGL_VERSION);
(void) eglGetError(); (void) eglGetError();
@ -1325,9 +1368,17 @@ static int gladLoadEGLUserPtr(EGLDisplay display, GLADuserptrloadfunc load, void
sf_glad_egl_load_EGL_KHR_image_base(load, userptr); sf_glad_egl_load_EGL_KHR_image_base(load, userptr);
sf_glad_egl_load_EGL_KHR_reusable_sync(load, userptr); sf_glad_egl_load_EGL_KHR_reusable_sync(load, userptr);
sf_glad_egl_resolve_aliases();
return version; return version;
} }
static int gladLoadEGL(EGLDisplay display, GLADloadfunc load) {
return gladLoadEGLUserPtr(display, sf_glad_egl_get_proc_from_userptr, GLAD_GNUC_EXTENSION (void*) load);
}
#ifdef SF_GLAD_EGL #ifdef SF_GLAD_EGL
#ifndef GLAD_LOADER_LIBRARY_C_ #ifndef GLAD_LOADER_LIBRARY_C_
@ -1471,5 +1522,9 @@ static int gladLoaderLoadEGL(EGLDisplay display) {
#endif /* SF_GLAD_EGL */ #endif /* SF_GLAD_EGL */
#ifdef __cplusplus
}
#endif
#endif /* SF_GLAD_EGL_IMPLEMENTATION */ #endif /* SF_GLAD_EGL_IMPLEMENTATION */

BIN
extlibs/libs-android/arm64-v8a/libFLAC.a vendored Normal file

Binary file not shown.

Binary file not shown.

BIN
extlibs/libs-android/arm64-v8a/libogg.a vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
extlibs/libs-android/x86_64/libFLAC.a vendored Normal file

Binary file not shown.

Binary file not shown.

BIN
extlibs/libs-android/x86_64/libogg.a vendored Normal file

Binary file not shown.

BIN
extlibs/libs-android/x86_64/libopenal.so vendored Normal file

Binary file not shown.

BIN
extlibs/libs-android/x86_64/libvorbis.a vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -376,12 +376,14 @@ private:
/// \code /// \code
/// class CustomRecorder : public sf::SoundRecorder /// class CustomRecorder : public sf::SoundRecorder
/// { /// {
/// public:
/// ~CustomRecorder() /// ~CustomRecorder()
/// { /// {
/// // Make sure to stop the recording thread /// // Make sure to stop the recording thread
/// stop(); /// stop();
/// } /// }
/// ///
/// private:
/// bool onStart() override // optional /// bool onStart() override // optional
/// { /// {
/// // Initialize whatever has to be done before the capture starts /// // Initialize whatever has to be done before the capture starts
@ -405,7 +407,7 @@ private:
/// // Clean up whatever has to be done after the capture ends /// // Clean up whatever has to be done after the capture ends
/// ... /// ...
/// } /// }
/// } /// };
/// ///
/// // Usage /// // Usage
/// if (CustomRecorder::isAvailable()) /// if (CustomRecorder::isAvailable())

View File

@ -46,7 +46,7 @@
#undef MINIMP3_NO_STDIO #undef MINIMP3_NO_STDIO
#include <SFML/Audio/SoundFileReaderMp3.hpp> #include <SFML/Audio/SoundFileReaderMp3.hpp>
#include <SFML/System/MemoryInputStream.hpp> #include <SFML/System/InputStream.hpp>
#include <algorithm> #include <algorithm>
#include <cstring> #include <cstring>

View File

@ -535,19 +535,8 @@ void Text::ensureGeometryUpdate() const
{ {
const Glyph& glyph = m_font->getGlyph(curChar, m_characterSize, isBold, m_outlineThickness); const Glyph& glyph = m_font->getGlyph(curChar, m_characterSize, isBold, m_outlineThickness);
float left = glyph.bounds.left;
float top = glyph.bounds.top;
float right = glyph.bounds.left + glyph.bounds.width;
float bottom = glyph.bounds.top + glyph.bounds.height;
// Add the outline glyph to the vertices // Add the outline glyph to the vertices
addGlyphQuad(m_outlineVertices, Vector2f(x, y), m_outlineColor, glyph, italicShear); addGlyphQuad(m_outlineVertices, Vector2f(x, y), m_outlineColor, glyph, italicShear);
// Update the current bounds with the outlined glyph bounds
minX = std::min(minX, x + left - italicShear * bottom);
maxX = std::max(maxX, x + right - italicShear * top);
minY = std::min(minY, y + top);
maxY = std::max(maxY, y + bottom);
} }
// Extract the current glyph's description // Extract the current glyph's description
@ -556,24 +545,31 @@ void Text::ensureGeometryUpdate() const
// Add the glyph to the vertices // Add the glyph to the vertices
addGlyphQuad(m_vertices, Vector2f(x, y), m_fillColor, glyph, italicShear); addGlyphQuad(m_vertices, Vector2f(x, y), m_fillColor, glyph, italicShear);
// Update the current bounds with the non outlined glyph bounds // Update the current bounds
if (m_outlineThickness == 0) float left = glyph.bounds.left;
{ float top = glyph.bounds.top;
float left = glyph.bounds.left; float right = glyph.bounds.left + glyph.bounds.width;
float top = glyph.bounds.top; float bottom = glyph.bounds.top + glyph.bounds.height;
float right = glyph.bounds.left + glyph.bounds.width;
float bottom = glyph.bounds.top + glyph.bounds.height;
minX = std::min(minX, x + left - italicShear * bottom); minX = std::min(minX, x + left - italicShear * bottom);
maxX = std::max(maxX, x + right - italicShear * top); maxX = std::max(maxX, x + right - italicShear * top);
minY = std::min(minY, y + top); minY = std::min(minY, y + top);
maxY = std::max(maxY, y + bottom); maxY = std::max(maxY, y + bottom);
}
// Advance to the next character // Advance to the next character
x += glyph.advance + letterSpacing; x += glyph.advance + letterSpacing;
} }
// If we're using outline, update the current bounds
if (m_outlineThickness != 0)
{
float outline = std::abs(std::ceil(m_outlineThickness));
minX -= outline;
maxX += outline;
minY -= outline;
maxY += outline;
}
// If we're using the underlined style, add the last line // If we're using the underlined style, add the last line
if (isUnderlined && (x > 0)) if (isUnderlined && (x > 0))
{ {

View File

@ -555,7 +555,7 @@ Ftp::Response Ftp::DataChannel::open(Ftp::TransferMode mode)
} }
// Reconstruct connection port and address // Reconstruct connection port and address
unsigned short port = static_cast<std::uint8_t>(data[4] * 256) + data[5]; unsigned short port = static_cast<std::uint16_t>(data[4] * 256 + data[5]);
IpAddress address(data[0], data[1], data[2], data[3]); IpAddress address(data[0], data[1], data[2], data[3]);
// Connect the data channel to the server // Connect the data channel to the server

View File

@ -68,7 +68,7 @@ void Http::Request::setUri(const std::string& uri)
// Make sure it starts with a '/' // Make sure it starts with a '/'
if (m_uri.empty() || (m_uri[0] != '/')) if (m_uri.empty() || (m_uri[0] != '/'))
m_uri.insert(0, "/"); m_uri.insert(m_uri.begin(), '/');
} }

View File

@ -12,10 +12,6 @@ set(SRC
${SRCROOT}/Cursor.cpp ${SRCROOT}/Cursor.cpp
${INCROOT}/Cursor.hpp ${INCROOT}/Cursor.hpp
${SRCROOT}/CursorImpl.hpp ${SRCROOT}/CursorImpl.hpp
${SRCROOT}/EGLCheck.cpp
${SRCROOT}/EGLCheck.hpp
${SRCROOT}/EglContext.cpp
${SRCROOT}/EglContext.hpp
${INCROOT}/Export.hpp ${INCROOT}/Export.hpp
${SRCROOT}/GlContext.cpp ${SRCROOT}/GlContext.cpp
${SRCROOT}/GlContext.hpp ${SRCROOT}/GlContext.hpp
@ -63,8 +59,6 @@ if(SFML_OS_WINDOWS)
${SRCROOT}/Win32/CursorImpl.cpp ${SRCROOT}/Win32/CursorImpl.cpp
${SRCROOT}/Win32/ClipboardImpl.hpp ${SRCROOT}/Win32/ClipboardImpl.hpp
${SRCROOT}/Win32/ClipboardImpl.cpp ${SRCROOT}/Win32/ClipboardImpl.cpp
${SRCROOT}/Win32/WglContext.cpp
${SRCROOT}/Win32/WglContext.hpp
${SRCROOT}/Win32/InputImpl.cpp ${SRCROOT}/Win32/InputImpl.cpp
${SRCROOT}/Win32/InputImpl.hpp ${SRCROOT}/Win32/InputImpl.hpp
${SRCROOT}/Win32/JoystickImpl.cpp ${SRCROOT}/Win32/JoystickImpl.cpp
@ -77,6 +71,19 @@ if(SFML_OS_WINDOWS)
${SRCROOT}/Win32/WindowImplWin32.cpp ${SRCROOT}/Win32/WindowImplWin32.cpp
${SRCROOT}/Win32/WindowImplWin32.hpp ${SRCROOT}/Win32/WindowImplWin32.hpp
) )
if(SFML_OPENGL_ES)
list(APPEND PLATFORM_SRC
${SRCROOT}/EGLCheck.cpp
${SRCROOT}/EGLCheck.hpp
${SRCROOT}/EglContext.cpp
${SRCROOT}/EglContext.hpp
)
else()
list(APPEND PLATFORM_SRC
${SRCROOT}/Win32/WglContext.cpp
${SRCROOT}/Win32/WglContext.hpp
)
endif()
source_group("windows" FILES ${PLATFORM_SRC}) source_group("windows" FILES ${PLATFORM_SRC})
# make sure that we use the Unicode version of the Win API functions # make sure that we use the Unicode version of the Win API functions
@ -84,7 +91,9 @@ if(SFML_OS_WINDOWS)
elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD) elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD)
if(SFML_USE_DRM) if(SFML_USE_DRM)
add_definitions(-DSFML_USE_DRM) add_definitions(-DSFML_USE_DRM)
list(APPEND PLATFORM_SRC set(PLATFORM_SRC
${SRCROOT}/EGLCheck.cpp
${SRCROOT}/EGLCheck.hpp
${SRCROOT}/DRM/CursorImpl.hpp ${SRCROOT}/DRM/CursorImpl.hpp
${SRCROOT}/DRM/CursorImpl.cpp ${SRCROOT}/DRM/CursorImpl.cpp
${SRCROOT}/DRM/ClipboardImpl.hpp ${SRCROOT}/DRM/ClipboardImpl.hpp
@ -100,7 +109,7 @@ elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD)
${SRCROOT}/DRM/WindowImplDRM.hpp ${SRCROOT}/DRM/WindowImplDRM.hpp
) )
else() else()
list(APPEND PLATFORM_SRC set(PLATFORM_SRC
${SRCROOT}/Unix/CursorImpl.hpp ${SRCROOT}/Unix/CursorImpl.hpp
${SRCROOT}/Unix/CursorImpl.cpp ${SRCROOT}/Unix/CursorImpl.cpp
${SRCROOT}/Unix/ClipboardImpl.hpp ${SRCROOT}/Unix/ClipboardImpl.hpp
@ -111,14 +120,25 @@ elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD)
${SRCROOT}/Unix/SensorImpl.hpp ${SRCROOT}/Unix/SensorImpl.hpp
${SRCROOT}/Unix/Display.cpp ${SRCROOT}/Unix/Display.cpp
${SRCROOT}/Unix/Display.hpp ${SRCROOT}/Unix/Display.hpp
${SRCROOT}/Unix/GlxContext.cpp
${SRCROOT}/Unix/GlxContext.hpp
${SRCROOT}/Unix/VideoModeImpl.cpp ${SRCROOT}/Unix/VideoModeImpl.cpp
${SRCROOT}/Unix/VulkanImplX11.cpp ${SRCROOT}/Unix/VulkanImplX11.cpp
${SRCROOT}/Unix/VulkanImplX11.hpp ${SRCROOT}/Unix/VulkanImplX11.hpp
${SRCROOT}/Unix/WindowImplX11.cpp ${SRCROOT}/Unix/WindowImplX11.cpp
${SRCROOT}/Unix/WindowImplX11.hpp ${SRCROOT}/Unix/WindowImplX11.hpp
) )
if(SFML_OPENGL_ES)
list(APPEND PLATFORM_SRC
${SRCROOT}/EGLCheck.cpp
${SRCROOT}/EGLCheck.hpp
${SRCROOT}/EglContext.cpp
${SRCROOT}/EglContext.hpp
)
else()
list(APPEND PLATFORM_SRC
${SRCROOT}/Unix/GlxContext.cpp
${SRCROOT}/Unix/GlxContext.hpp
)
endif()
endif() endif()
if(SFML_OS_LINUX) if(SFML_OS_LINUX)
list(APPEND PLATFORM_SRC list(APPEND PLATFORM_SRC
@ -140,7 +160,6 @@ elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD)
${SRCROOT}/NetBSD/JoystickImpl.cpp ${SRCROOT}/NetBSD/JoystickImpl.cpp
${SRCROOT}/NetBSD/JoystickImpl.hpp ${SRCROOT}/NetBSD/JoystickImpl.hpp
) )
endif() endif()
source_group("unix" FILES ${PLATFORM_SRC}) source_group("unix" FILES ${PLATFORM_SRC})
elseif(SFML_OS_MACOSX) elseif(SFML_OS_MACOSX)
@ -228,6 +247,10 @@ elseif(SFML_OS_IOS)
source_group("ios" FILES ${PLATFORM_SRC}) source_group("ios" FILES ${PLATFORM_SRC})
elseif(SFML_OS_ANDROID) elseif(SFML_OS_ANDROID)
set(PLATFORM_SRC set(PLATFORM_SRC
${SRCROOT}/EGLCheck.cpp
${SRCROOT}/EGLCheck.hpp
${SRCROOT}/EglContext.cpp
${SRCROOT}/EglContext.hpp
${SRCROOT}/Android/CursorImpl.hpp ${SRCROOT}/Android/CursorImpl.hpp
${SRCROOT}/Android/CursorImpl.cpp ${SRCROOT}/Android/CursorImpl.cpp
${SRCROOT}/Android/ClipboardImpl.hpp ${SRCROOT}/Android/ClipboardImpl.hpp

View File

@ -26,7 +26,6 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/OpenGL.hpp>
#include <SFML/System/Err.hpp> #include <SFML/System/Err.hpp>
#include <SFML/System/Sleep.hpp> #include <SFML/System/Sleep.hpp>
#include <SFML/Window/DRM/DRMContext.hpp> #include <SFML/Window/DRM/DRMContext.hpp>
@ -38,6 +37,14 @@
#include <poll.h> #include <poll.h>
#include <unistd.h> #include <unistd.h>
// We check for this definition in order to avoid multiple definitions of GLAD
// entities during unity builds of SFML.
#ifndef SF_GLAD_EGL_IMPLEMENTATION_INCLUDED
#define SF_GLAD_EGL_IMPLEMENTATION_INCLUDED
#define SF_GLAD_EGL_IMPLEMENTATION
#include <glad/egl.h>
#endif
namespace namespace
{ {
bool initialized = false; bool initialized = false;
@ -165,11 +172,15 @@ EGLDisplay getInitializedDisplay()
if (display == EGL_NO_DISPLAY) if (display == EGL_NO_DISPLAY)
{ {
display = eglCheck(eglGetDisplay(reinterpret_cast<EGLNativeDisplayType>(gbmDevice))); gladLoaderLoadEGL(EGL_NO_DISPLAY);
eglCheck(display = eglGetDisplay(reinterpret_cast<EGLNativeDisplayType>(gbmDevice)));
EGLint major, minor; EGLint major, minor;
eglCheck(eglInitialize(display, &major, &minor)); eglCheck(eglInitialize(display, &major, &minor));
gladLoaderLoadEGL(display);
#if defined(SFML_OPENGL_ES) #if defined(SFML_OPENGL_ES)
if (!eglBindAPI(EGL_OPENGL_ES_API)) if (!eglBindAPI(EGL_OPENGL_ES_API))
{ {
@ -286,7 +297,8 @@ m_scanOut(false)
DRMContext::~DRMContext() DRMContext::~DRMContext()
{ {
// Deactivate the current context // Deactivate the current context
EGLContext currentContext = eglCheck(eglGetCurrentContext()); EGLContext currentContext;
eglCheck(currentContext = eglGetCurrentContext());
if (currentContext == m_context) if (currentContext == m_context)
{ {
@ -412,7 +424,7 @@ void DRMContext::createContext(DRMContext* shared)
eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
// Create EGL context // Create EGL context
m_context = eglCheck(eglCreateContext(m_display, m_config, toShared, contextVersion)); eglCheck(m_context = eglCreateContext(m_display, m_config, toShared, contextVersion));
if (m_context == EGL_NO_CONTEXT) if (m_context == EGL_NO_CONTEXT)
err() << "Failed to create EGL context" << std::endl; err() << "Failed to create EGL context" << std::endl;
} }
@ -437,8 +449,8 @@ void DRMContext::createSurface(const Vector2u& size, unsigned int /*bpp*/, bool
m_size = size; m_size = size;
m_surface = eglCheck( eglCheck(
eglCreateWindowSurface(m_display, m_config, reinterpret_cast<EGLNativeWindowType>(m_gbmSurface), nullptr)); m_surface = eglCreateWindowSurface(m_display, m_config, reinterpret_cast<EGLNativeWindowType>(m_gbmSurface), nullptr));
if (m_surface == EGL_NO_SURFACE) if (m_surface == EGL_NO_SURFACE)
{ {

View File

@ -29,16 +29,14 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Headers // Headers
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/OpenGL.hpp>
#include <SFML/Window/ContextSettings.hpp> #include <SFML/Window/ContextSettings.hpp>
#include <SFML/Window/EGLCheck.hpp> #include <SFML/Window/EGLCheck.hpp>
#include <SFML/Window/GlContext.hpp> #include <SFML/Window/GlContext.hpp>
#include <SFML/Window/VideoMode.hpp> #include <SFML/Window/VideoMode.hpp>
#include <glad/egl.h>
#include <drm-common.h> #include <drm-common.h>
#define EGL_NO_X11
#define MESA_EGL_NO_X11_HEADERS
#include <EGL/egl.h>
#include <gbm.h> #include <gbm.h>
#include <xf86drmMode.h> #include <xf86drmMode.h>

View File

@ -37,6 +37,7 @@
#include <glad/egl.h> #include <glad/egl.h>
#if defined(SFML_SYSTEM_LINUX) && !defined(SFML_USE_DRM) #if defined(SFML_SYSTEM_LINUX) && !defined(SFML_USE_DRM)
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h>
#endif #endif
namespace sf namespace sf

View File

@ -27,7 +27,6 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
#include <SFML/System/Err.hpp> #include <SFML/System/Err.hpp>
#include <SFML/Window/Context.hpp> #include <SFML/Window/Context.hpp>
#include <SFML/Window/EglContext.hpp>
#include <SFML/Window/GlContext.hpp> #include <SFML/Window/GlContext.hpp>
#include <glad/gl.h> #include <glad/gl.h>
@ -52,6 +51,7 @@
#if defined(SFML_OPENGL_ES) #if defined(SFML_OPENGL_ES)
#include <SFML/Window/EglContext.hpp>
using ContextType = sf::priv::EglContext; using ContextType = sf::priv::EglContext;
#else #else
@ -64,15 +64,16 @@ using ContextType = sf::priv::WglContext;
#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD) || \ #elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD) || \
defined(SFML_SYSTEM_NETBSD) defined(SFML_SYSTEM_NETBSD)
#if defined(SFML_OPENGL_ES) #if defined(SFML_USE_DRM)
using ContextType = sf::priv::EglContext;
#elif defined(SFML_USE_DRM)
#include <SFML/Window/DRM/DRMContext.hpp> #include <SFML/Window/DRM/DRMContext.hpp>
using ContextType = sf::priv::DRMContext; using ContextType = sf::priv::DRMContext;
#elif defined(SFML_OPENGL_ES)
#include <SFML/Window/EglContext.hpp>
using ContextType = sf::priv::EglContext;
#else #else
#include <SFML/Window/Unix/GlxContext.hpp> #include <SFML/Window/Unix/GlxContext.hpp>
@ -92,6 +93,7 @@ using ContextType = sf::priv::EaglContext;
#elif defined(SFML_SYSTEM_ANDROID) #elif defined(SFML_SYSTEM_ANDROID)
#include <SFML/Window/EglContext.hpp>
using ContextType = sf::priv::EglContext; using ContextType = sf::priv::EglContext;
#endif #endif