mirror of
https://github.com/SFML/SFML.git
synced 2024-11-24 20:31:05 +08:00
Merge branch 'master' into drawables
Conflicts: include/SFML/Graphics/Sprite.hpp include/SFML/Graphics/Text.hpp src/SFML/Graphics/Sprite.cpp
This commit is contained in:
commit
eeff685255
143
CMakeLists.txt
143
CMakeLists.txt
@ -31,9 +31,15 @@ set(BUILD_EXAMPLES FALSE CACHE BOOL "TRUE to build the SFML examples, FALSE to i
|
||||
set(BUILD_DOC FALSE CACHE BOOL "TRUE to generate the API documentation, FALSE to ignore it")
|
||||
|
||||
# Mac OS X specific options
|
||||
if (MACOSX AND MACOSX_VERSION GREATER 5)
|
||||
# add an option to build against 10.5 SDK if current OS X version is greater than 10.5
|
||||
set(BUILD_LEOPARD FALSE CACHE BOOL "TRUE to build SFML for OS X 10.5, FALSE to compile with default SDK")
|
||||
if(MACOSX)
|
||||
# add an option to build frameworks instead of dylibs (release only)
|
||||
set(BUILD_FRAMEWORKS FALSE CACHE BOOL "TRUE to build SFML as frameworks libraries (release only), FALSE to build according to BUILD_SHARED_LIBS")
|
||||
|
||||
# add an option to let the user specify a custom directory for frameworks installation (SFML, sndfile, ...)
|
||||
set(CMAKE_INSTALL_FRAMEWORK_PREFIX "/Library/Frameworks" CACHE STRING "Frameworks installation directory")
|
||||
|
||||
# add an option to automatically install Xcode 4 templates
|
||||
set(INSTALL_XCODE4_TEMPLATES FALSE CACHE BOOL "TRUE to automatically install the Xcode 4 templates, FALSE to do nothing about it")
|
||||
endif()
|
||||
|
||||
# define SFML_STATIC if the build type is not set to 'shared'
|
||||
@ -65,24 +71,59 @@ endif()
|
||||
# disable the rpath stuff
|
||||
set(CMAKE_SKIP_BUILD_RPATH TRUE)
|
||||
|
||||
# Setup Mac OS X multi arch/SDK support.
|
||||
if (MACOSX)
|
||||
if (NOT CMAKE_OSX_ARCHITECTURES)
|
||||
# Default : i386 and x86_64
|
||||
set(CMAKE_OSX_ARCHITECTURES "i386;x86_64")
|
||||
else()
|
||||
# We got some conflict with custom user settings ; let him know his on his own.
|
||||
message("CMAKE_OSX_ARCHITECTURES is not empty.")
|
||||
message("You're on your own : I won't change your settings.")
|
||||
# Setup Mac OS X stuff
|
||||
if(MACOSX)
|
||||
# multi arch support - by default : i386 and x86_64
|
||||
if(NOT CMAKE_OSX_ARCHITECTURES)
|
||||
set(CMAKE_OSX_ARCHITECTURES "i386;x86_64" CACHE STRING "Build architectures for OSX" FORCE)
|
||||
endif()
|
||||
|
||||
# use 10.5 SDK ?
|
||||
if (BUILD_LEOPARD)
|
||||
# Use 10.5 SDK : override default value
|
||||
set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.5.sdk")
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.5")
|
||||
else()
|
||||
# Default SDK, let either the user or CMake decide which one to use.
|
||||
# multi SDK support - by default we choose the older SDK available starting by 10.5 SDK
|
||||
if(NOT OSX_CONFIG_HAS_BEEN_RUN_BEFORE)
|
||||
if(EXISTS /Developer/SDKs/MacOSX10.5.sdk)
|
||||
# target 10.5 system
|
||||
set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.5.sdk"
|
||||
CACHE STRING "The product will be built against the headers and libraries located inside the indicated SDK. Set to empty string for default value."
|
||||
FORCE)
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.5"
|
||||
CACHE STRING "Minimum OS X version to target for deployment (at runtime); ewer APIs weak linked."
|
||||
FORCE)
|
||||
elseif(EXISTS /Developer/SDKs/MacOSX10.6.sdk)
|
||||
# target 10.6 system
|
||||
set(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.6.sdk"
|
||||
CACHE STRING "The product will be built against the headers and libraries located inside the indicated SDK. Set to empty string for default value."
|
||||
FORCE)
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.6"
|
||||
CACHE STRING "Minimum OS X version to target for deployment (at runtime); newer APIs weak linked."
|
||||
FORCE)
|
||||
else()
|
||||
# use default SDK.
|
||||
endif()
|
||||
|
||||
# note : we use OSX_CONFIG_HAS_BEEN_RUN_BEFORE to be able to let the user set his/her custom settings
|
||||
# so we don't always have to FORCE the value of CMAKE_OSX_DEPLOYMENT_TARGET and CMAKE_OSX_SYSROOT
|
||||
set(OSX_CONFIG_HAS_BEEN_RUN_BEFORE TRUE
|
||||
CACHE BOOL "Don't edit this value; you should instead empty your cache."
|
||||
FORCE)
|
||||
mark_as_advanced(OSX_CONFIG_HAS_BEEN_RUN_BEFORE)
|
||||
endif()
|
||||
|
||||
# BUILD_FRAMEWORKS needs two things :
|
||||
# first, it's available only for release
|
||||
# (because cmake currently doesn't allow specifying a custom framework name so XXX-d is not possible)
|
||||
# secondly, it works only with BUILD_SHARED_LIBS enabled
|
||||
if(BUILD_FRAMEWORKS)
|
||||
# requirement #1
|
||||
if(NOT CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
message(WARNING "CMAKE_BUILD_TYPE should be \"Release\" when BUILD_FRAMEWORKS is TRUE")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# requirement #2
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
message(WARNING "BUILD_SHARED_LIBS should be TRUE when BUILD_FRAMEWORKS is TRUE")
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -95,13 +136,59 @@ if(BUILD_DOC)
|
||||
add_subdirectory(doc)
|
||||
endif()
|
||||
|
||||
# setup the install rules
|
||||
install(DIRECTORY include
|
||||
DESTINATION .
|
||||
COMPONENT devel
|
||||
PATTERN ".svn" EXCLUDE)
|
||||
# setup the install rules
|
||||
if(NOT BUILD_FRAMEWORKS)
|
||||
install(DIRECTORY include
|
||||
DESTINATION .
|
||||
COMPONENT devel
|
||||
PATTERN ".svn" EXCLUDE)
|
||||
else()
|
||||
# find only "root" headers
|
||||
file(GLOB SFML_HEADERS RELATIVE ${PROJECT_SOURCE_DIR} "include/SFML/*")
|
||||
|
||||
# in fact we have to fool cmake to copy all the headers in subdirectories
|
||||
# to do that we have to add the "root" headers to the PUBLIC_HEADER
|
||||
# then we can run a post script to copy the remaining headers
|
||||
|
||||
# we need a dummy file in order to compile the framework
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp
|
||||
COMMAND touch ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp)
|
||||
|
||||
set(SFML_SOURCES ${SFML_HEADERS})
|
||||
list(APPEND SFML_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp)
|
||||
|
||||
# create SFML.framework
|
||||
add_library(SFML ${SFML_SOURCES})
|
||||
|
||||
# edit target properties
|
||||
set_target_properties(SFML PROPERTIES
|
||||
FRAMEWORK TRUE
|
||||
FRAMEWORK_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
|
||||
MACOSX_FRAMEWORK_IDENTIFIER org.sfml-dev.SFML
|
||||
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
|
||||
MACOSX_FRAMEWORK_BUNDLE_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
|
||||
PUBLIC_HEADER "${SFML_HEADERS}")
|
||||
|
||||
# add the remaining headers
|
||||
add_custom_command(TARGET SFML
|
||||
POST_BUILD
|
||||
COMMAND cp -r ${PROJECT_SOURCE_DIR}/include/SFML/* SFML.framework/Versions/2.0.0/Headers)
|
||||
|
||||
# adapt install directory to allow distributing dylibs/frameworks in user’s frameworks/application bundle
|
||||
# NOTE : it's not required to link agains SFML.framework
|
||||
set_target_properties(SFML PROPERTIES
|
||||
BUILD_WITH_INSTALL_RPATH 1
|
||||
INSTALL_NAME_DIR "@executable_path/../Frameworks")
|
||||
|
||||
# install rule
|
||||
install(TARGETS SFML
|
||||
FRAMEWORK DESTINATION ${CMAKE_INSTALL_FRAMEWORK_PREFIX}
|
||||
COMPONENT devel)
|
||||
endif()
|
||||
|
||||
install(FILES cmake/Modules/FindSFML.cmake DESTINATION ${CMAKE_ROOT}/Modules)
|
||||
install(FILES license.txt DESTINATION ${INSTALL_MISC_DIR})
|
||||
install(FILES license.txt DESTINATION ${INSTALL_MISC_DIR})
|
||||
|
||||
if(WINDOWS)
|
||||
if(ARCH_32BITS)
|
||||
install(FILES extlibs/bin/x86/libsndfile-1.dll DESTINATION bin)
|
||||
@ -111,5 +198,9 @@ if(WINDOWS)
|
||||
install(FILES extlibs/bin/x64/openal32.dll DESTINATION bin)
|
||||
endif()
|
||||
elseif(MACOSX)
|
||||
install(DIRECTORY extlibs/libs-osx/Frameworks/sndfile.framework DESTINATION /Library/Frameworks PATTERN ".svn" EXCLUDE)
|
||||
install(DIRECTORY extlibs/libs-osx/Frameworks/sndfile.framework DESTINATION ${CMAKE_INSTALL_FRAMEWORK_PREFIX})
|
||||
|
||||
if(INSTALL_XCODE4_TEMPLATES)
|
||||
install(DIRECTORY xcode/templates/SFML DESTINATION $ENV{HOME}/Library/Developer/Xcode/Templates)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -4,16 +4,19 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
set(WINDOWS 1)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
set(LINUX 1)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
# FreeBSD compile path is the same as Linux
|
||||
set(LINUX 1)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set(MACOSX 1)
|
||||
|
||||
# detect OS X version. (use '/usr/bin/sw_vers -productVersion' to extract V from '10.V.x'.)
|
||||
EXEC_PROGRAM(/usr/bin/sw_vers ARGS -productVersion OUTPUT_VARIABLE MACOSX_VERSION_RAW)
|
||||
STRING(REGEX REPLACE "10\\.([0-9]).*" "\\1" MACOSX_VERSION "${MACOSX_VERSION_RAW}")
|
||||
if(${MACOSX_VERSION} LESS 5)
|
||||
message(WARNING "Unsupported version of OS X : ${MACOSX_VERSION_RAW}")
|
||||
return()
|
||||
endif()
|
||||
set(MACOSX 1)
|
||||
|
||||
# detect OS X version. (use '/usr/bin/sw_vers -productVersion' to extract V from '10.V.x'.)
|
||||
EXEC_PROGRAM(/usr/bin/sw_vers ARGS -productVersion OUTPUT_VARIABLE MACOSX_VERSION_RAW)
|
||||
STRING(REGEX REPLACE "10\\.([0-9]).*" "\\1" MACOSX_VERSION "${MACOSX_VERSION_RAW}")
|
||||
if(${MACOSX_VERSION} LESS 5)
|
||||
message(WARNING "Unsupported version of OS X : ${MACOSX_VERSION_RAW}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
else()
|
||||
message(WARNING "Unsupported operating system")
|
||||
|
@ -133,22 +133,42 @@ macro(sfml_add_library target)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# on Unix systems with gcc 4.x, we must hide public symbols by default
|
||||
# (exported ones are explicitely marked)
|
||||
if((LINUX OR MACOSX) AND COMPILER_GCC)
|
||||
if(${GCC_VERSION} MATCHES "4\\..*")
|
||||
set_target_properties(${target} PROPERTIES COMPILE_FLAGS -fvisibility=hidden)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# link the target to its SFML dependencies
|
||||
if(THIS_DEPENDS)
|
||||
target_link_libraries(${target} ${THIS_DEPENDS})
|
||||
endif()
|
||||
|
||||
# build frameworks or dylibs
|
||||
if(MACOSX AND BUILD_SHARED_LIBS)
|
||||
if(BUILD_FRAMEWORKS)
|
||||
# adapt target to build frameworks instead of dylibs
|
||||
set_target_properties(${target} PROPERTIES
|
||||
FRAMEWORK TRUE
|
||||
FRAMEWORK_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
|
||||
MACOSX_FRAMEWORK_IDENTIFIER org.sfml-dev.${target}
|
||||
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
|
||||
MACOSX_FRAMEWORK_BUNDLE_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
|
||||
endif()
|
||||
|
||||
# adapt install directory to allow distributing dylibs/frameworks in user’s frameworks/application bundle
|
||||
set_target_properties(${target} PROPERTIES
|
||||
BUILD_WITH_INSTALL_RPATH 1
|
||||
INSTALL_NAME_DIR "@executable_path/../Frameworks")
|
||||
endif()
|
||||
|
||||
# link the target to its external dependencies
|
||||
if(THIS_EXTERNAL_LIBS)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
# in shared build, we use the regular linker commands
|
||||
target_link_libraries(${target} ${THIS_EXTERNAL_LIBS})
|
||||
|
||||
if (MACOSX)
|
||||
set_target_properties(${target} PROPERTIES
|
||||
BUILD_WITH_INSTALL_RPATH 1
|
||||
INSTALL_NAME_DIR "@executable_path/../Frameworks")
|
||||
endif()
|
||||
target_link_libraries(${target} ${THIS_EXTERNAL_LIBS})
|
||||
else()
|
||||
# in static build there's no link stage, but with some compilers it is possible to force
|
||||
# the generated static library to directly contain the symbols from its dependencies
|
||||
@ -160,7 +180,8 @@ macro(sfml_add_library target)
|
||||
install(TARGETS ${target}
|
||||
RUNTIME DESTINATION bin COMPONENT bin
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT bin
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT devel)
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT devel
|
||||
FRAMEWORK DESTINATION ${CMAKE_INSTALL_FRAMEWORK_PREFIX} COMPONENT bin)
|
||||
|
||||
endmacro()
|
||||
|
||||
|
@ -12,10 +12,21 @@
|
||||
#
|
||||
# By default, the dynamic libraries of SFML will be found. To find the static ones instead,
|
||||
# you must set the SFML_STATIC_LIBRARIES variable to TRUE before calling find_package(SFML ...).
|
||||
# In case of static linking, the SFML_STATIC macro will also be defined by this script.
|
||||
#
|
||||
# On Mac OS X if SFML_STATIC_LIBRARIES is not set to TRUE then by default CMake will search for frameworks unless
|
||||
# CMAKE_FIND_FRAMEWORK is set to "NEVER" for example. Please refer to CMake documentation for more details.
|
||||
# Moreover, keep in mind that SFML frameworks are only available as release libraries unlike dylibs which
|
||||
# are available for both release and debug modes.
|
||||
#
|
||||
# If SFML is not installed in a standard path, you can use the SFMLDIR CMake variable or environment variable
|
||||
# to tell CMake where SFML is.
|
||||
|
||||
# define the SFML_STATIC macro if static build was chosen
|
||||
if(SFML_STATIC_LIBRARIES)
|
||||
add_definitions(-DSFML_STATIC)
|
||||
endif()
|
||||
|
||||
# deduce the libraries suffix from the options
|
||||
set(FIND_SFML_LIB_SUFFIX "")
|
||||
if(SFML_STATIC_LIBRARIES)
|
||||
|
@ -6,7 +6,9 @@ set(SRC ${SRCROOT}/X11.cpp)
|
||||
|
||||
# find OpenGL, GLU and X11
|
||||
find_package(OpenGL REQUIRED)
|
||||
include_directories(${OPENGL_INCLUDE_DIR})
|
||||
find_package(X11 REQUIRED)
|
||||
include_directories(${X11_INCLUDE_DIR})
|
||||
|
||||
# define the X11 target
|
||||
sfml_add_example(X11 GUI_APP
|
||||
|
@ -6,6 +6,7 @@ set(SRC ${SRCROOT}/OpenGL.cpp)
|
||||
|
||||
# find OpenGL and GLU
|
||||
find_package(OpenGL REQUIRED)
|
||||
include_directories(${OPENGL_INCLUDE_DIR})
|
||||
|
||||
# define the opengl target
|
||||
sfml_add_example(opengl GUI_APP
|
||||
|
@ -6,6 +6,7 @@ set(SRC ${SRCROOT}/Window.cpp)
|
||||
|
||||
# find OpenGL and GLU
|
||||
find_package(OpenGL REQUIRED)
|
||||
include_directories(${OPENGL_INCLUDE_DIR})
|
||||
|
||||
# define the window target
|
||||
sfml_add_example(window GUI_APP
|
||||
|
@ -29,7 +29,6 @@
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Audio/SoundSource.hpp>
|
||||
#include <SFML/System/Resource.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
@ -214,7 +213,7 @@ private :
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
ResourcePtr<SoundBuffer> myBuffer; ///< Sound buffer bound to the source
|
||||
const SoundBuffer* myBuffer; ///< Sound buffer bound to the source
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
@ -29,7 +29,6 @@
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.hpp>
|
||||
#include <SFML/System/Resource.hpp>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
@ -49,7 +48,7 @@ class InputStream;
|
||||
/// \brief Storage for audio samples defining a sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_API SoundBuffer : public Resource<SoundBuffer>
|
||||
class SFML_API SoundBuffer
|
||||
{
|
||||
public :
|
||||
|
||||
@ -200,7 +199,7 @@ public :
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the number of channels used by the sound
|
||||
///
|
||||
/// If the sound is mono then the number ofchannels will
|
||||
/// If the sound is mono then the number of channels will
|
||||
/// be 1, 2 for stereo, etc.
|
||||
///
|
||||
/// \return Number of channels
|
||||
|
@ -284,7 +284,7 @@ private :
|
||||
unsigned int myBuffers[BuffersCount]; ///< Sound buffers used to store temporary audio data
|
||||
unsigned int myChannelsCount; ///< Number of channels (1 = mono, 2 = stereo, ...)
|
||||
unsigned int mySampleRate; ///< Frequency (samples / second)
|
||||
unsigned long myFormat; ///< Format of the internal sound buffers
|
||||
Uint32 myFormat; ///< Format of the internal sound buffers
|
||||
bool myLoop; ///< Loop flag (true to loop, false to play once)
|
||||
Uint64 mySamplesProcessed; ///< Number of buffers processed since beginning of the stream
|
||||
bool myEndBuffers[BuffersCount]; ///< Each buffer is marked as "end buffer" or not, for proper duration calculation
|
||||
|
@ -97,32 +97,50 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
// Define portable import / export macros
|
||||
////////////////////////////////////////////////////////////
|
||||
#if defined(SFML_SYSTEM_WINDOWS) && !defined(SFML_STATIC)
|
||||
#if !defined(SFML_STATIC)
|
||||
|
||||
#ifdef SFML_EXPORTS
|
||||
#if defined(SFML_SYSTEM_WINDOWS)
|
||||
|
||||
// From DLL side, we must export
|
||||
#define SFML_API __declspec(dllexport)
|
||||
#ifdef SFML_EXPORTS
|
||||
|
||||
#else
|
||||
// From DLL side, we must export
|
||||
#define SFML_API __declspec(dllexport)
|
||||
|
||||
// From client application side, we must import
|
||||
#define SFML_API __declspec(dllimport)
|
||||
#else
|
||||
|
||||
#endif
|
||||
// From client application side, we must import
|
||||
#define SFML_API __declspec(dllimport)
|
||||
|
||||
// For Visual C++ compilers, we also need to turn off this annoying C4251 warning.
|
||||
// You can read lots ot different things about it, but the point is the code will
|
||||
// just work fine, and so the simplest way to get rid of this warning is to disable it
|
||||
#ifdef _MSC_VER
|
||||
#endif
|
||||
|
||||
#pragma warning(disable : 4251)
|
||||
// For Visual C++ compilers, we also need to turn off this annoying C4251 warning.
|
||||
// You can read lots ot different things about it, but the point is the code will
|
||||
// just work fine, and so the simplest way to get rid of this warning is to disable it
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#pragma warning(disable : 4251)
|
||||
|
||||
#endif
|
||||
|
||||
#else // Linux, FreeBSD, Mac OS X
|
||||
|
||||
#if __GNUC__ >= 4
|
||||
|
||||
// gcc 4 has special keywords for showing/hidding symbols
|
||||
#define SFML_API __attribute__ ((__visibility__ ("default")))
|
||||
|
||||
#else
|
||||
|
||||
// gcc < 4 has no mechanism to explicitely hide symbols, everything's exported
|
||||
#define SFML_API
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
// Other platforms and static build don't need these export macros
|
||||
// Static build doesn't need these export macros
|
||||
#define SFML_API
|
||||
|
||||
#endif
|
||||
|
@ -28,7 +28,6 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/System/Resource.hpp>
|
||||
#include <SFML/System/Vector2.hpp>
|
||||
#include <SFML/System/String.hpp>
|
||||
#include <SFML/Graphics/Glyph.hpp>
|
||||
@ -47,7 +46,7 @@ class InputStream;
|
||||
/// \brief Class for loading and manipulating character fonts
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_API Font : public Resource<Font>
|
||||
class SFML_API Font
|
||||
{
|
||||
public :
|
||||
|
||||
|
@ -120,8 +120,6 @@ public :
|
||||
/// The supported image formats are bmp, png, tga, jpg, gif,
|
||||
/// psd, hdr and pic. Some format options are not supported,
|
||||
/// like progressive jpeg.
|
||||
/// The maximum size for an image depends on the graphics
|
||||
/// driver and can be retrieve with the GetMaximumSize function.
|
||||
/// If this function fails, the image is left unchanged.
|
||||
///
|
||||
/// \param stream Source stream to read from
|
||||
|
@ -72,7 +72,7 @@ public :
|
||||
/// \param settings Additional settings for the underlying OpenGL context
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderWindow(VideoMode mode, const std::string& title, unsigned long style = Style::Default, const ContextSettings& settings = ContextSettings());
|
||||
RenderWindow(VideoMode mode, const std::string& title, Uint32 style = Style::Default, const ContextSettings& settings = ContextSettings());
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct the window from an existing control
|
||||
|
@ -142,7 +142,7 @@ public :
|
||||
/// \see GetStyle
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetStyle(unsigned long style);
|
||||
void SetStyle(Uint32 style);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the global color of the text
|
||||
@ -206,7 +206,7 @@ public :
|
||||
/// \see SetStyle
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned long GetStyle() const;
|
||||
Uint32 GetStyle() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the global color of the text
|
||||
@ -286,7 +286,7 @@ private :
|
||||
String myString; ///< String to display
|
||||
const Font* myFont; ///< Font used to display the string
|
||||
unsigned int myCharacterSize; ///< Base size of characters, in pixels
|
||||
unsigned long myStyle; ///< Text style (see the Style enum)
|
||||
Uint32 myStyle; ///< Text style (see Style enum)
|
||||
Color myColor; ///< Text color
|
||||
VertexArray myVertices; ///< Vertex array containing the text's geometry
|
||||
FloatRect myBounds; ///< Bounding rectangle of the text (in local coordinates)
|
||||
|
@ -28,9 +28,8 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/System/Resource.hpp>
|
||||
#include <SFML/Window/GlResource.hpp>
|
||||
#include <SFML/Graphics/Image.hpp>
|
||||
#include <SFML/Window/GlResource.hpp>
|
||||
|
||||
|
||||
namespace sf
|
||||
@ -44,7 +43,7 @@ class InputStream;
|
||||
/// \brief Image living on the graphics card that can be used for drawing
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_API Texture : public Resource<Texture>, GlResource
|
||||
class SFML_API Texture : GlResource
|
||||
{
|
||||
public :
|
||||
|
||||
|
@ -369,7 +369,7 @@ public :
|
||||
Response ChangeDirectory(const std::string& directory);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Go to the parent directory of the current one
|
||||
/// \brief Go to the parent directory of the current one
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
|
@ -117,7 +117,7 @@ public :
|
||||
void SetUri(const std::string& uri);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the HTTP version fo the request
|
||||
/// \brief Set the HTTP version for the request
|
||||
///
|
||||
/// The HTTP version is 1.0 by default.
|
||||
///
|
||||
|
@ -94,7 +94,7 @@ public :
|
||||
void SetBlocking(bool blocking);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether the socket is blocking or non-blocking mode
|
||||
/// \brief Tell whether the socket is in blocking or non-blocking mode
|
||||
///
|
||||
/// \return True if the socket is blocking, false otherwise
|
||||
///
|
||||
|
@ -109,7 +109,7 @@ public :
|
||||
Status Connect(const IpAddress& remoteAddress, unsigned short remotePort, Uint32 timeout = 0);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Disconnect the connect from its remote peer
|
||||
/// \brief Disconnect the socket from its remote peer
|
||||
///
|
||||
/// This function gracefully closes the connection. If the
|
||||
/// socket is not connected, this function has no effect.
|
||||
|
@ -38,7 +38,11 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
#if defined(SFML_SYSTEM_WINDOWS)
|
||||
|
||||
#include <windows.h>
|
||||
// The Visual C++ version of gl.h uses WINGDIAPI and APIENTRY but doesn't define them
|
||||
#ifdef _MSC_VER
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
|
@ -37,7 +37,7 @@ namespace sf
|
||||
/// \brief Abstract class for custom file input streams
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
class SFML_API InputStream
|
||||
class InputStream
|
||||
{
|
||||
public :
|
||||
|
||||
|
@ -1,288 +0,0 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// 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_RESOURCE_HPP
|
||||
#define SFML_RESOURCE_HPP
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/System/Lock.hpp>
|
||||
#include <SFML/System/Mutex.hpp>
|
||||
#include <set>
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
// These two classes are defined in the same header because
|
||||
// they depend on each other. And as they're template classes,
|
||||
// they must be entirely defined in header files, which
|
||||
// prevents from proper separate compiling
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
template <typename> class ResourcePtr;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Base class for resources that need to notify
|
||||
/// dependent classes about their destruction
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
class Resource
|
||||
{
|
||||
protected :
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Default constructor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Resource();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Copy constructor
|
||||
///
|
||||
/// \param copy Instance to copy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Resource(const Resource<T>& copy);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destructor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
~Resource();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Assignment operator
|
||||
///
|
||||
/// \param right Instance to assign
|
||||
///
|
||||
/// \return Reference to self
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Resource<T>& operator =(const Resource<T>& right);
|
||||
|
||||
private :
|
||||
|
||||
friend class ResourcePtr<T>;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Connect a ResourcePtr to this resource
|
||||
///
|
||||
/// A connected ResourcePtr will be notified of the
|
||||
/// destruction of this instance.
|
||||
///
|
||||
/// \param observer ResourcePtr to connect
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Connect(ResourcePtr<T>& observer) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Disconnect a ResourcePtr from this resource
|
||||
///
|
||||
/// The disconnected ResourcePtr will no longer be notified
|
||||
/// if this instance is destroyed.
|
||||
///
|
||||
/// \param observer ResourcePtr to disconnect
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Disconnect(ResourcePtr<T>& observer) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
mutable std::set<ResourcePtr<T>*> myObservers; ///< List of pointers to this resource
|
||||
mutable Mutex myMutex; ///< Mutex for preventing concurrent access to the pointer list
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Safe pointer to a sf::Resource<T>
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
class ResourcePtr
|
||||
{
|
||||
public :
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Default constructor
|
||||
///
|
||||
/// A default constructed ResourcePtr is empty (null).
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
ResourcePtr();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct from a raw pointer
|
||||
///
|
||||
/// \param resource Raw pointer to the resource to wrap
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
ResourcePtr(const T* resource);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Copy constructor
|
||||
///
|
||||
/// The new ResourcePtr will share the same resource as \a copy.
|
||||
///
|
||||
/// \param copy Instance to copy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
ResourcePtr(const ResourcePtr<T>& copy);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destructor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
~ResourcePtr();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Assignment operator for a ResourcePtr parameter
|
||||
///
|
||||
/// \param right Instance to assign
|
||||
///
|
||||
/// \return Reference to self
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
ResourcePtr<T>& operator =(const ResourcePtr<T>& right);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Assignment operator for a raw pointer parameter
|
||||
///
|
||||
/// \param resource Resource to assign
|
||||
///
|
||||
/// \return Reference to self
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
ResourcePtr<T>& operator =(const T* resource);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Cast operator to implicitely convert the resource
|
||||
/// pointer to its raw pointer type (T*)
|
||||
///
|
||||
/// This might be dangerous in the general case, but in this context
|
||||
/// it is safe enough to define this operator.
|
||||
///
|
||||
/// \return Read-only pointer to the actual resource
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
operator const T*() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Overload of unary operator *
|
||||
///
|
||||
/// Like raw pointers, applying the * operator returns a
|
||||
/// reference to the pointed object.
|
||||
///
|
||||
/// \return Reference to the pointed resource
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const T& operator *() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Overload of operator ->
|
||||
///
|
||||
/// Like raw pointers, applying the -> operator returns the
|
||||
/// pointed object.
|
||||
///
|
||||
/// \return Pointed resource
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const T* operator ->() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Function called when the observed resource
|
||||
/// is about to be destroyed
|
||||
///
|
||||
/// This functions is called by the destructor of the pointed
|
||||
/// resource. It allows this instance to reset its internal pointer
|
||||
/// when the resource is destroyed, and avoid dangling pointers.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void OnResourceDestroyed();
|
||||
|
||||
private :
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
const T* myResource; /// Pointer to the actual resource
|
||||
};
|
||||
|
||||
#include <SFML/System/Resource.inl>
|
||||
#include <SFML/System/ResourcePtr.inl>
|
||||
|
||||
} // namespace sf
|
||||
|
||||
|
||||
#endif // SFML_RESOURCE_HPP
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \class sf::Resource
|
||||
/// \ingroup system
|
||||
///
|
||||
/// sf::Resource is a base for classes that want to be
|
||||
/// compatible with the sf::ResourcePtr safe pointer.
|
||||
///
|
||||
/// See sf::ResourcePtr for a complete explanation.
|
||||
///
|
||||
/// \see sf::ResourcePtr
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \class sf::ResourcePtr
|
||||
/// \ingroup system
|
||||
///
|
||||
/// sf::ResourcePtr is a special kind of smart pointer for
|
||||
/// resources. Its main feature is to automatically
|
||||
/// reset its internal pointer to 0 when the resource
|
||||
/// gets destroyed, so that pointers to a resource never
|
||||
/// become invalid when the resource is destroyed. Instead,
|
||||
/// it properly returns 0 when the resource no longer exists.
|
||||
///
|
||||
/// Its usage is completely transparent, so that it is similar
|
||||
/// to manipulating the raw resource directly (like any smart pointer).
|
||||
///
|
||||
/// For sf::ResourcePtr<T> to work, T must inherit from
|
||||
/// the sf::Resource class.
|
||||
///
|
||||
/// These two classes are heavily used internally in SFML
|
||||
/// to safely handle resources and the classes that use them:
|
||||
/// \li sf::Texture / sf::Sprite
|
||||
/// \li sf::Font / sf::Text
|
||||
/// \li sf::SoundBuffer / sf::Sound
|
||||
///
|
||||
/// sf::Resource and sf::ResourcePtr are designed for internal use,
|
||||
/// but if you feel like they would fit well in your implementation
|
||||
/// there's no problem to use them.
|
||||
///
|
||||
/// \see sf::Resource
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
@ -1,78 +0,0 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Resource<T>::Resource()
|
||||
{
|
||||
// Nothing to do
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Resource<T>::Resource(const Resource<T>&)
|
||||
{
|
||||
// Nothing to do, we don't want to copy observers
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Resource<T>::~Resource()
|
||||
{
|
||||
// Notify all observers
|
||||
for (typename std::set<ResourcePtr<T>*>::iterator i = myObservers.begin(); i != myObservers.end(); ++i)
|
||||
{
|
||||
(*i)->OnResourceDestroyed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Resource<T>& Resource<T>::operator =(const Resource<T>&)
|
||||
{
|
||||
// Nothing to do, we don't want to copy observers
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
void Resource<T>::Connect(ResourcePtr<T>& observer) const
|
||||
{
|
||||
sf::Lock lock(myMutex);
|
||||
myObservers.insert(&observer);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
void Resource<T>::Disconnect(ResourcePtr<T>& observer) const
|
||||
{
|
||||
sf::Lock lock(myMutex);
|
||||
myObservers.erase(&observer);
|
||||
}
|
@ -1,125 +0,0 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
ResourcePtr<T>::ResourcePtr() :
|
||||
myResource(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
ResourcePtr<T>::ResourcePtr(const T* resource) :
|
||||
myResource(resource)
|
||||
{
|
||||
if (myResource)
|
||||
myResource->Connect(*this);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
ResourcePtr<T>::ResourcePtr(const ResourcePtr<T>& copy) :
|
||||
myResource(copy.myResource)
|
||||
{
|
||||
if (myResource)
|
||||
myResource->Connect(*this);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
ResourcePtr<T>::~ResourcePtr()
|
||||
{
|
||||
if (myResource)
|
||||
myResource->Disconnect(*this);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
ResourcePtr<T>& ResourcePtr<T>::operator =(const ResourcePtr<T>& right)
|
||||
{
|
||||
if (myResource)
|
||||
myResource->Disconnect(*this);
|
||||
|
||||
myResource = right.myResource;
|
||||
|
||||
if (myResource)
|
||||
myResource->Connect(*this);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
ResourcePtr<T>& ResourcePtr<T>::operator =(const T* resource)
|
||||
{
|
||||
if (myResource)
|
||||
myResource->Disconnect(*this);
|
||||
|
||||
myResource = resource;
|
||||
|
||||
if (myResource)
|
||||
myResource->Connect(*this);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
ResourcePtr<T>::operator const T*() const
|
||||
{
|
||||
return myResource;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
const T& ResourcePtr<T>::operator *() const
|
||||
{
|
||||
return *myResource;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
const T* ResourcePtr<T>::operator ->() const
|
||||
{
|
||||
return myResource;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
void ResourcePtr<T>::OnResourceDestroyed()
|
||||
{
|
||||
myResource = NULL;
|
||||
}
|
@ -66,7 +66,7 @@ public :
|
||||
/// void operator()();
|
||||
/// };
|
||||
/// \endcode
|
||||
/// Note: this does *not* run the thread, use Run().
|
||||
/// Note: this does *not* run the thread, use Launch().
|
||||
///
|
||||
/// \param function Functor or free function to use as the entry point of the thread
|
||||
///
|
||||
@ -93,7 +93,7 @@ public :
|
||||
/// void operator()(std::string arg);
|
||||
/// };
|
||||
/// \endcode
|
||||
/// Note: this does *not* run the thread, use Run().
|
||||
/// Note: this does *not* run the thread, use Launch().
|
||||
///
|
||||
/// \param function Functor or free function to use as the entry point of the thread
|
||||
/// \param argument argument to forward to the function
|
||||
@ -116,7 +116,7 @@ public :
|
||||
/// void function();
|
||||
/// };
|
||||
/// \endcode
|
||||
/// Note: this does *not* run the thread, use Run().
|
||||
/// Note: this does *not* run the thread, use Launch().
|
||||
///
|
||||
/// \param function Entry point of the thread
|
||||
/// \param object Pointer to the object to use
|
||||
|
@ -223,7 +223,7 @@ public :
|
||||
/// window.Close();
|
||||
///
|
||||
/// // The escape key was pressed
|
||||
/// if ((event.Type == sf::Event::KeyPressed) && (event.Key.Code == sf::Key::Escape))
|
||||
/// if ((event.Type == sf::Event::KeyPressed) && (event.Key.Code == sf::Keyboard::Escape))
|
||||
/// window.Close();
|
||||
///
|
||||
/// // The window was resized
|
||||
|
@ -85,7 +85,7 @@ public :
|
||||
/// \param settings Additional settings for the underlying OpenGL context
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Window(VideoMode mode, const std::string& title, unsigned long style = Style::Default, const ContextSettings& settings = ContextSettings());
|
||||
Window(VideoMode mode, const std::string& title, Uint32 style = Style::Default, const ContextSettings& settings = ContextSettings());
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct the window from an existing control
|
||||
@ -124,7 +124,7 @@ public :
|
||||
/// \param settings Additional settings for the underlying OpenGL context
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Create(VideoMode mode, const std::string& title, unsigned long style = Style::Default, const ContextSettings& settings = ContextSettings());
|
||||
void Create(VideoMode mode, const std::string& title, Uint32 style = Style::Default, const ContextSettings& settings = ContextSettings());
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create (or recreate) the window from an existing control
|
||||
@ -176,7 +176,7 @@ public :
|
||||
unsigned int GetWidth() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the height of the rendering region of the window
|
||||
/// \brief Get the height of the rendering region of the window
|
||||
///
|
||||
/// The height doesn't include the titlebar and borders
|
||||
/// of the window.
|
||||
|
@ -48,7 +48,7 @@ float Listener::GetGlobalVolume()
|
||||
float volume = 0.f;
|
||||
ALCheck(alGetListenerf(AL_GAIN, &volume));
|
||||
|
||||
return volume;
|
||||
return volume * 100;
|
||||
}
|
||||
|
||||
|
||||
|
@ -139,7 +139,8 @@ void Music::OnSeek(Uint32 timeOffset)
|
||||
void Music::Initialize()
|
||||
{
|
||||
// Compute the music duration
|
||||
myDuration = static_cast<Uint32>(1000 * myFile->GetSamplesCount() / myFile->GetSampleRate() / myFile->GetChannelsCount());
|
||||
Uint64 samples = myFile->GetSamplesCount();
|
||||
myDuration = static_cast<Uint32>(1000 * samples / myFile->GetSampleRate() / myFile->GetChannelsCount());
|
||||
|
||||
// Resize the internal buffer so that it can contain 1 second of audio samples
|
||||
mySamples.resize(myFile->GetSampleRate() * myFile->GetChannelsCount());
|
||||
|
@ -33,7 +33,8 @@
|
||||
namespace sf
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
Sound::Sound()
|
||||
Sound::Sound() :
|
||||
myBuffer(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -50,11 +50,10 @@ myDuration(0)
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
SoundBuffer::SoundBuffer(const SoundBuffer& copy) :
|
||||
Resource<SoundBuffer>(),
|
||||
myBuffer (0),
|
||||
mySamples (copy.mySamples),
|
||||
myDuration (copy.myDuration),
|
||||
mySounds () // don't copy the attached sounds
|
||||
myBuffer (0),
|
||||
mySamples (copy.mySamples),
|
||||
myDuration(copy.myDuration),
|
||||
mySounds () // don't copy the attached sounds
|
||||
{
|
||||
// Create the buffer
|
||||
ALCheck(alGenBuffers(1, &myBuffer));
|
||||
|
@ -86,7 +86,7 @@ if(MACOSX)
|
||||
endif()
|
||||
|
||||
# add include paths of external libraries
|
||||
include_directories(${FREETYPE_INCLUDE_DIRS} ${GLEW_INCLUDE_PATH} ${JPEG_INCLUDE_DIR})
|
||||
include_directories(${FREETYPE_INCLUDE_DIRS} ${GLEW_INCLUDE_PATH} ${JPEG_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
|
||||
|
||||
# build the list of libraries to link
|
||||
# GL and X11 are only needed for shared build, as they are already linked by sfml-window
|
||||
|
@ -46,7 +46,7 @@ namespace
|
||||
unsigned long Read(FT_Stream rec, unsigned long offset, unsigned char* buffer, unsigned long count)
|
||||
{
|
||||
sf::InputStream* stream = static_cast<sf::InputStream*>(rec->descriptor.pointer);
|
||||
if (stream->Seek(offset) == offset)
|
||||
if (static_cast<unsigned long>(stream->Seek(offset)) == offset)
|
||||
{
|
||||
if (count > 0)
|
||||
return static_cast<unsigned long>(stream->Read(reinterpret_cast<char*>(buffer), count));
|
||||
@ -77,7 +77,6 @@ myRefCount (NULL)
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
Font::Font(const Font& copy) :
|
||||
Resource<Font>(),
|
||||
myLibrary (copy.myLibrary),
|
||||
myFace (copy.myFace),
|
||||
myStreamRec (copy.myStreamRec),
|
||||
@ -339,7 +338,7 @@ const Font& Font::GetDefaultFont()
|
||||
// Load the default font on first call
|
||||
if (!loaded)
|
||||
{
|
||||
static const char data[] =
|
||||
static const signed char data[] =
|
||||
{
|
||||
#include <SFML/Graphics/Arial.hpp>
|
||||
};
|
||||
|
@ -39,7 +39,7 @@ RenderWindow::RenderWindow()
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderWindow::RenderWindow(VideoMode mode, const std::string& title, unsigned long style, const ContextSettings& settings)
|
||||
RenderWindow::RenderWindow(VideoMode mode, const std::string& title, Uint32 style, const ContextSettings& settings)
|
||||
{
|
||||
// Don't call the base class constructor because it contains virtual function calls
|
||||
Create(mode, title, style, settings);
|
||||
|
@ -96,6 +96,7 @@ bool Shader::LoadFromFile(const std::string& filename)
|
||||
}
|
||||
|
||||
// Read the shader code from the file
|
||||
myFragmentShader.clear();
|
||||
std::string line;
|
||||
while (std::getline(file, line))
|
||||
myFragmentShader += line + "\n";
|
||||
|
@ -90,7 +90,7 @@ void Text::SetCharacterSize(unsigned int size)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void Text::SetStyle(unsigned long style)
|
||||
void Text::SetStyle(Uint32 style)
|
||||
{
|
||||
if (myStyle != style)
|
||||
{
|
||||
@ -135,7 +135,7 @@ unsigned int Text::GetCharacterSize() const
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned long Text::GetStyle() const
|
||||
Uint32 Text::GetStyle() const
|
||||
{
|
||||
return myStyle;
|
||||
}
|
||||
|
@ -53,7 +53,6 @@ myPixelsFlipped(false)
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
Texture::Texture(const Texture& copy) :
|
||||
Resource<Texture>(),
|
||||
myWidth (0),
|
||||
myHeight (0),
|
||||
myTextureWidth (0),
|
||||
@ -63,7 +62,8 @@ myIsSmooth (copy.myIsSmooth),
|
||||
myIsRepeated (copy.myIsRepeated),
|
||||
myPixelsFlipped(false)
|
||||
{
|
||||
LoadFromImage(copy.CopyToImage());
|
||||
if (copy.myTexture)
|
||||
LoadFromImage(copy.CopyToImage());
|
||||
}
|
||||
|
||||
|
||||
@ -189,19 +189,19 @@ bool Texture::LoadFromImage(const Image& image, const IntRect& area)
|
||||
IntRect rectangle = area;
|
||||
if (rectangle.Left < 0) rectangle.Left = 0;
|
||||
if (rectangle.Top < 0) rectangle.Top = 0;
|
||||
if (rectangle.Width > width) rectangle.Width = width;
|
||||
if (rectangle.Height > height) rectangle.Height = height;
|
||||
if (rectangle.Left + rectangle.Width > width) rectangle.Width = width - rectangle.Left;
|
||||
if (rectangle.Top + rectangle.Height > height) rectangle.Height = height - rectangle.Top;
|
||||
|
||||
// Create the texture and upload the pixels
|
||||
if (Create(rectangle.Width, rectangle.Height))
|
||||
{
|
||||
// Copy the pixels to the texture, row by row
|
||||
const Uint8* pixels = image.GetPixelsPtr() + rectangle.Left + (width * rectangle.Top);
|
||||
const Uint8* pixels = image.GetPixelsPtr() + 4 * (rectangle.Left + (width * rectangle.Top));
|
||||
GLCheck(glBindTexture(GL_TEXTURE_2D, myTexture));
|
||||
for (int i = 0; i < rectangle.Height; ++i)
|
||||
{
|
||||
GLCheck(glTexSubImage2D(GL_TEXTURE_2D, 0, 0, i, myWidth, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels));
|
||||
pixels += width;
|
||||
pixels += 4 * width;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -139,13 +139,13 @@ IpAddress IpAddress::GetLocalAddress()
|
||||
return localAddress;
|
||||
|
||||
// Connect the socket to localhost on any port
|
||||
sockaddr_in address = priv::SocketImpl::CreateAddress(INADDR_LOOPBACK, 0);
|
||||
sockaddr_in address = priv::SocketImpl::CreateAddress(ntohl(INADDR_LOOPBACK), 0);
|
||||
if (connect(sock, reinterpret_cast<sockaddr*>(&address), sizeof(address)) == -1)
|
||||
{
|
||||
priv::SocketImpl::Close(sock);
|
||||
return localAddress;
|
||||
}
|
||||
|
||||
|
||||
// Get the local address of the socket connection
|
||||
priv::SocketImpl::AddrLength size = sizeof(address);
|
||||
if (getsockname(sock, reinterpret_cast<sockaddr*>(&address), &size) == -1)
|
||||
|
@ -277,7 +277,7 @@ Socket::Status TcpSocket::Send(Packet& packet)
|
||||
const char* data = packet.OnSend(size);
|
||||
|
||||
// First send the packet size
|
||||
Uint32 packetSize = htonl(static_cast<unsigned long>(size));
|
||||
Uint32 packetSize = htonl(static_cast<Uint32>(size));
|
||||
Status status = Send(reinterpret_cast<const char*>(&packetSize), sizeof(packetSize));
|
||||
|
||||
// Make sure that the size was properly sent
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <SFML/Network/Unix/SocketImpl.hpp>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
namespace sf
|
||||
@ -36,10 +36,10 @@ namespace sf
|
||||
namespace priv
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
sockaddr_in SocketImpl::CreateAddress(unsigned long address, unsigned short port)
|
||||
sockaddr_in SocketImpl::CreateAddress(Uint32 address, unsigned short port)
|
||||
{
|
||||
sockaddr_in addr;
|
||||
memset(addr.sin_zero, 0, sizeof(addr.sin_zero));
|
||||
std::memset(addr.sin_zero, 0, sizeof(addr.sin_zero));
|
||||
addr.sin_addr.s_addr = htonl(address);
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(port);
|
||||
|
@ -65,7 +65,7 @@ public :
|
||||
/// \return sockaddr_in ready to be used by socket functions
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static sockaddr_in CreateAddress(unsigned long address, unsigned short port);
|
||||
static sockaddr_in CreateAddress(Uint32 address, unsigned short port);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the value of the invalid socket
|
||||
|
@ -34,7 +34,7 @@ namespace sf
|
||||
namespace priv
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
sockaddr_in SocketImpl::CreateAddress(unsigned long address, unsigned short port)
|
||||
sockaddr_in SocketImpl::CreateAddress(Uint32 address, unsigned short port)
|
||||
{
|
||||
sockaddr_in addr;
|
||||
std::memset(addr.sin_zero, 0, sizeof(addr.sin_zero));
|
||||
@ -63,7 +63,7 @@ void SocketImpl::Close(SocketHandle sock)
|
||||
////////////////////////////////////////////////////////////
|
||||
void SocketImpl::SetBlocking(SocketHandle sock, bool block)
|
||||
{
|
||||
unsigned long blocking = block ? 0 : 1;
|
||||
u_long blocking = block ? 0 : 1;
|
||||
ioctlsocket(sock, FIONBIO, &blocking);
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ public :
|
||||
/// \return sockaddr_in ready to be used by socket functions
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static sockaddr_in CreateAddress(unsigned long address, unsigned short port);
|
||||
static sockaddr_in CreateAddress(Uint32 address, unsigned short port);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the value of the invalid socket
|
||||
|
@ -14,9 +14,6 @@ set(SRC
|
||||
${INCROOT}/Mutex.hpp
|
||||
${INCROOT}/NonCopyable.hpp
|
||||
${SRCROOT}/Platform.hpp
|
||||
${INCROOT}/Resource.hpp
|
||||
${INCROOT}/Resource.inl
|
||||
${INCROOT}/ResourcePtr.inl
|
||||
${SRCROOT}/Sleep.cpp
|
||||
${INCROOT}/Sleep.hpp
|
||||
${SRCROOT}/String.cpp
|
||||
|
@ -1,86 +0,0 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Lucas Soltic (ceylow@gmail.com) and Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// 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/Config.hpp>
|
||||
|
||||
|
||||
#ifdef SFML_SYSTEM_MACOS
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
|
||||
namespace sf
|
||||
{
|
||||
namespace priv
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Under Mac OS X, when launching an application from the Finder,
|
||||
/// the default working directory is the user home directory ;
|
||||
/// when launching from Xcode, the default one is the directory
|
||||
/// containing the application. In order to produce a uniform behaviour
|
||||
/// and simplify the use of resources, SFML sets the working directory to
|
||||
/// the Resources folder of the application bundle.
|
||||
/// The "constructor" attribute forces the function to be called
|
||||
/// at library loading time.
|
||||
////////////////////////////////////////////////////////////
|
||||
void InitializeWorkingDirectory(void) __attribute__ ((constructor));
|
||||
void InitializeWorkingDirectory(void)
|
||||
{
|
||||
char PathBuffer[4096];
|
||||
bool Encoded = false;
|
||||
|
||||
// Get the application bundle
|
||||
CFBundleRef MainBundle = CFBundleGetMainBundle();
|
||||
assert(MainBundle != NULL);
|
||||
|
||||
// Get the resource directory URL
|
||||
CFURLRef ResourceDirectory = CFBundleCopyResourcesDirectoryURL(MainBundle);
|
||||
assert(ResourceDirectory != NULL);
|
||||
|
||||
// Convert it as absolute URL
|
||||
CFURLRef AbsoluteURL = CFURLCopyAbsoluteURL(ResourceDirectory);
|
||||
assert(AbsoluteURL != NULL);
|
||||
|
||||
// Get the path as C string
|
||||
Encoded = CFURLGetFileSystemRepresentation(AbsoluteURL, true, (UInt8 *)PathBuffer, 4096);
|
||||
assert(Encoded);
|
||||
|
||||
// Set the working directory
|
||||
chdir(PathBuffer);
|
||||
|
||||
CFRelease(AbsoluteURL);
|
||||
CFRelease(ResourceDirectory);
|
||||
}
|
||||
|
||||
} // namespace priv
|
||||
|
||||
} // namespace sf
|
||||
|
||||
|
||||
#endif // SFML_SYSTEM_MACOS
|
||||
|
@ -66,13 +66,13 @@ else() # MACOSX
|
||||
${SRCROOT}/OSX/cpp_objc_conversion.h
|
||||
${SRCROOT}/OSX/cpp_objc_conversion.mm
|
||||
${SRCROOT}/OSX/cg_sf_conversion.hpp
|
||||
${SRCROOT}/OSX/cg_sf_conversion.cpp
|
||||
${SRCROOT}/OSX/cg_sf_conversion.cpp
|
||||
${SRCROOT}/OSX/InputImpl.mm
|
||||
${SRCROOT}/OSX/InputImpl.hpp
|
||||
${SRCROOT}/OSX/HIDInputManager.hpp
|
||||
${SRCROOT}/OSX/HIDInputManager.mm
|
||||
${SRCROOT}/OSX/HIDJoystickManager.hpp
|
||||
${SRCROOT}/OSX/HIDJoystickManager.cpp
|
||||
${SRCROOT}/OSX/InputImpl.hpp
|
||||
${SRCROOT}/OSX/HIDInputManager.hpp
|
||||
${SRCROOT}/OSX/HIDInputManager.mm
|
||||
${SRCROOT}/OSX/HIDJoystickManager.hpp
|
||||
${SRCROOT}/OSX/HIDJoystickManager.cpp
|
||||
${SRCROOT}/OSX/JoystickImpl.cpp
|
||||
${SRCROOT}/OSX/JoystickImpl.hpp
|
||||
${SRCROOT}/OSX/SFApplication.h
|
||||
@ -98,8 +98,13 @@ endif()
|
||||
|
||||
# find external libraries
|
||||
find_package(OpenGL REQUIRED)
|
||||
include_directories(${OPENGL_INCLUDE_DIR})
|
||||
if(LINUX)
|
||||
find_package(X11 REQUIRED)
|
||||
if(NOT X11_Xrandr_FOUND)
|
||||
message(FATAL_ERROR "Xrandr library not found")
|
||||
endif()
|
||||
include_directories(${X11_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
# build the list of external libraries to link
|
||||
|
@ -37,7 +37,7 @@
|
||||
namespace
|
||||
{
|
||||
// OpenGL resources counter and its mutex
|
||||
unsigned long count = 0;
|
||||
unsigned int count = 0;
|
||||
sf::Mutex mutex;
|
||||
}
|
||||
|
||||
|
@ -41,3 +41,11 @@ void RetainPool(void);
|
||||
////////////////////////////////////////////////////////////
|
||||
void ReleasePool(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Drain the pool.
|
||||
///
|
||||
/// ReleasePool must be called at least once before DrainPool.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void DrainPool();
|
||||
|
||||
|
@ -84,6 +84,12 @@ public :
|
||||
////////////////////////////////////////////////////////////
|
||||
void Release();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Drain the pool
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Drain();
|
||||
|
||||
private:
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -109,12 +115,12 @@ PoolWrapper::~PoolWrapper()
|
||||
#ifdef SFML_DEBUG
|
||||
if (count < 0) {
|
||||
sf::Err() << "~PoolWrapper : count is less than zero! "
|
||||
"You called ReleasePool from a thread too many times."
|
||||
<< std::endl;
|
||||
"You called ReleasePool from a thread too many times."
|
||||
<< std::endl;
|
||||
} else if (count > 0) {
|
||||
sf::Err() << "~PoolWrapper : count is greater than zero! "
|
||||
"You called ReleasePool from a thread to few times."
|
||||
<< std::endl;
|
||||
"You called ReleasePool from a thread to few times."
|
||||
<< std::endl;
|
||||
} else { // count == 0
|
||||
sf::Err() << "~PoolWrapper is HAPPY!" << std::endl;
|
||||
}
|
||||
@ -149,8 +155,7 @@ void PoolWrapper::Release()
|
||||
|
||||
// Drain pool if required.
|
||||
if (count == 0) {
|
||||
[pool drain];
|
||||
pool = 0;
|
||||
Drain();
|
||||
}
|
||||
|
||||
#ifdef SFML_DEBUG
|
||||
@ -160,6 +165,16 @@ void PoolWrapper::Release()
|
||||
#endif
|
||||
}
|
||||
|
||||
void PoolWrapper::Drain()
|
||||
{
|
||||
[pool drain];
|
||||
pool = 0;
|
||||
|
||||
if (count != 0) {
|
||||
pool = [[NSAutoreleasePool alloc] init];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace priv
|
||||
|
||||
@ -207,3 +222,18 @@ void ReleasePool(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void DrainPool()
|
||||
{
|
||||
if (localPool != NULL) {
|
||||
localPool->Drain();
|
||||
}
|
||||
#ifdef SFML_DEBUG
|
||||
else {
|
||||
sf::Err() << "ReleasePool must be called at least one before DrainPool"
|
||||
<< std::endl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,17 @@
|
||||
#include <SFML/Window/OSX/HIDJoystickManager.hpp>
|
||||
#include <SFML/Window/OSX/HIDInputManager.hpp>
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Private data
|
||||
////////////////////////////////////////////////////////////
|
||||
namespace
|
||||
{
|
||||
// Using a custom run loop mode solve some issues that appears when SFML
|
||||
// is used with Cocoa.
|
||||
CFStringRef const runLoopMode = CFSTR("SFML_RUN_LOOP_MODE");
|
||||
}
|
||||
|
||||
|
||||
namespace sf
|
||||
{
|
||||
namespace priv
|
||||
@ -74,7 +85,7 @@ HIDJoystickManager::HIDJoystickManager()
|
||||
|
||||
IOHIDManagerScheduleWithRunLoop(myHIDManager,
|
||||
CFRunLoopGetCurrent(),
|
||||
kCFRunLoopDefaultMode);
|
||||
runLoopMode);
|
||||
|
||||
IOHIDManagerOpen(myHIDManager, kIOHIDOptionsTypeNone);
|
||||
}
|
||||
@ -85,7 +96,7 @@ HIDJoystickManager::~HIDJoystickManager()
|
||||
{
|
||||
IOHIDManagerUnscheduleFromRunLoop(myHIDManager,
|
||||
CFRunLoopGetCurrent(),
|
||||
kCFRunLoopDefaultMode);
|
||||
runLoopMode);
|
||||
|
||||
IOHIDManagerRegisterDeviceMatchingCallback(myHIDManager, NULL, 0);
|
||||
IOHIDManagerRegisterDeviceRemovalCallback(myHIDManager, NULL, 0);
|
||||
@ -100,7 +111,7 @@ void HIDJoystickManager::Update()
|
||||
SInt32 status = kCFRunLoopRunHandledSource;
|
||||
|
||||
while (status == kCFRunLoopRunHandledSource) {
|
||||
status = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, true);
|
||||
status = CFRunLoopRunInMode(runLoopMode, 0, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,20 +39,22 @@ namespace priv
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
SFContext::SFContext(SFContext* shared)
|
||||
: myView(0), myWindow(0)
|
||||
: myView(0), myWindow(0)
|
||||
{
|
||||
// Ask for a pool.
|
||||
RetainPool();
|
||||
|
||||
// Create the context
|
||||
CreateContext(shared, VideoMode::GetDesktopMode().BitsPerPixel, ContextSettings(0, 0, 0));
|
||||
CreateContext(shared,
|
||||
VideoMode::GetDesktopMode().BitsPerPixel,
|
||||
ContextSettings(0, 0, 0));
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
SFContext::SFContext(SFContext* shared, const ContextSettings& settings,
|
||||
const WindowImpl* owner, unsigned int bitsPerPixel)
|
||||
: myView(0), myWindow(0)
|
||||
: myView(0), myWindow(0)
|
||||
{
|
||||
// Ask for a pool.
|
||||
RetainPool();
|
||||
@ -68,7 +70,7 @@ SFContext::SFContext(SFContext* shared, const ContextSettings& settings,
|
||||
|
||||
SFContext::SFContext(SFContext* shared, const ContextSettings& settings,
|
||||
unsigned int width, unsigned int height)
|
||||
: myView(0), myWindow(0)
|
||||
: myView(0), myWindow(0)
|
||||
{
|
||||
// Ensure the process is setup in order to create a valid window.
|
||||
WindowImplCocoa::SetUpProcess();
|
||||
|
@ -286,6 +286,9 @@ NSUInteger KeepOnlyMaskFromData(NSUInteger data, NSUInteger mask);
|
||||
{
|
||||
// Forward to...
|
||||
[self otherMouseDown:theEvent];
|
||||
|
||||
// Transmit to non-SFML responder
|
||||
[[self nextResponder] mouseDown:theEvent];
|
||||
}
|
||||
|
||||
|
||||
@ -294,6 +297,9 @@ NSUInteger KeepOnlyMaskFromData(NSUInteger data, NSUInteger mask);
|
||||
{
|
||||
// Forward to...
|
||||
[self otherMouseUp:theEvent];
|
||||
|
||||
// Transmit to non-SFML responder
|
||||
[[self nextResponder] mouseUp:theEvent];
|
||||
}
|
||||
|
||||
|
||||
@ -302,17 +308,23 @@ NSUInteger KeepOnlyMaskFromData(NSUInteger data, NSUInteger mask);
|
||||
{
|
||||
// Forward to...
|
||||
[self otherMouseDragged:theEvent];
|
||||
|
||||
// Transmit to non-SFML responder
|
||||
[[self nextResponder] mouseMoved:theEvent];
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(void)scrollWheel:(NSEvent *)theEvent
|
||||
{
|
||||
if (myRequester == 0) return;
|
||||
if (myRequester != 0) {
|
||||
NSPoint loc = [self cursorPositionFromEvent:theEvent];
|
||||
|
||||
myRequester->MouseWheelScrolledAt([theEvent deltaY], loc.x, loc.y);
|
||||
}
|
||||
|
||||
NSPoint loc = [self cursorPositionFromEvent:theEvent];
|
||||
|
||||
myRequester->MouseWheelScrolledAt([theEvent deltaY], loc.x, loc.y);
|
||||
// Transmit to non-SFML responder
|
||||
[[self nextResponder] scrollWheel:theEvent];
|
||||
}
|
||||
|
||||
|
||||
@ -343,6 +355,9 @@ NSUInteger KeepOnlyMaskFromData(NSUInteger data, NSUInteger mask);
|
||||
{
|
||||
// Forward to...
|
||||
[self otherMouseDown:theEvent];
|
||||
|
||||
// Transmit to non-SFML responder
|
||||
[[self nextResponder] rightMouseDown:theEvent];
|
||||
}
|
||||
|
||||
|
||||
@ -351,46 +366,51 @@ NSUInteger KeepOnlyMaskFromData(NSUInteger data, NSUInteger mask);
|
||||
{
|
||||
// Forward to...
|
||||
[self otherMouseUp:theEvent];
|
||||
|
||||
// Transmit to non-SFML responder
|
||||
[[self nextResponder] rightMouseUp:theEvent];
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(void)otherMouseDown:(NSEvent *)theEvent
|
||||
{
|
||||
if (myRequester == 0) return;
|
||||
|
||||
NSPoint loc = [self cursorPositionFromEvent:theEvent];
|
||||
|
||||
sf::Mouse::Button button = [self mouseButtonFromEvent:theEvent];
|
||||
|
||||
if (button != sf::Mouse::ButtonCount) {
|
||||
myRequester->MouseDownAt(button, loc.x, loc.y);
|
||||
if (myRequester != 0) {
|
||||
NSPoint loc = [self cursorPositionFromEvent:theEvent];
|
||||
|
||||
if (button != sf::Mouse::ButtonCount) {
|
||||
myRequester->MouseDownAt(button, loc.x, loc.y);
|
||||
}
|
||||
}
|
||||
|
||||
// If the event is not forwarded by mouseDown or rightMouseDown...
|
||||
if (button != sf::Mouse::Left && button != sf::Mouse::Right) {
|
||||
// ... transmit to non-SFML responder
|
||||
[[self nextResponder] otherMouseDown:theEvent];
|
||||
}
|
||||
//#ifdef SFML_DEBUG
|
||||
// else {
|
||||
// sf::Err() << "Unknown mouse button released." << std::endl;
|
||||
// }
|
||||
//#endif
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(void)otherMouseUp:(NSEvent *)theEvent
|
||||
{
|
||||
if (myRequester == 0) return;
|
||||
|
||||
NSPoint loc = [self cursorPositionFromEvent:theEvent];
|
||||
|
||||
sf::Mouse::Button button = [self mouseButtonFromEvent:theEvent];
|
||||
|
||||
if (button != sf::Mouse::ButtonCount) {
|
||||
myRequester->MouseUpAt(button, loc.x, loc.y);
|
||||
if (myRequester != 0) {
|
||||
NSPoint loc = [self cursorPositionFromEvent:theEvent];
|
||||
|
||||
if (button != sf::Mouse::ButtonCount) {
|
||||
myRequester->MouseUpAt(button, loc.x, loc.y);
|
||||
}
|
||||
}
|
||||
|
||||
// If the event is not forwarded by mouseUp or rightMouseUp...
|
||||
if (button != sf::Mouse::Left && button != sf::Mouse::Right) {
|
||||
// ... transmit to non-SFML responder
|
||||
[[self nextResponder] otherMouseUp:theEvent];
|
||||
}
|
||||
//#ifdef SFML_DEBUG
|
||||
// else {
|
||||
// sf::Err() << "Unknown mouse button released." << std::endl;
|
||||
// }
|
||||
//#endif
|
||||
}
|
||||
|
||||
|
||||
@ -399,6 +419,9 @@ NSUInteger KeepOnlyMaskFromData(NSUInteger data, NSUInteger mask);
|
||||
{
|
||||
// Forward to...
|
||||
[self otherMouseDragged:theEvent];
|
||||
|
||||
// Transmit to non-SFML responder
|
||||
[[self nextResponder] rightMouseDragged:theEvent];
|
||||
}
|
||||
|
||||
|
||||
@ -407,20 +430,30 @@ NSUInteger KeepOnlyMaskFromData(NSUInteger data, NSUInteger mask);
|
||||
{
|
||||
// Forward to...
|
||||
[self otherMouseDragged:theEvent];
|
||||
|
||||
// Transmit to non-SFML responder
|
||||
[[self nextResponder] mouseDragged:theEvent];
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(void)otherMouseDragged:(NSEvent *)theEvent
|
||||
{
|
||||
if (myRequester == 0) return;
|
||||
if (myRequester != 0) {
|
||||
// If the event is not useful.
|
||||
if (!myMouseIsIn) return;
|
||||
|
||||
NSPoint loc = [self cursorPositionFromEvent:theEvent];
|
||||
|
||||
myRequester->MouseMovedAt(loc.x, loc.y);
|
||||
}
|
||||
|
||||
// If the event is not useful.
|
||||
if (!myMouseIsIn) return;
|
||||
|
||||
NSPoint loc = [self cursorPositionFromEvent:theEvent];
|
||||
|
||||
myRequester->MouseMovedAt(loc.x, loc.y);
|
||||
// If the event is not forwarded by mouseDragged or rightMouseDragged...
|
||||
sf::Mouse::Button button = [self mouseButtonFromEvent:theEvent];
|
||||
if (button != sf::Mouse::Left && button != sf::Mouse::Right) {
|
||||
// ... transmit to non-SFML responder
|
||||
[[self nextResponder] otherMouseUp:theEvent];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -471,6 +504,9 @@ NSUInteger KeepOnlyMaskFromData(NSUInteger data, NSUInteger mask);
|
||||
////////////////////////////////////////////////////////
|
||||
-(void)keyDown:(NSEvent *)theEvent
|
||||
{
|
||||
// Transmit to non-SFML responder
|
||||
[[self nextResponder] keyDown:theEvent];
|
||||
|
||||
if (myRequester == 0) return;
|
||||
|
||||
// Handle key down event
|
||||
@ -484,11 +520,13 @@ NSUInteger KeepOnlyMaskFromData(NSUInteger data, NSUInteger mask);
|
||||
|
||||
|
||||
// Handle text entred event
|
||||
// We create a new event without command modifiers
|
||||
// We create a new event without command/ctrl modifiers
|
||||
// to prevent the OS from sending an alert
|
||||
NSUInteger modifiers = [theEvent modifierFlags] & NSCommandKeyMask
|
||||
? [theEvent modifierFlags] & ~NSCommandKeyMask
|
||||
: [theEvent modifierFlags];
|
||||
NSUInteger modifiers = [theEvent modifierFlags];
|
||||
|
||||
if (modifiers & NSCommandKeyMask) modifiers = modifiers & ~NSCommandKeyMask;
|
||||
if (modifiers & NSControlKeyMask) modifiers = modifiers & ~NSControlKeyMask;
|
||||
|
||||
NSEvent* ev = [NSEvent keyEventWithType:NSKeyDown
|
||||
location:[theEvent locationInWindow]
|
||||
modifierFlags:modifiers
|
||||
@ -526,6 +564,9 @@ NSUInteger KeepOnlyMaskFromData(NSUInteger data, NSUInteger mask);
|
||||
////////////////////////////////////////////////////////
|
||||
-(void)keyUp:(NSEvent *)theEvent
|
||||
{
|
||||
// Transmit to non-SFML responder
|
||||
[[self nextResponder] keyUp:theEvent];
|
||||
|
||||
if (myRequester == 0) return;
|
||||
|
||||
sf::Event::KeyEvent key = [SFOpenGLView convertNSKeyEventToSFMLEvent:theEvent];
|
||||
@ -539,6 +580,9 @@ NSUInteger KeepOnlyMaskFromData(NSUInteger data, NSUInteger mask);
|
||||
////////////////////////////////////////////////////////
|
||||
-(void)flagsChanged:(NSEvent *)theEvent
|
||||
{
|
||||
// Transmit to non-SFML responder
|
||||
[[self nextResponder] flagsChanged:theEvent];
|
||||
|
||||
if (myRequester == 0) return;
|
||||
|
||||
NSUInteger modifiers = [theEvent modifierFlags];
|
||||
|
@ -32,14 +32,28 @@
|
||||
@implementation SFWindow
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(BOOL)acceptsFirstResponder {
|
||||
-(BOOL)acceptsFirstResponder
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(BOOL)canBecomeKeyWindow {
|
||||
-(BOOL)canBecomeKeyWindow
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(void)keyDown:(NSEvent *)theEvent
|
||||
{
|
||||
// Do nothing except preventing a system alert each time a key is pressed
|
||||
//
|
||||
// Special Consideration :
|
||||
// -----------------------
|
||||
// Consider overriding NSResponder -keyDown: message in a Cocoa view/window
|
||||
// that contains a SFML rendering area. Doing so will prevent a system
|
||||
// alert to be thrown everytime the user presses a key.
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -311,7 +311,8 @@ private:
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowImplDelegateRef myDelegate; ///< Implementation in Obj-C.
|
||||
WindowImplDelegateRef myDelegate; ///< Implementation in Obj-C.
|
||||
bool myShowCursor; ///< Is the cursor displayed or hidden ?
|
||||
};
|
||||
|
||||
} // namespace priv
|
||||
|
@ -44,7 +44,8 @@ namespace priv
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowImplCocoa::WindowImplCocoa(WindowHandle handle)
|
||||
{
|
||||
: myShowCursor(true)
|
||||
{
|
||||
// Ask for a pool.
|
||||
RetainPool();
|
||||
|
||||
@ -91,6 +92,7 @@ WindowImplCocoa::WindowImplCocoa(WindowHandle handle)
|
||||
WindowImplCocoa::WindowImplCocoa(VideoMode mode,
|
||||
const std::string& title,
|
||||
unsigned long style)
|
||||
: myShowCursor(true)
|
||||
{
|
||||
// Transform the app process.
|
||||
SetUpProcess();
|
||||
@ -116,6 +118,10 @@ WindowImplCocoa::~WindowImplCocoa()
|
||||
[myDelegate release];
|
||||
|
||||
ReleasePool();
|
||||
|
||||
DrainPool(); // Make sure everything was freed
|
||||
// This solve some issue when sf::Window::Create is called for the
|
||||
// second time (nothing was render until the function was called again)
|
||||
}
|
||||
|
||||
|
||||
@ -183,6 +189,10 @@ void WindowImplCocoa::WindowResized(unsigned int width, unsigned int height)
|
||||
////////////////////////////////////////////////////////////
|
||||
void WindowImplCocoa::WindowLostFocus(void)
|
||||
{
|
||||
if (!myShowCursor) {
|
||||
[myDelegate showMouseCursor]; // Make sur the cursor is visible
|
||||
}
|
||||
|
||||
Event event;
|
||||
event.Type = Event::LostFocus;
|
||||
|
||||
@ -193,6 +203,10 @@ void WindowImplCocoa::WindowLostFocus(void)
|
||||
////////////////////////////////////////////////////////////
|
||||
void WindowImplCocoa::WindowGainedFocus(void)
|
||||
{
|
||||
if (!myShowCursor) {
|
||||
[myDelegate hideMouseCursor]; // Restore user's setting
|
||||
}
|
||||
|
||||
Event event;
|
||||
event.Type = Event::GainedFocus;
|
||||
|
||||
@ -255,6 +269,10 @@ void WindowImplCocoa::MouseWheelScrolledAt(float delta, int x, int y)
|
||||
////////////////////////////////////////////////////////////
|
||||
void WindowImplCocoa::MouseMovedIn(void)
|
||||
{
|
||||
if (!myShowCursor) {
|
||||
[myDelegate hideMouseCursor]; // Restore user's setting
|
||||
}
|
||||
|
||||
Event event;
|
||||
event.Type = Event::MouseEntered;
|
||||
|
||||
@ -264,6 +282,10 @@ void WindowImplCocoa::MouseMovedIn(void)
|
||||
////////////////////////////////////////////////////////////
|
||||
void WindowImplCocoa::MouseMovedOut(void)
|
||||
{
|
||||
if (!myShowCursor) {
|
||||
[myDelegate showMouseCursor]; // Make sur the cursor is visible
|
||||
}
|
||||
|
||||
Event event;
|
||||
event.Type = Event::MouseLeft;
|
||||
|
||||
@ -330,7 +352,9 @@ WindowHandle WindowImplCocoa::GetSystemHandle() const
|
||||
////////////////////////////////////////////////////////////
|
||||
void WindowImplCocoa::ShowMouseCursor(bool show)
|
||||
{
|
||||
if (show) {
|
||||
myShowCursor = show;
|
||||
|
||||
if (myShowCursor) {
|
||||
[myDelegate showMouseCursor];
|
||||
} else {
|
||||
[myDelegate hideMouseCursor];
|
||||
|
@ -145,7 +145,7 @@ bool InputImpl::IsKeyPressed(Keyboard::Key key)
|
||||
case Keyboard::Pause: vkey = VK_PAUSE; break;
|
||||
}
|
||||
|
||||
return GetAsyncKeyState(vkey) != 0;
|
||||
return (GetAsyncKeyState(vkey) & 0x8000) != 0;
|
||||
}
|
||||
|
||||
|
||||
@ -162,7 +162,7 @@ bool InputImpl::IsMouseButtonPressed(Mouse::Button button)
|
||||
case Mouse::XButton2: vkey = VK_XBUTTON2; break;
|
||||
}
|
||||
|
||||
return GetAsyncKeyState(vkey) != 0;
|
||||
return (GetAsyncKeyState(vkey) & 0x8000) != 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Window/GlContext.hpp>
|
||||
#include <SFML/OpenGL.hpp>
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
namespace sf
|
||||
|
@ -87,7 +87,7 @@ myIsCursorIn (false)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowImplWin32::WindowImplWin32(VideoMode mode, const std::string& title, unsigned long style) :
|
||||
WindowImplWin32::WindowImplWin32(VideoMode mode, const std::string& title, Uint32 style) :
|
||||
myHandle (NULL),
|
||||
myCallback (0),
|
||||
myCursor (NULL),
|
||||
|
@ -62,7 +62,7 @@ public :
|
||||
/// \param style Window style
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowImplWin32(VideoMode mode, const std::string& title, unsigned long style);
|
||||
WindowImplWin32(VideoMode mode, const std::string& title, Uint32 style);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Destructor
|
||||
|
@ -55,7 +55,7 @@ myFramerateLimit(0)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
Window::Window(VideoMode mode, const std::string& title, unsigned long style, const ContextSettings& settings) :
|
||||
Window::Window(VideoMode mode, const std::string& title, Uint32 style, const ContextSettings& settings) :
|
||||
myWindow (NULL),
|
||||
myContext (NULL),
|
||||
myLastFrameTime (0),
|
||||
@ -84,7 +84,7 @@ Window::~Window()
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void Window::Create(VideoMode mode, const std::string& title, unsigned long style, const ContextSettings& settings)
|
||||
void Window::Create(VideoMode mode, const std::string& title, Uint32 style, const ContextSettings& settings)
|
||||
{
|
||||
// Destroy the previous window implementation
|
||||
Close();
|
||||
|
@ -55,7 +55,7 @@ namespace sf
|
||||
namespace priv
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
WindowImpl* WindowImpl::New(VideoMode mode, const std::string& title, unsigned long style)
|
||||
WindowImpl* WindowImpl::New(VideoMode mode, const std::string& title, Uint32 style)
|
||||
{
|
||||
return new WindowImplType(mode, title, style);
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public :
|
||||
/// \return Pointer to the created window (don't forget to delete it)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static WindowImpl* New(VideoMode mode, const std::string& title, unsigned long style);
|
||||
static WindowImpl* New(VideoMode mode, const std::string& title, Uint32 style);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a new window depending on to the current OS
|
||||
|
@ -43,7 +43,9 @@ struct SFMLmainWindow
|
||||
NSLog(@"Couldn't load the logo image");
|
||||
}
|
||||
|
||||
sprite.SetImage(logo, true);
|
||||
logo.SetSmooth(true);
|
||||
|
||||
sprite.SetTexture(logo, true);
|
||||
sprite.SetOrigin(sprite.GetSize() / 2.f);
|
||||
sprite.Scale(0.3, 0.3);
|
||||
|
||||
@ -56,7 +58,7 @@ struct SFMLmainWindow
|
||||
|
||||
sf::RenderWindow renderWindow;
|
||||
sf::Text text;
|
||||
sf::Image logo;
|
||||
sf::Texture logo;
|
||||
sf::Sprite sprite;
|
||||
sf::Color background;
|
||||
};
|
||||
|
@ -42,6 +42,64 @@ subject to the following restrictions:
|
||||
<!-- ############################################################### Options -->
|
||||
<key>Options</key>
|
||||
<array>
|
||||
<!-- ****************************************** Framework option -->
|
||||
<dict>
|
||||
<key>Identifier</key>
|
||||
<string>libraryType</string>
|
||||
<key>Name</key>
|
||||
<string>Use frameworks</string>
|
||||
<key>Description</key>
|
||||
<string>Indicates whether frameworks should be used instead of dylibs or not.</string>
|
||||
<key>Type</key>
|
||||
<string>checkbox</string>
|
||||
<key>SortOrder</key>
|
||||
<integer>1</integer>
|
||||
<key>Default</key>
|
||||
<string>false</string>
|
||||
<key>Units</key>
|
||||
<dict>
|
||||
<!-- ON -->
|
||||
<key>true</key>
|
||||
<dict>
|
||||
<!-- compilation options -->
|
||||
<key>Project</key>
|
||||
<dict>
|
||||
<key>SharedSettings</key>
|
||||
<dict>
|
||||
<key>SFML_LINK_PREFIX</key>
|
||||
<string>$(SFML_LINK_FRAMEWORKS_PREFIX)</string>
|
||||
|
||||
<key>SFML_LINK_SUFFIX</key>
|
||||
<string>$(SFML_LINK_FRAMEWORKS_SUFFIX)</string>
|
||||
|
||||
<key>HEADER_SEARCH_PATHS</key>
|
||||
<string>$(HEADER_SEARCH_PATHS)</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<!-- OFF -->
|
||||
<key>false</key>
|
||||
<dict>
|
||||
<!-- compilation options -->
|
||||
<key>Project</key>
|
||||
<dict>
|
||||
<key>SharedSettings</key>
|
||||
<dict>
|
||||
<key>SFML_LINK_PREFIX</key>
|
||||
<string>$(SFML_LINK_DYLIBS_PREFIX)</string>
|
||||
|
||||
<key>SFML_LINK_SUFFIX</key>
|
||||
<string>$(SFML_LINK_DYLIBS_SUFFIX)</string>
|
||||
|
||||
<key>HEADER_SEARCH_PATHS</key>
|
||||
<string>$(HEADER_SEARCH_PATHS) /usr/local/include/</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
|
||||
</dict>
|
||||
</dict>
|
||||
|
||||
<!-- ********************************************* Window Module -->
|
||||
<dict>
|
||||
<key>Identifier</key>
|
||||
@ -66,11 +124,8 @@ subject to the following restrictions:
|
||||
<dict>
|
||||
<key>SharedSettings</key>
|
||||
<dict>
|
||||
<key>WINDOW_RELEASE</key>
|
||||
<string>-lsfml-window</string>
|
||||
|
||||
<key>WINDOW_DEBUG</key>
|
||||
<string>-lsfml-window-d</string>
|
||||
<key>SFML_WINDOW</key>
|
||||
<string>$(SFML_LINK_PREFIX)sfml-window$(SFML_LINK_SUFFIX)</string>
|
||||
</dict>
|
||||
</dict>
|
||||
|
||||
@ -99,10 +154,7 @@ subject to the following restrictions:
|
||||
<dict>
|
||||
<key>SharedSettings</key>
|
||||
<dict>
|
||||
<key>WINDOW_RELEASE</key>
|
||||
<string></string>
|
||||
|
||||
<key>WINDOW_DEBUG</key>
|
||||
<key>SFML_WINDOW</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</dict>
|
||||
@ -157,11 +209,8 @@ subject to the following restrictions:
|
||||
<dict>
|
||||
<key>SharedSettings</key>
|
||||
<dict>
|
||||
<key>GRAPHICS_RELEASE</key>
|
||||
<string>-lsfml-graphics</string>
|
||||
|
||||
<key>GRAPHICS_DEBUG</key>
|
||||
<string>-lsfml-graphics-d</string>
|
||||
<key>SFML_GRAPHICS</key>
|
||||
<string>$(SFML_LINK_PREFIX)sfml-graphics$(SFML_LINK_SUFFIX)</string>
|
||||
</dict>
|
||||
</dict>
|
||||
|
||||
@ -256,10 +305,7 @@ text.SetColor(sf::Color::Black);
|
||||
<dict>
|
||||
<key>SharedSettings</key>
|
||||
<dict>
|
||||
<key>GRAPHICS_RELEASE</key>
|
||||
<string></string>
|
||||
|
||||
<key>GRAPHICS_DEBUG</key>
|
||||
<key>SFML_GRAPHICS</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</dict>
|
||||
@ -307,11 +353,8 @@ text.SetColor(sf::Color::Black);
|
||||
<dict>
|
||||
<key>SharedSettings</key>
|
||||
<dict>
|
||||
<key>AUDIO_RELEASE</key>
|
||||
<string>-lsfml-audio</string>
|
||||
|
||||
<key>AUDIO_DEBUG</key>
|
||||
<string>-lsfml-audio-d</string>
|
||||
<key>SFML_AUDIO</key>
|
||||
<string>$(SFML_LINK_PREFIX)sfml-audio$(SFML_LINK_SUFFIX)</string>
|
||||
</dict>
|
||||
</dict>
|
||||
|
||||
@ -354,10 +397,7 @@ music.Play();
|
||||
<dict>
|
||||
<key>SharedSettings</key>
|
||||
<dict>
|
||||
<key>AUDIO_RELEASE</key>
|
||||
<string></string>
|
||||
|
||||
<key>AUDIO_DEBUG</key>
|
||||
<key>SFML_AUDIO</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</dict>
|
||||
@ -402,11 +442,8 @@ music.Play();
|
||||
<dict>
|
||||
<key>SharedSettings</key>
|
||||
<dict>
|
||||
<key>NETWORK_RELEASE</key>
|
||||
<string>-lsfml-network</string>
|
||||
|
||||
<key>NETWORK_DEBUG</key>
|
||||
<string>-lsfml-network-d</string>
|
||||
<key>SFML_NETWORK</key>
|
||||
<string>$(SFML_LINK_PREFIX)sfml-network$(SFML_LINK_SUFFIX)</string>
|
||||
</dict>
|
||||
</dict>
|
||||
|
||||
@ -427,10 +464,7 @@ music.Play();
|
||||
<dict>
|
||||
<key>SharedSettings</key>
|
||||
<dict>
|
||||
<key>NETWORK_RELEASE</key>
|
||||
<string></string>
|
||||
|
||||
<key>NETWORK_DEBUG</key>
|
||||
<key>SFML_NETWORK</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</dict>
|
||||
@ -560,13 +594,23 @@ while (window.IsOpened())
|
||||
<key>PRODUCT_NAME</key>
|
||||
<string>$(TARGET_NAME)</string>
|
||||
|
||||
<key>SYSTEM_RELEASE</key>
|
||||
<string>-lsfml-system</string>
|
||||
<key>SYSTEM_DEBUG</key>
|
||||
<string>-lsfml-system-d</string>
|
||||
|
||||
<key>HEADER_SEARCH_PATHS</key>
|
||||
<string>$(HEADER_SEARCH_PATHS) /usr/local/include/</string>
|
||||
<key>SFML_LINK_DYLIBS_PREFIX</key>
|
||||
<string>-l</string>
|
||||
|
||||
<key>SFML_LINK_FRAMEWORKS_PREFIX</key>
|
||||
<string>-framework </string>
|
||||
|
||||
<key>SFML_SYSTEM</key>
|
||||
<string>$(SFML_LINK_PREFIX)sfml-system$(SFML_LINK_SUFFIX)</string>
|
||||
|
||||
<key>SFML_LINK_FRAMEWORKS_SUFFIX</key>
|
||||
<string></string>
|
||||
|
||||
<key>CLANG_ENABLE_OBJC_ARC</key>
|
||||
<string></string>
|
||||
|
||||
<key>GCC_ENABLE_OBJC_GC</key>
|
||||
<string>unsupported</string>
|
||||
</dict>
|
||||
|
||||
<key>Configurations</key>
|
||||
@ -574,16 +618,22 @@ while (window.IsOpened())
|
||||
<!-- ***************************************************** Debug -->
|
||||
<key>Debug</key>
|
||||
<dict>
|
||||
<key>SFML_LINK_DYLIBS_SUFFIX</key>
|
||||
<string>-d</string>
|
||||
|
||||
<key>OTHER_LDFLAGS</key>
|
||||
<string>$(OTHER_LDFLAGS) $(SYSTEM_DEBUG) $(WINDOW_DEBUG) $(GRAPHICS_DEBUG) $(AUDIO_DEBUG) $(NETWORK_DEBUG)</string>
|
||||
<string>$(OTHER_LDFLAGS) $(SFML_SYSTEM) $(SFML_WINDOW) $(SFML_GRAPHICS) $(SFML_AUDIO) $(SFML_NETWORK)</string>
|
||||
</dict>
|
||||
|
||||
|
||||
<!-- *************************************************** Release -->
|
||||
<key>Release</key>
|
||||
<dict>
|
||||
<key>SFML_LINK_DYLIBS_SUFFIX</key>
|
||||
<string></string>
|
||||
|
||||
<key>OTHER_LDFLAGS</key>
|
||||
<string>$(OTHER_LDFLAGS) $(SYSTEM_RELEASE) $(WINDOW_RELEASE) $(GRAPHICS_RELEASE) $(AUDIO_RELEASE) $(NETWORK_RELEASE)</string>
|
||||
<string>$(OTHER_LDFLAGS) $(SFML_SYSTEM) $(SFML_WINDOW) $(SFML_GRAPHICS) $(SFML_AUDIO) $(SFML_NETWORK)</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
@ -606,48 +656,71 @@ while (window.IsOpened())
|
||||
<string>/bin/sh</string>
|
||||
|
||||
<key>ShellScript</key>
|
||||
<string># This shell script simply copies required sfml dylibs into the application bundle frameworks folder
|
||||
# NB : this script assumes that if moduleX is required in release mode then it is also required in debug mode.
|
||||
<string># This shell script simply copies required sfml dylibs/frameworks into the application bundle frameworks folder.
|
||||
# If you're using static libraries (which is not recommended) you should remove this script from your project.
|
||||
|
||||
# Are we building a project that uses framework or dylibs ?
|
||||
if [ $SFML_LINK_PREFIX = $SFML_LINK_FRAMEWORKS_PREFIX ]
|
||||
then
|
||||
frameworks=1
|
||||
else
|
||||
frameworks=0
|
||||
fi
|
||||
|
||||
require () # $1 is a SFML module like 'system' or 'audio'
|
||||
{
|
||||
dest=$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.app/Contents/Frameworks
|
||||
|
||||
if [ -z $1 ]
|
||||
then
|
||||
echo "no parameter! ERROR!"
|
||||
exit
|
||||
else
|
||||
if [ $CONFIGURATION = "Debug" ]
|
||||
# clean potentially old stuff
|
||||
rm -f $dest/libsfml-$1.2.dylib
|
||||
rm -f $dest/libsfml-$1-d.2.dylib
|
||||
rm -fr $dest/sfml-$1.framework
|
||||
|
||||
# copy SFML libraries
|
||||
if [ $frameworks ]
|
||||
then
|
||||
rm -f $BUILT_PRODUCTS_DIR/test.app/Contents/Frameworks/libsfml-$1.2.dylib
|
||||
ditto /usr/local/lib/libsfml-$1-d.2.dylib $BUILT_PRODUCTS_DIR/test.app/Contents/Frameworks/libsfml-$1-d.2.dylib
|
||||
ditto /Library/Frameworks/sfml-$1.framework $dest/sfml-$1.framework
|
||||
elif [ $CONFIGURATION = "Debug" ]
|
||||
then
|
||||
ditto /usr/local/lib/libsfml-$1-d.2.dylib $dest/libsfml-$1-d.2.dylib
|
||||
else
|
||||
rm -f $BUILT_PRODUCTS_DIR/test.app/Contents/Frameworks/libsfml-$1-d.2.dylib
|
||||
ditto /usr/local/lib/libsfml-$1.2.dylib $BUILT_PRODUCTS_DIR/test.app/Contents/Frameworks/libsfml-$1.2.dylib
|
||||
ditto /usr/local/lib/libsfml-$1.2.dylib $dest/libsfml-$1.2.dylib
|
||||
fi
|
||||
|
||||
if [ $1 = "audio" ]
|
||||
then
|
||||
# copy sndfile framework too
|
||||
ditto /Library/Frameworks/sndfile.framework $dest/sndfile.framework
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -n "$SYSTEM_RELEASE" ]
|
||||
if [ -n "$SFML_SYSTEM" ]
|
||||
then
|
||||
require "system"
|
||||
fi
|
||||
|
||||
if [ -n "$AUDIO_RELEASE" ]
|
||||
if [ -n "$SFML_AUDIO" ]
|
||||
then
|
||||
require "audio"
|
||||
fi
|
||||
|
||||
if [ -n "$NETWORK_RELEASE" ]
|
||||
if [ -n "$SFML_NETWORK" ]
|
||||
then
|
||||
require "network"
|
||||
fi
|
||||
|
||||
if [ -n "$WINDOW_RELEASE" ]
|
||||
if [ -n "$SFML_WINDOW" ]
|
||||
then
|
||||
require "window"
|
||||
fi
|
||||
|
||||
if [ -n "$GRAPHICS_RELEASE" ]
|
||||
if [ -n "$SFML_GRAPHICS" ]
|
||||
then
|
||||
require "graphics"
|
||||
fi
|
Before Width: | Height: | Size: 140 KiB After Width: | Height: | Size: 140 KiB |
@ -42,6 +42,64 @@ subject to the following restrictions:
|
||||
<!-- ############################################################### Options -->
|
||||
<key>Options</key>
|
||||
<array>
|
||||
<!-- ****************************************** Framework option -->
|
||||
<dict>
|
||||
<key>Identifier</key>
|
||||
<string>libraryType</string>
|
||||
<key>Name</key>
|
||||
<string>Use frameworks</string>
|
||||
<key>Description</key>
|
||||
<string>Indicates whether frameworks should be used instead of dylibs or not.</string>
|
||||
<key>Type</key>
|
||||
<string>checkbox</string>
|
||||
<key>SortOrder</key>
|
||||
<integer>1</integer>
|
||||
<key>Default</key>
|
||||
<string>false</string>
|
||||
<key>Units</key>
|
||||
<dict>
|
||||
<!-- ON -->
|
||||
<key>true</key>
|
||||
<dict>
|
||||
<!-- compilation options -->
|
||||
<key>Project</key>
|
||||
<dict>
|
||||
<key>SharedSettings</key>
|
||||
<dict>
|
||||
<key>SFML_LINK_PREFIX</key>
|
||||
<string>$(SFML_LINK_FRAMEWORKS_PREFIX)</string>
|
||||
|
||||
<key>SFML_LINK_SUFFIX</key>
|
||||
<string>$(SFML_LINK_FRAMEWORKS_SUFFIX)</string>
|
||||
|
||||
<key>HEADER_SEARCH_PATHS</key>
|
||||
<string>$(HEADER_SEARCH_PATHS)</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<!-- OFF -->
|
||||
<key>false</key>
|
||||
<dict>
|
||||
<!-- compilation options -->
|
||||
<key>Project</key>
|
||||
<dict>
|
||||
<key>SharedSettings</key>
|
||||
<dict>
|
||||
<key>SFML_LINK_PREFIX</key>
|
||||
<string>$(SFML_LINK_DYLIBS_PREFIX)</string>
|
||||
|
||||
<key>SFML_LINK_SUFFIX</key>
|
||||
<string>$(SFML_LINK_DYLIBS_SUFFIX)</string>
|
||||
|
||||
<key>HEADER_SEARCH_PATHS</key>
|
||||
<string>$(HEADER_SEARCH_PATHS) /usr/local/include/</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
|
||||
</dict>
|
||||
</dict>
|
||||
|
||||
<!-- ********************************************* Window Module -->
|
||||
<dict>
|
||||
<key>Identifier</key>
|
||||
@ -66,11 +124,8 @@ subject to the following restrictions:
|
||||
<dict>
|
||||
<key>SharedSettings</key>
|
||||
<dict>
|
||||
<key>WINDOW_RELEASE</key>
|
||||
<string>-lsfml-window</string>
|
||||
|
||||
<key>WINDOW_DEBUG</key>
|
||||
<string>-lsfml-window-d</string>
|
||||
<key>SFML_WINDOW</key>
|
||||
<string>$(SFML_LINK_PREFIX)sfml-window$(SFML_LINK_SUFFIX)</string>
|
||||
</dict>
|
||||
</dict>
|
||||
|
||||
@ -99,10 +154,7 @@ subject to the following restrictions:
|
||||
<dict>
|
||||
<key>SharedSettings</key>
|
||||
<dict>
|
||||
<key>WINDOW_RELEASE</key>
|
||||
<string></string>
|
||||
|
||||
<key>WINDOW_DEBUG</key>
|
||||
<key>SFML_WINDOW</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</dict>
|
||||
@ -157,11 +209,8 @@ subject to the following restrictions:
|
||||
<dict>
|
||||
<key>SharedSettings</key>
|
||||
<dict>
|
||||
<key>GRAPHICS_RELEASE</key>
|
||||
<string>-lsfml-graphics</string>
|
||||
|
||||
<key>GRAPHICS_DEBUG</key>
|
||||
<string>-lsfml-graphics-d</string>
|
||||
<key>SFML_GRAPHICS</key>
|
||||
<string>$(SFML_LINK_PREFIX)sfml-graphics$(SFML_LINK_SUFFIX)</string>
|
||||
</dict>
|
||||
</dict>
|
||||
|
||||
@ -256,10 +305,7 @@ text.SetColor(sf::Color::Black);
|
||||
<dict>
|
||||
<key>SharedSettings</key>
|
||||
<dict>
|
||||
<key>GRAPHICS_RELEASE</key>
|
||||
<string></string>
|
||||
|
||||
<key>GRAPHICS_DEBUG</key>
|
||||
<key>SFML_GRAPHICS</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</dict>
|
||||
@ -307,11 +353,8 @@ text.SetColor(sf::Color::Black);
|
||||
<dict>
|
||||
<key>SharedSettings</key>
|
||||
<dict>
|
||||
<key>AUDIO_RELEASE</key>
|
||||
<string>-lsfml-audio</string>
|
||||
|
||||
<key>AUDIO_DEBUG</key>
|
||||
<string>-lsfml-audio-d</string>
|
||||
<key>SFML_AUDIO</key>
|
||||
<string>$(SFML_LINK_PREFIX)sfml-audio$(SFML_LINK_SUFFIX)</string>
|
||||
</dict>
|
||||
</dict>
|
||||
|
||||
@ -354,10 +397,7 @@ music.Play();
|
||||
<dict>
|
||||
<key>SharedSettings</key>
|
||||
<dict>
|
||||
<key>AUDIO_RELEASE</key>
|
||||
<string></string>
|
||||
|
||||
<key>AUDIO_DEBUG</key>
|
||||
<key>SFML_AUDIO</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</dict>
|
||||
@ -399,11 +439,8 @@ music.Play();
|
||||
<dict>
|
||||
<key>SharedSettings</key>
|
||||
<dict>
|
||||
<key>NETWORK_RELEASE</key>
|
||||
<string>-lsfml-network</string>
|
||||
|
||||
<key>NETWORK_DEBUG</key>
|
||||
<string>-lsfml-network-d</string>
|
||||
<key>SFML_NETWORK</key>
|
||||
<string>$(SFML_LINK_PREFIX)sfml-network$(SFML_LINK_SUFFIX)</string>
|
||||
</dict>
|
||||
</dict>
|
||||
|
||||
@ -424,10 +461,7 @@ music.Play();
|
||||
<dict>
|
||||
<key>SharedSettings</key>
|
||||
<dict>
|
||||
<key>NETWORK_RELEASE</key>
|
||||
<string></string>
|
||||
|
||||
<key>NETWORK_DEBUG</key>
|
||||
<key>SFML_NETWORK</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</dict>
|
||||
@ -554,13 +588,23 @@ while (window.IsOpened())
|
||||
<key>PRODUCT_NAME</key>
|
||||
<string>$(TARGET_NAME)</string>
|
||||
|
||||
<key>SYSTEM_RELEASE</key>
|
||||
<string>-lsfml-system</string>
|
||||
<key>SYSTEM_DEBUG</key>
|
||||
<string>-lsfml-system-d</string>
|
||||
|
||||
<key>HEADER_SEARCH_PATHS</key>
|
||||
<string>$(HEADER_SEARCH_PATHS) /usr/local/include/</string>
|
||||
<key>SFML_LINK_DYLIBS_PREFIX</key>
|
||||
<string>-l</string>
|
||||
|
||||
<key>SFML_LINK_FRAMEWORKS_PREFIX</key>
|
||||
<string>-framework </string>
|
||||
|
||||
<key>SFML_SYSTEM</key>
|
||||
<string>$(SFML_LINK_PREFIX)sfml-system$(SFML_LINK_SUFFIX)</string>
|
||||
|
||||
<key>SFML_LINK_FRAMEWORKS_SUFFIX</key>
|
||||
<string></string>
|
||||
|
||||
<key>CLANG_ENABLE_OBJC_ARC</key>
|
||||
<string></string>
|
||||
|
||||
<key>GCC_ENABLE_OBJC_GC</key>
|
||||
<string>unsupported</string>
|
||||
</dict>
|
||||
|
||||
<key>Configurations</key>
|
||||
@ -568,16 +612,22 @@ while (window.IsOpened())
|
||||
<!-- ***************************************************** Debug -->
|
||||
<key>Debug</key>
|
||||
<dict>
|
||||
<key>SFML_LINK_DYLIBS_SUFFIX</key>
|
||||
<string>-d</string>
|
||||
|
||||
<key>OTHER_LDFLAGS</key>
|
||||
<string>$(OTHER_LDFLAGS) $(SYSTEM_DEBUG) $(WINDOW_DEBUG) $(GRAPHICS_DEBUG) $(AUDIO_DEBUG) $(NETWORK_DEBUG)</string>
|
||||
<string>$(OTHER_LDFLAGS) $(SFML_SYSTEM) $(SFML_WINDOW) $(SFML_GRAPHICS) $(SFML_AUDIO) $(SFML_NETWORK)</string>
|
||||
</dict>
|
||||
|
||||
|
||||
<!-- *************************************************** Release -->
|
||||
<key>Release</key>
|
||||
<dict>
|
||||
<key>SFML_LINK_DYLIBS_SUFFIX</key>
|
||||
<string></string>
|
||||
|
||||
<key>OTHER_LDFLAGS</key>
|
||||
<string>$(OTHER_LDFLAGS) $(SYSTEM_RELEASE) $(WINDOW_RELEASE) $(GRAPHICS_RELEASE) $(AUDIO_RELEASE) $(NETWORK_RELEASE)</string>
|
||||
<string>$(OTHER_LDFLAGS) $(SFML_SYSTEM) $(SFML_WINDOW) $(SFML_GRAPHICS) $(SFML_AUDIO) $(SFML_NETWORK)</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
Before Width: | Height: | Size: 140 KiB After Width: | Height: | Size: 140 KiB |
@ -1,43 +1,66 @@
|
||||
XCODE 4 TEMPLATES
|
||||
=================
|
||||
|
||||
These are templates to create easily a new project in Xcode 4.
|
||||
These are templates to create easily a new SFML project in Xcode 4.
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
* You can choose between command line tool or bundle application.
|
||||
* You can select or not each module of SFML you'll use into your project.
|
||||
* A basic example is inserted automatically into your project's code.
|
||||
* You can choose between using SFML libraries as dylibs or frameworks.
|
||||
* You can add independently each SFML module you'll use into your project.
|
||||
* A basic example is included automatically into your project's code.
|
||||
|
||||
Install
|
||||
-------
|
||||
|
||||
Copy the four folders into ~/Library/Developer/Xcode/Templates folder (you might need to create it first).
|
||||
If you are building SFML from sources you can set CMake's INSTALL_XCODE4_TEMPLATES variable to TRUE to install the templates automatically. Otherwise proceed as follow :
|
||||
1. Make sure "~/Library/Developer/Xcode/Templates/" folder exists;
|
||||
2. Copy "SFML" folder into the above folder.
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
To use these templates follow these steps :
|
||||
|
||||
* open Xcode 4,
|
||||
* select «create a new Xcode project» from the «Welcome to Xcode» window or select menu File > New > New Project,
|
||||
* select «Templates» under «Mac OS X»,
|
||||
* then select either «SFML Application» or «SFML Command Line Tool»,
|
||||
* fill in the requested information and you're done.
|
||||
1. open Xcode 4,
|
||||
2. select "create a new Xcode project" from the "Welcome to Xcode" window or select menus File > New > New Project,
|
||||
3. select "SFML" subsection under "Mac OS X",
|
||||
4. then select either "SFML Application" or "SFML Command Line Tool",
|
||||
5. fill in the requested information and you're done.
|
||||
|
||||
Note
|
||||
----
|
||||
Question & Answer
|
||||
-----------------
|
||||
|
||||
If you wish to add/remove any module of SFML from your project without rebuilding a new one follow these steps :
|
||||
* I would like to add/remove a module of SFML from my current project without creating a new one. How can I do that ?
|
||||
|
||||
* select your project from the project navigator panel (cmd+1),
|
||||
* select your project's target on the main area,
|
||||
* go to the «Build Settings» tab,
|
||||
* go down to the bottom,
|
||||
* edit any MODULEX_CONFIG variable (e.g. AUDIO_DEBUG, NETWORK_RELEASE) you want to.
|
||||
1. select your project from the project navigator panel,
|
||||
2. select your project's target on the main area,
|
||||
3. go to the "Build Settings" tab,
|
||||
4. go down to the bottom,
|
||||
5. set SFML_XXX variable, where XXX is the name of the module to add/remove to "$(SFML_LINK_PREFIX)sfml-XXX$(SFML_LINK_SUFFIX)" to add it or to "" (nothing) to remove it.
|
||||
|
||||
Examples :
|
||||
|
||||
* to disable the audio module simply erase the content of AUDIO_DEBUG and AUDIO_RELEASE.
|
||||
* to add the network module set NETWORK_DEBUG to '-lsfml-network-d' and NETWORK_RELEASE to '-lsfml-network'.
|
||||
* I changed my mind and would like to switch from dylibs to frameworks or vice versa. How can I do that ?
|
||||
|
||||
1. select your project from the project navigator panel,
|
||||
2. select your project's target on the main area,
|
||||
3. go to the "Build Settings" tab,
|
||||
4. go down to the bottom,
|
||||
5. update SFML_LINK_PREFIX and SFML_LINK_SUFFIX as follow :
|
||||
* if you want to use frameworks, then
|
||||
1. set SFML_LINK_PREFIX to "$(SFML_LINK_FRAMEWORKS_PREFIX)",
|
||||
2. set SFML_LINK_SUFFIX to "$(SFML_LINK_FRAMEWORKS_SUFFIX)"
|
||||
* if you want to use dylibs, then
|
||||
1. set SFML_LINK_PREFIX to "$(SFML_LINK_DYLIBS_PREFIX)",
|
||||
2. set SFML_LINK_SUFFIX to "$(SFML_LINK_DYLIBS_SUFFIX)"
|
||||
|
||||
|
||||
* I want to use the static version of SFML. Is it possible ?
|
||||
|
||||
Short answer : Don't do that!
|
||||
|
||||
We strongly recommend you to use either dylibs or frameworks on Mac OS X. Please refer to Apple documentation for information about static vs shared libraries debate.
|
||||
|
||||
If you really need/want to use static libraries proceed as follow. First, set your project to use dylibs (see above Q & A). Then set SFML_LINK_DYLIBS_SUFFIX to "-s-d" in debug mode and to "-s" in release mode. Finally, remove the script automatically generated by the application template (see Build Phases tab).
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user