Skip to content

Commit fce7450

Browse files
committed
Merge branch '2.6.x' into feature/backmerge
2 parents 671afab + e0589c3 commit fce7450

File tree

15 files changed

+247
-4
lines changed

15 files changed

+247
-4
lines changed

CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ csfml_set_option(CMAKE_BUILD_TYPE Release STRING "Choose the type of build (Debu
1515
# project name
1616
project(CSFML VERSION 3.0.0)
1717

18+
# we use the paths from the cmake GNUInstallDirs module as defaults
19+
# you can override these if you like
20+
# https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
21+
include(GNUInstallDirs)
22+
1823
# include the configuration file
1924
include(${PROJECT_SOURCE_DIR}/cmake/Config.cmake)
2025

@@ -68,15 +73,15 @@ endif()
6873
csfml_set_option(CSFML_INSTALL_PKGCONFIG_FILES ${CSFML_INSTALL_PKGCONFIG_DEFAULT} BOOL "TRUE to automatically install pkg-config files so other projects can find SFML")
6974

7075
if(CSFML_INSTALL_PKGCONFIG_FILES)
71-
csfml_set_option(CSFML_PKGCONFIG_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/${CSFML_PKGCONFIG_DIR}" PATH "Install directory for CSFML's pkg-config .pc files")
76+
csfml_set_option(CSFML_PKGCONFIG_INSTALL_DIR "${CSFML_PKGCONFIG_DIR}" PATH "Install directory for CSFML's pkg-config .pc files")
7277

7378
foreach(csfml_module IN ITEMS all system window graphics audio network)
7479
configure_file(
7580
"tools/pkg-config/csfml-${csfml_module}.pc.in"
7681
"tools/pkg-config/csfml-${csfml_module}.pc"
7782
@ONLY)
7883
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/pkg-config/csfml-${csfml_module}.pc"
79-
DESTINATION "${CSFML_PKGCONFIG_INSTALL_PREFIX}")
84+
DESTINATION "${CSFML_PKGCONFIG_INSTALL_DIR}")
8085
endforeach()
8186
endif()
8287

cmake/Config.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ endif()
1414

