mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-26 05:06:12 +01:00
Merge branch '2.6.x' into feature/backmerge
This commit is contained in:
15 files changed
+247
-4
No files matched your search
+7
-2
@@ -15,6 +15,11 @@ csfml_set_option(CMAKE_BUILD_TYPE Release STRING "Choose the type of build (Debu
|
||||
# project name
|
||||
project(CSFML VERSION 3.0.0)
|
||||
|
||||
# we use the paths from the cmake GNUInstallDirs module as defaults
|
||||
# you can override these if you like
|
||||
# https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# include the configuration file
|
||||
include(${PROJECT_SOURCE_DIR}/cmake/Config.cmake)
|
||||
|
||||
@@ -68,7 +73,7 @@ endif()
|
||||
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")
|
||||
|
||||
if(CSFML_INSTALL_PKGCONFIG_FILES)
|
||||
csfml_set_option(CSFML_PKGCONFIG_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/${CSFML_PKGCONFIG_DIR}" PATH "Install directory for CSFML's pkg-config .pc files")
|
||||
csfml_set_option(CSFML_PKGCONFIG_INSTALL_DIR "${CSFML_PKGCONFIG_DIR}" PATH "Install directory for CSFML's pkg-config .pc files")
|
||||
|
||||
foreach(csfml_module IN ITEMS all system window graphics audio network)
|
||||
configure_file(
|
||||
@@ -76,7 +81,7 @@ if(CSFML_INSTALL_PKGCONFIG_FILES)
|
||||
"tools/pkg-config/csfml-${csfml_module}.pc"
|
||||
@ONLY)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/pkg-config/csfml-${csfml_module}.pc"
|
||||
DESTINATION "${CSFML_PKGCONFIG_INSTALL_PREFIX}")
|
||||
DESTINATION "${CSFML_PKGCONFIG_INSTALL_DIR}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
|
||||
+2
-2
@@ -14,10 +14,10 @@ endif()
|
||||
|
||||
# set pkgconfig install directory
|
||||
# this could be e.g. macports on mac or msys2 on windows etc.
|
||||
set(CSFML_PKGCONFIG_DIR "/${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
set(CSFML_PKGCONFIG_DIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
|
||||
|
||||
if(SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD)
|
||||
set(CSFML_PKGCONFIG_DIR "/libdata/pkgconfig")
|
||||
set(CSFML_PKGCONFIG_DIR "libdata/pkgconfig")
|
||||
endif()
|
||||
|
||||
# detect the compiler and its version
|
||||
|
||||
@@ -99,6 +99,25 @@ CSFML_GRAPHICS_API void sfFont_destroy(sfFont* font);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfGlyph sfFont_getGlyph(const sfFont* font, uint32_t codePoint, unsigned int characterSize, bool bold, float outlineThickness);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Determine if this font has a glyph representing the requested code point
|
||||
///
|
||||
/// Most fonts only include a very limited selection of glyphs from
|
||||
/// specific Unicode subsets, like Latin, Cyrillic, or Asian characters.
|
||||
///
|
||||
/// While code points without representation will return a font specific
|
||||
/// default character, it might be useful to verify whether specific
|
||||
/// code points are included to determine whether a font is suited
|
||||
/// to display text in a specific language.
|
||||
///
|
||||
/// \param font Source font
|
||||
/// \param codePoint Unicode code point to check
|
||||
///
|
||||
/// \return True if the codepoint has a glyph representation, sfFalse otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfFont_hasGlyph(const sfFont* font, uint32_t codePoint);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the kerning value corresponding to a given pair of characters in a font
|
||||
///
|
||||
|
||||
@@ -591,5 +591,18 @@ CSFML_GRAPHICS_API void sfMouse_setPositionRenderWindow(sfVector2i position, con
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfVector2i sfTouch_getPositionRenderWindow(unsigned int finger, const sfRenderWindow* relativeTo);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a Vulkan rendering surface
|
||||
///
|
||||
/// \param renderWindow RenderWindow object
|
||||
/// \param instance Vulkan instance
|
||||
/// \param surface Created surface
|
||||
/// \param allocator Allocator to use
|
||||
///
|
||||
/// \return True if surface creation was successful, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API bool sfRenderWindow_createVulkanSurface(sfRenderWindow* renderWindow, const VkInstance* instance, VkSurfaceKHR* surface, const VkAllocationCallbacks* allocator);
|
||||
|
||||
|
||||
#endif // SFML_RENDERWINDOW_H
|
||||
@@ -0,0 +1,49 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_ALLOC_H
|
||||
#define SFML_ALLOC_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/System/Export.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Deallocates memory
|
||||
///
|
||||
/// This function deallocates the memory being pointed to
|
||||
/// using the free function from the C standard library.
|
||||
///
|
||||
/// The memory must have been previously allocated using a call
|
||||
/// to malloc.
|
||||
///
|
||||
/// \param ptr Pointer to the memory to deallocate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_SYSTEM_API void sfFree(void* ptr);
|
||||
|
||||
|
||||
#endif // SFML_ALLOC_H
|
||||
@@ -94,5 +94,30 @@ CSFML_WINDOW_API sfVector2i sfMouse_getPosition(const sfWindow* relativeTo);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API void sfMouse_setPosition(sfVector2i position, const sfWindow* relativeTo);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current position of the mouse relative to a window base
|
||||
///
|
||||
/// This function returns the current position of the mouse
|
||||
/// cursor relative to the given window base, or desktop if NULL is passed.
|
||||
///
|
||||
/// \param relativeTo Reference window
|
||||
///
|
||||
/// \return Position of the mouse cursor, relative to the given window base
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API sfVector2i sfMouse_getPositionWindowBase(const sfWindowBase* relativeTo);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the current position of the mouse relative to a window base
|
||||
///
|
||||
/// This function sets the current position of the mouse
|
||||
/// cursor relative to the given window base, or desktop if NULL is passed.
|
||||
///
|
||||
/// \param position New position of the mouse
|
||||
/// \param relativeTo Reference window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API void sfMouse_setPositionWindowBase(sfVector2i position, const sfWindowBase* relativeTo);
|
||||
|
||||
|
||||
#endif // SFML_MOUSE_H
|
||||
@@ -57,5 +57,19 @@ CSFML_WINDOW_API bool sfTouch_isDown(unsigned int finger);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API sfVector2i sfTouch_getPosition(unsigned int finger, const sfWindow* relativeTo);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current position of a touch in window coordinates
|
||||
///
|
||||
/// This function returns the current touch position
|
||||
/// relative to the given window base, or desktop if NULL is passed.
|
||||
///
|
||||
/// \param finger Finger index
|
||||
/// \param relativeTo Reference window
|
||||
///
|
||||
/// \return Current position of \a finger, or undefined if it's not down
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API sfVector2i sfTouch_getPositionWindowBase(unsigned int finger, const sfWindowBase* relativeTo);
|
||||
|
||||
|
||||
#endif // SFML_TOUCH_H
|
||||
@@ -476,5 +476,18 @@ CSFML_WINDOW_API void sfWindow_display(sfWindow* window);
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API sfWindowHandle sfWindow_getNativeHandle(const sfWindow* window);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a Vulkan rendering surface
|
||||
///
|
||||
/// \param window Window object
|
||||
/// \param instance Vulkan instance
|
||||
/// \param surface Created surface
|
||||
/// \param allocator Allocator to use
|
||||
///
|
||||
/// \return True if surface creation was successful, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_WINDOW_API bool sfWindow_createVulkanSurface(sfWindow* window, const VkInstance* instance, VkSurfaceKHR* surface, const VkAllocationCallbacks* allocator);
|
||||
|
||||
|
||||
#endif // SFML_WINDOW_H
|
||||
@@ -114,6 +114,13 @@ sfGlyph sfFont_getGlyph(const sfFont* font, uint32_t codePoint, unsigned int cha
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
bool sfFont_hasGlyph(const sfFont* font, uint32_t codePoint)
|
||||
{
|
||||
CSFML_CALL_RETURN(font, hasGlyph(codePoint), false);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfFont_getKerning(const sfFont* font, uint32_t first, uint32_t second, unsigned int characterSize)
|
||||
{
|
||||
|
||||
@@ -549,6 +549,7 @@ void sfMouse_setPositionRenderWindow(sfVector2i position, const sfRenderWindow*
|
||||
sf::Mouse::setPosition(sf::Vector2i(position.x, position.y));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
sfVector2i sfTouch_getPositionRenderWindow(unsigned int finger, const sfRenderWindow* relativeTo)
|
||||
{
|
||||
@@ -562,3 +563,12 @@ sfVector2i sfTouch_getPositionRenderWindow(unsigned int finger, const sfRenderWi
|
||||
sfVector2i position = { sfmlPosition.x, sfmlPosition.y };
|
||||
return position;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
bool sfRenderWindow_createVulkanSurface(sfRenderWindow* renderWindow, const VkInstance* instance, VkSurfaceKHR* surface, const VkAllocationCallbacks* allocator)
|
||||
{
|
||||
CSFML_CHECK_RETURN(instance, false);
|
||||
CSFML_CHECK_RETURN(surface, false);
|
||||
CSFML_CALL_RETURN(renderWindow, createVulkanSurface(*instance, *surface, allocator), false);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/System/Alloc.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfFree(void* ptr)
|
||||
{
|
||||
free(ptr);
|
||||
}
|
||||
@@ -6,6 +6,8 @@ set(SRCROOT ${PROJECT_SOURCE_DIR}/src/SFML/System)
|
||||
set(SRC
|
||||
${PROJECT_SOURCE_DIR}/include/SFML/GPUPreference.h
|
||||
${INCROOT}/Export.h
|
||||
${SRCROOT}/Alloc.cpp
|
||||
${INCROOT}/Alloc.h
|
||||
${SRCROOT}/Buffer.cpp
|
||||
${SRCROOT}/BufferStruct.h
|
||||
${INCROOT}/Buffer.h
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Window/Mouse.h>
|
||||
#include <SFML/Window/WindowBaseStruct.h>
|
||||
#include <SFML/Window/WindowStruct.h>
|
||||
#include <SFML/Window/Mouse.hpp>
|
||||
#include <SFML/Internal.h>
|
||||
@@ -60,3 +61,27 @@ void sfMouse_setPosition(sfVector2i position, const sfWindow* relativeTo)
|
||||
else
|
||||
sf::Mouse::setPosition(sf::Vector2i(position.x, position.y));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
sfVector2i sfMouse_getPositionWindowBase(const sfWindowBase* relativeTo)
|
||||
{
|
||||
sf::Vector2i sfmlPos;
|
||||
if (relativeTo)
|
||||
sfmlPos = sf::Mouse::getPosition(relativeTo->This);
|
||||
else
|
||||
sfmlPos = sf::Mouse::getPosition();
|
||||
|
||||
sfVector2i position = { sfmlPos.x, sfmlPos.y };
|
||||
return position;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfMouse_setPositionWindowBase(sfVector2i position, const sfWindowBase* relativeTo)
|
||||
{
|
||||
if (relativeTo)
|
||||
sf::Mouse::setPosition(sf::Vector2i(position.x, position.y), relativeTo->This);
|
||||
else
|
||||
sf::Mouse::setPosition(sf::Vector2i(position.x, position.y));
|
||||
}
|
||||
@@ -27,6 +27,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Window/Touch.h>
|
||||
#include <SFML/Window/Touch.hpp>
|
||||
#include <SFML/Window/WindowBaseStruct.h>
|
||||
#include <SFML/Window/WindowStruct.h>
|
||||
#include <SFML/Internal.h>
|
||||
|
||||
@@ -50,3 +51,17 @@ sfVector2i sfTouch_getPosition(unsigned int finger, const sfWindow* relativeTo)
|
||||
sfVector2i position = {sfmlPosition.x, sfmlPosition.y};
|
||||
return position;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
sfVector2i sfTouch_getPositionWindowBase(unsigned int finger, const sfWindowBase* relativeTo)
|
||||
{
|
||||
sf::Vector2i sfmlPosition;
|
||||
|
||||
if (relativeTo)
|
||||
sfmlPosition = sf::Touch::getPosition(finger, relativeTo->This);
|
||||
else
|
||||
sfmlPosition = sf::Touch::getPosition(finger);
|
||||
|
||||
sfVector2i position = { sfmlPosition.x, sfmlPosition.y };
|
||||
return position;
|
||||
}
|
||||
@@ -322,3 +322,12 @@ sfWindowHandle sfWindow_getNativeHandle(const sfWindow* window)
|
||||
|
||||
return static_cast<sfWindowHandle>(window->This.getNativeHandle());
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
bool sfWindow_createVulkanSurface(sfWindow* window, const VkInstance* instance, VkSurfaceKHR* surface, const VkAllocationCallbacks* allocator)
|
||||
{
|
||||
CSFML_CHECK_RETURN(instance, false);
|
||||
CSFML_CHECK_RETURN(surface, false);
|
||||
CSFML_CALL_RETURN(window, createVulkanSurface(*instance, *surface, allocator), false);
|
||||
}
|
||||
Reference in new issue
Block a user