1515
# set pkgconfig install directory
1616
# this could be e.g. macports on mac or msys2 on windows etc.
17-
set(CSFML_PKGCONFIG_DIR "/${CMAKE_INSTALL_LIBDIR}/pkgconfig")
17+
set(CSFML_PKGCONFIG_DIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
1818

1919
if(SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD)
20-
set(CSFML_PKGCONFIG_DIR "/libdata/pkgconfig")
20+
set(CSFML_PKGCONFIG_DIR "libdata/pkgconfig")
2121
endif()
2222

2323
# detect the compiler and its version

include/SFML/Graphics/Font.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,25 @@ CSFML_GRAPHICS_API void sfFont_destroy(sfFont* font);
9999
////////////////////////////////////////////////////////////
100100
CSFML_GRAPHICS_API sfGlyph sfFont_getGlyph(const sfFont* font, uint32_t codePoint, unsigned int characterSize, bool bold, float outlineThickness);
101101

102+
////////////////////////////////////////////////////////////
103+
/// \brief Determine if this font has a glyph representing the requested code point
104+
///
105+
/// Most fonts only include a very limited selection of glyphs from
106+
/// specific Unicode subsets, like Latin, Cyrillic, or Asian characters.
107+
///
108+
/// While code points without representation will return a font specific
109+
/// default character, it might be useful to verify whether specific
110+
/// code points are included to determine whether a font is suited
111+
/// to display text in a specific language.
112+
///
113+
/// \param font Source font
114+
/// \param codePoint Unicode code point to check
115+
///
116+
/// \return True if the codepoint has a glyph representation, sfFalse otherwise
117+
///
118+
////////////////////////////////////////////////////////////
119+
CSFML_GRAPHICS_API bool sfFont_hasGlyph(const sfFont* font, uint32_t codePoint);
120+
102121
////////////////////////////////////////////////////////////
103122
/// \brief Get the kerning value corresponding to a given pair of characters in a font
104123
///

include/SFML/Graphics/RenderWindow.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,5 +591,18 @@ CSFML_GRAPHICS_API void sfMouse_setPositionRenderWindow(sfVector2i position, con
591591
////////////////////////////////////////////////////////////
592592
CSFML_GRAPHICS_API sfVector2i sfTouch_getPositionRenderWindow(unsigned int finger, const sfRenderWindow* relativeTo);
593593

594+
////////////////////////////////////////////////////////////
595+
/// \brief Create a Vulkan rendering surface
596+
///
597+
/// \param renderWindow RenderWindow object
598+
/// \param instance Vulkan instance
599+
/// \param surface Created surface
600+
/// \param allocator Allocator to use
601+
///
602+
/// \return True if surface creation was successful, false otherwise
603+
///
604+
////////////////////////////////////////////////////////////
605+
CSFML_GRAPHICS_API bool sfRenderWindow_createVulkanSurface(sfRenderWindow* renderWindow, const VkInstance* instance, VkSurfaceKHR* surface, const VkAllocationCallbacks* allocator);
606+
594607

595608
#endif // SFML_RENDERWINDOW_H

include/SFML/System/Alloc.h

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
////////////////////////////////////////////////////////////
2+
//
3+
// SFML - Simple and Fast Multimedia Library
4+
// Copyright (C) 2007-2023 Laurent Gomila ([email protected])
5+
//
6+
// This software is provided 'as-is', without any express or implied warranty.
7+
// In no event will the authors be held liable for any damages arising from the use of this software.
8+
//
9+
// Permission is granted to anyone to use this software for any purpose,
10+
// including commercial applications, and to alter it and redistribute it freely,
11+
// subject to the following restrictions:
12+
//
13+
// 1. The origin of this software must not be misrepresented;
14+
// you must not claim that you wrote the original software.
15+
// If you use this software in a product, an acknowledgment
16+
// in the product documentation would be appreciated but is not required.
17+
//
18+
// 2. Altered source versions must be plainly marked as such,
19+
// and must not be misrepresented as being the original software.
20+
//
21+
// 3. This notice may not be removed or altered from any source distribution.
22+
//
23+
////////////////////////////////////////////////////////////
24+
25+
#ifndef SFML_ALLOC_H
26+
#define SFML_ALLOC_H
27+
28+
////////////////////////////////////////////////////////////
29+
// Headers
30+
////////////////////////////////////////////////////////////
31+
#include <SFML/System/Export.h>
32+
33+
34+
////////////////////////////////////////////////////////////
35+
/// \brief Deallocates memory
36+
///
37+
/// This function deallocates the memory being pointed to
38+
/// using the free function from the C standard library.
39+
///
40+
/// The memory must have been previously allocated using a call
41+
/// to malloc.
42+
///
43+
/// \param ptr Pointer to the memory to deallocate
44+
///
45+
////////////////////////////////////////////////////////////
46+
CSFML_SYSTEM_API void sfFree(void* ptr);
47+
48+
49+
#endif // SFML_ALLOC_H

include/SFML/Window/Mouse.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,30 @@ CSFML_WINDOW_API sfVector2i sfMouse_getPosition(const sfWindow* relativeTo);
9494
////////////////////////////////////////////////////////////
9595
CSFML_WINDOW_API void sfMouse_setPosition(sfVector2i position, const sfWindow* relativeTo);
9696

97+
////////////////////////////////////////////////////////////
98+
/// \brief Get the current position of the mouse relative to a window base
99+
///
100+
/// This function returns the current position of the mouse
101+
/// cursor relative to the given window base, or desktop if NULL is passed.
102+
///
103+
/// \param relativeTo Reference window
104+
///
105+
/// \return Position of the mouse cursor, relative to the given window base
106+
///
107+
////////////////////////////////////////////////////////////
108+
CSFML_WINDOW_API sfVector2i sfMouse_getPositionWindowBase(const sfWindowBase* relativeTo);
109+
110+
////////////////////////////////////////////////////////////
111+
/// \brief Set the current position of the mouse relative to a window base
112+
///
113+
/// This function sets the current position of the mouse
114+
/// cursor relative to the given window base, or desktop if NULL is passed.
115+
///
116+
/// \param position New position of the mouse
117+
/// \param relativeTo Reference window
118+
///
119+
////////////////////////////////////////////////////////////
120+
CSFML_WINDOW_API void sfMouse_setPositionWindowBase(sfVector2i position, const sfWindowBase* relativeTo);
121+
97122

98123
#endif // SFML_MOUSE_H

include/SFML/Window/Touch.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,19 @@ CSFML_WINDOW_API bool sfTouch_isDown(unsigned int finger);
5757
////////////////////////////////////////////////////////////
5858
CSFML_WINDOW_API sfVector2i sfTouch_getPosition(unsigned int finger, const sfWindow* relativeTo);
5959

60+
////////////////////////////////////////////////////////////
61+
/// \brief Get the current position of a touch in window coordinates
62+
///
63+
/// This function returns the current touch position
64+
/// relative to the given window base, or desktop if NULL is passed.
65+
///
66+
/// \param finger Finger index
67+
/// \param relativeTo Reference window
68+
///
69+
/// \return Current position of \a finger, or undefined if it's not down
70+
///
71+
////////////////////////////////////////////////////////////
72+
CSFML_WINDOW_API sfVector2i sfTouch_getPositionWindowBase(unsigned int finger, const sfWindowBase* relativeTo);
73+
6074

6175
#endif // SFML_TOUCH_H

include/SFML/Window/Window.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,5 +476,18 @@ CSFML_WINDOW_API void sfWindow_display(sfWindow* window);
476476
////////////////////////////////////////////////////////////
477477
CSFML_WINDOW_API sfWindowHandle sfWindow_getNativeHandle(const sfWindow* window);
478478

479+
////////////////////////////////////////////////////////////
480+
/// \brief Create a Vulkan rendering surface
481+
///
482+
/// \param window Window object
483+
/// \param instance Vulkan instance
484+
/// \param surface Created surface
485+
/// \param allocator Allocator to use
486+
///
487+
/// \return True if surface creation was successful, false otherwise
488+
///
489+
////////////////////////////////////////////////////////////
490+
CSFML_WINDOW_API bool sfWindow_createVulkanSurface(sfWindow* window, const VkInstance* instance, VkSurfaceKHR* surface, const VkAllocationCallbacks* allocator);
491+
479492

480493
#endif // SFML_WINDOW_H

src/SFML/Graphics/Font.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,13 @@ sfGlyph sfFont_getGlyph(const sfFont* font, uint32_t codePoint, unsigned int cha
114114
}
115115

116116

117+
////////////////////////////////////////////////////////////
118+
bool sfFont_hasGlyph(const sfFont* font, uint32_t codePoint)
119+
{
120+
CSFML_CALL_RETURN(font, hasGlyph(codePoint), false);
121+
}
122+
123+
117124
////////////////////////////////////////////////////////////
118125
float sfFont_getKerning(const sfFont* font, uint32_t first, uint32_t second, unsigned int characterSize)
119126
{

src/SFML/Graphics/RenderWindow.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,7 @@ void sfMouse_setPositionRenderWindow(sfVector2i position, const sfRenderWindow*
549549
sf::Mouse::setPosition(sf::Vector2i(position.x, position.y));
550550
}
551551

552+
552553
////////////////////////////////////////////////////////////
553554
sfVector2i sfTouch_getPositionRenderWindow(unsigned int finger, const sfRenderWindow* relativeTo)
554555
{
@@ -562,3 +563,12 @@ sfVector2i sfTouch_getPositionRenderWindow(unsigned int finger, const sfRenderWi
562563
sfVector2i position = { sfmlPosition.x, sfmlPosition.y };
563564
return position;
564565
}
566+
567+
568+
////////////////////////////////////////////////////////////
569+
bool sfRenderWindow_createVulkanSurface(sfRenderWindow* renderWindow, const VkInstance* instance, VkSurfaceKHR* surface, const VkAllocationCallbacks* allocator)
570+
{
571+
CSFML_CHECK_RETURN(instance, false);
572+
CSFML_CHECK_RETURN(surface, false);
573+
CSFML_CALL_RETURN(renderWindow, createVulkanSurface(*instance, *surface, allocator), false);
574+
}

0 commit comments

Comments
 (0)