pax_global_header00006660000000000000000000000064130107124050014503gustar00rootroot0000000000000052 comment=b5facb85d13bff451a5fd2d088a97472a685576c CSFML-2.4/000077500000000000000000000000001301071240500122145ustar00rootroot00000000000000CSFML-2.4/CMakeLists.txt000066400000000000000000000045541301071240500147640ustar00rootroot00000000000000 cmake_minimum_required(VERSION 2.8.3) # define a macro that helps defining an option macro(csfml_set_option var default type docstring) if(NOT DEFINED ${var}) set(${var} ${default}) endif() set(${var} ${${var}} CACHE ${type} ${docstring} FORCE) endmacro() # set a default build type if none was provided # this has to be done before the project() instruction! csfml_set_option(CMAKE_BUILD_TYPE Release STRING "Choose the type of build (Debug or Release)") # project name project(CSFML) # include the configuration file include(${CMAKE_SOURCE_DIR}/cmake/Config.cmake) # setup version numbers set(VERSION_MAJOR 2) set(VERSION_MINOR 4) set(VERSION_PATCH 0) # add the CSFML header path include_directories(${CMAKE_SOURCE_DIR}/include) # add an option for choosing the build type (shared or static) csfml_set_option(BUILD_SHARED_LIBS TRUE BOOL "TRUE to build CSFML as shared libraries, FALSE to build it as static libraries") # add an option for building the API documentation csfml_set_option(CSFML_BUILD_DOC FALSE BOOL "TRUE to generate the API documentation, FALSE to ignore it") # add an option for linking to sfml either statically or dynamically csfml_set_option(CSFML_LINK_SFML_STATICALLY TRUE BOOL "TRUE to link to a static version of SFML, FALSE to link dynamically") # disable the rpath stuff set(CMAKE_SKIP_BUILD_RPATH TRUE) # define an option for choosing between static and dynamic C runtime (Windows only) if(SFML_OS_WINDOWS) set(STATIC_STD_LIBS FALSE CACHE BOOL "TRUE to statically link to the standard libraries, FALSE to use them as DLLs") # for VC++, we can apply it globally by modifying the compiler flags if(SFML_COMPILER_MSVC AND STATIC_STD_LIBS) foreach(flag CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) if(${flag} MATCHES "/MD") string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}") endif() endforeach() endif() endif() # add the subdirectories add_subdirectory(src/SFML) if(CSFML_BUILD_DOC) add_subdirectory(doc) endif() # setup the install rules install(DIRECTORY include DESTINATION . COMPONENT devel PATTERN ".svn" EXCLUDE) install(FILES license.txt DESTINATION ${INSTALL_MISC_DIR}) install(FILES readme.txt DESTINATION ${INSTALL_MISC_DIR}) CSFML-2.4/cmake/000077500000000000000000000000001301071240500132745ustar00rootroot00000000000000CSFML-2.4/cmake/Config.cmake000066400000000000000000000062221301071240500155050ustar00rootroot00000000000000# detect the OS if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") set(SFML_OS_WINDOWS 1) # detect the architecture (note: this test won't work for cross-compilation) include(CheckTypeSize) check_type_size(void* SIZEOF_VOID_PTR) if("${SIZEOF_VOID_PTR}" STREQUAL "4") set(ARCH_32BITS 1) elseif("${SIZEOF_VOID_PTR}" STREQUAL "8") set(ARCH_64BITS 1) else() message(FATAL_ERROR "Unsupported architecture") return() endif() elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(SFML_OS_LINUX 1) elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") set(SFML_OS_FREEBSD 1) elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(SFML_OS_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(FATAL_ERROR "Unsupported version of OS X : ${MACOSX_VERSION_RAW}") return() endif() else() message(FATAL_ERROR "Unsupported operating system") return() endif() # detect the compiler and its version # Note: on some platforms (OS X), CMAKE_COMPILER_IS_GNUCXX is true # even when CLANG is used, therefore the Clang test is done first if(CMAKE_CXX_COMPILER MATCHES ".*clang[+][+]" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # CMAKE_CXX_COMPILER_ID is an internal CMake variable subject to change, # but there is no other way to detect CLang at the moment set(SFML_COMPILER_CLANG 1) execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "--version" OUTPUT_VARIABLE CLANG_VERSION_OUTPUT) string(REGEX REPLACE ".*clang version ([0-9]+\\.[0-9]+).*" "\\1" SFML_CLANG_VERSION "${CLANG_VERSION_OUTPUT}") elseif(CMAKE_COMPILER_IS_GNUCXX) set(SFML_COMPILER_GCC 1) execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-dumpversion" OUTPUT_VARIABLE GCC_VERSION_OUTPUT) string(REGEX REPLACE "([0-9]+\\.[0-9]+).*" "\\1" SFML_GCC_VERSION "${GCC_VERSION_OUTPUT}") execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "--version" OUTPUT_VARIABLE GCC_COMPILER_VERSION) string(REGEX MATCHALL ".*(tdm[64]*-[1-9]).*" SFML_COMPILER_GCC_TDM "${GCC_COMPILER_VERSION}") execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-dumpmachine" OUTPUT_VARIABLE GCC_MACHINE) string(STRIP "${GCC_MACHINE}" GCC_MACHINE) if(${GCC_MACHINE} MATCHES ".*w64.*") set(SFML_COMPILER_GCC_W64 1) endif() elseif(MSVC) set(SFML_COMPILER_MSVC 1) if(MSVC_VERSION EQUAL 1400) set(SFML_MSVC_VERSION 8) elseif(MSVC_VERSION EQUAL 1500) set(SFML_MSVC_VERSION 9) elseif(MSVC_VERSION EQUAL 1600) set(SFML_MSVC_VERSION 10) elseif(MSVC_VERSION EQUAL 1700) set(SFML_MSVC_VERSION 11) elseif(MSVC_VERSION EQUAL 1800) set(SFML_MSVC_VERSION 12) endif() else() message(FATAL_ERROR "Unsupported compiler") return() endif() # define the install directory for miscellaneous files if(SFML_OS_WINDOWS) set(INSTALL_MISC_DIR .) elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_MACOSX) set(INSTALL_MISC_DIR share/CSFML) endif() CSFML-2.4/cmake/Macros.cmake000066400000000000000000000066711301071240500155340ustar00rootroot00000000000000include(CMakeParseArguments) # add a new target which is a CSFML library # ex: csfml_add_library(csfml-graphics # SOURCES sprite.cpp image.cpp ... # DEPENDS sfml-window sfml-system) macro(csfml_add_library target) # parse the arguments cmake_parse_arguments(THIS "" "" "SOURCES;DEPENDS;EXTERNAL_LIBS" ${ARGN}) # create the target add_library(${target} ${THIS_SOURCES}) # define the export symbol of the module string(REPLACE "-" "_" NAME_UPPER "${target}") string(TOUPPER "${NAME_UPPER}" NAME_UPPER) set_target_properties(${target} PROPERTIES DEFINE_SYMBOL ${NAME_UPPER}_EXPORTS) if(SFML_OS_WINDOWS) # include the major version number in Windows shared library names (but not import library names) set_target_properties(${target} PROPERTIES DEBUG_POSTFIX -d) set_target_properties(${target} PROPERTIES SUFFIX "-${VERSION_MAJOR}${CMAKE_SHARED_LIBRARY_SUFFIX}") else() set_target_properties(${target} PROPERTIES DEBUG_POSTFIX -d) endif() if (SFML_OS_WINDOWS AND SFML_COMPILER_GCC) # on Windows/gcc get rid of "lib" prefix for shared libraries, # and transform the ".dll.a" suffix into ".a" for import libraries set_target_properties(${target} PROPERTIES PREFIX "") set_target_properties(${target} PROPERTIES IMPORT_SUFFIX ".a") endif() # set the version and soversion of the target (for compatible systems -- mostly Linuxes) set_target_properties(${target} PROPERTIES SOVERSION ${VERSION_MAJOR}.${VERSION_MINOR}) set_target_properties(${target} PROPERTIES VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) # set the target's folder (for IDEs that support it, e.g. Visual Studio) set_target_properties(${target} PROPERTIES FOLDER "CSFML") # for gcc >= 4.0 on Windows, apply the SFML_USE_STATIC_STD_LIBS option if it is enabled if(SFML_OS_WINDOWS AND SFML_COMPILER_GCC AND NOT SFML_GCC_VERSION VERSION_LESS "4") if(SFML_USE_STATIC_STD_LIBS AND NOT SFML_COMPILER_GCC_TDM) set_target_properties(${target} PROPERTIES LINK_FLAGS "-static-libgcc -static-libstdc++") elseif(NOT SFML_USE_STATIC_STD_LIBS AND SFML_COMPILER_GCC_TDM) set_target_properties(${target} PROPERTIES LINK_FLAGS "-shared-libgcc -shared-libstdc++") endif() endif() # if using gcc >= 4.0 or clang >= 3.0 on a non-Windows platform, we must hide public symbols by default # (exported ones are explicitely marked) if(NOT SFML_OS_WINDOWS AND ((SFML_COMPILER_GCC AND NOT SFML_GCC_VERSION VERSION_LESS "4") OR (SFML_COMPILER_CLANG AND NOT SFML_CLANG_VERSION VERSION_LESS "3"))) set_target_properties(${target} PROPERTIES COMPILE_FLAGS -fvisibility=hidden) endif() # link the target to its external dependencies (C++ SFML libraries) target_link_libraries(${target} ${THIS_DEPENDS}) # build dylibs if(SFML_OS_MACOSX AND BUILD_SHARED_LIBS) # adapt install directory to allow distributing dylibs in user’s application bundle set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_RPATH 1 INSTALL_NAME_DIR "@rpath") endif() # add the install rule install(TARGETS ${target} RUNTIME DESTINATION bin COMPONENT bin LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT bin ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT devel) endmacro() CSFML-2.4/doc/000077500000000000000000000000001301071240500127615ustar00rootroot00000000000000CSFML-2.4/doc/CMakeLists.txt000066400000000000000000000032611301071240500155230ustar00rootroot00000000000000 # find doxygen find_package(Doxygen REQUIRED) # set the input and output documentation paths set(DOXYGEN_INPUT_DIR ${CMAKE_SOURCE_DIR}) set(DOXYGEN_OUTPUT_DIR ${CMAKE_BINARY_DIR}/doc) # see if we can generate the CHM documentation if(SFML_OS_WINDOWS) # if HHC is found, we can generate the CHM (compressed HTML) output find_program(DOXYGEN_HHC_PROGRAM NAMES hhc.exe PATHS "c:/Program Files/HTML Help Workshop" DOC "HTML Help Compiler program") if(DOXYGEN_HHC_PROGRAM) set(DOXYGEN_GENERATE_HTMLHELP YES) else() set(DOXYGEN_GENERATE_HTMLHELP NO) endif() else() set(DOXYGEN_HHC_PROGRAM) set(DOXYGEN_GENERATE_HTMLHELP NO) endif() # configure the source Doxyfile by copying it and replacing all @variables@ set(DOXYGEN_CONFIGURED_INPUT ${DOXYGEN_OUTPUT_DIR}/doxyfile) configure_file(${DOXYGEN_INPUT_DIR}/doc/doxyfile.in ${DOXYGEN_CONFIGURED_INPUT} @ONLY) # copy the files needed by the documentation configure_file(${DOXYGEN_INPUT_DIR}/doc/doxygen.css ${DOXYGEN_OUTPUT_DIR}/html/doxygen.css COPYONLY) # target setup add_custom_target(doc ALL COMMAND ${CMAKE_COMMAND} -E echo_append "Building API Documentation..." COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_CONFIGURED_INPUT} COMMAND ${CMAKE_COMMAND} -E echo "Done." WORKING_DIRECTORY ${DOXYGEN_INPUT_DIR}) # setup install rules install(DIRECTORY ${DOXYGEN_OUTPUT_DIR}/html DESTINATION ${INSTALL_MISC_DIR}/doc COMPONENT doc) if(DOXYGEN_HHC_PROGRAM) install(FILES ${DOXYGEN_OUTPUT_DIR}/CSFML.chm DESTINATION ${INSTALL_MISC_DIR}/doc COMPONENT doc) endif() CSFML-2.4/doc/doxyfile.in000066400000000000000000001752231301071240500151460ustar00rootroot00000000000000# Doxyfile 1.5.8 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = CSFML # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@ # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = "@DOXYGEN_OUTPUT_DIR@" # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, # Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), # Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, # Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, Slovene, # Spanish, Swedish, and Ukrainian. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = "The $name class" \ "The $name widget" \ "The $name file" \ is \ provides \ specifies \ contains \ represents \ a \ an \ the # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = YES # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = YES # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = NO # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = YES # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 4 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = YES # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it parses. # With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this tag. # The format is ext=language, where ext is a file extension, and language is one of # the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, # Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat # .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), # use: inc=Fortran f=C EXTENSION_MAPPING = # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen to replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to # determine which symbols to keep in memory and which to flush to disk. # When the cache is full, less often used symbols will be written to disk. # For small to medium size projects (<1000 input files) the default value is # probably good enough. For larger projects a too small cache size can cause # doxygen to be busy swapping symbols to and from disk most of the time # causing a significant performance penality. # If the system has enough physical memory increasing the cache will improve the # performance by keeping more symbols in memory. Note that the value works on # a logarithmic scale so increasing the size by one will rougly double the # memory usage. The cache size is given by this formula: # 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols SYMBOL_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = NO # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = NO # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespace are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = NO # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by # doxygen. The layout file controls the global structure of the generated output files # in an output format independent way. The create the layout file that represents # doxygen's defaults, run doxygen with the -l option. You can optionally specify a # file name after the option, if omitted DoxygenLayout.xml will be used as the name # of the layout file. LAYOUT_FILE = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = YES # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = "@DOXYGEN_INPUT_DIR@/include/SFML" \ "@DOXYGEN_INPUT_DIR@/doc/mainpage.hpp" # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 FILE_PATTERNS = *.h \ *.hpp # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = .svn # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = * # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = NO # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .htm # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = "@DOXYGEN_INPUT_DIR@/doc/header.htm" # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = "@DOXYGEN_INPUT_DIR@/doc/footer.htm" # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = "@DOXYGEN_INPUT_DIR@/doc/doxygen.css" # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = @DOXYGEN_GENERATE_HTMLHELP@ # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = ../CSFML.chm # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = "@DOXYGEN_HHC_PROGRAM@" # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER # are set, an additional index file will be generated that can be used as input for # Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated # HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. # For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's # filter section matches. # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 1 # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to FRAME, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, # Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are # probably better off using the HTML help feature. Other possible values # for this tag are: HIERARCHIES, which will generate the Groups, Directories, # and Class Hierarchy pages using a tree view instead of an ordered list; # ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which # disables this behavior completely. For backwards compatibility with previous # releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE # respectively. GENERATE_TREEVIEW = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = NO # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = NO # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. This is useful # if you want to understand what is going on. On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # By default doxygen will write a font called FreeSans.ttf to the output # directory and reference it in all dot files that doxygen generates. This # font does not include all possible unicode characters however, so when you need # these (or just want a differently looking font) you can specify the font name # using DOT_FONTNAME. You need need to make sure dot is able to find the font, # which can be done by putting it in a standard location or by setting the # DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory # containing the font. DOT_FONTNAME = FreeSans # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the output directory to look for the # FreeSans.ttf font (which doxygen will put there itself). If you specify a # different font using DOT_FONTNAME you can set the path where dot # can find it using this tag. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Options related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO CSFML-2.4/doc/doxygen.css000066400000000000000000000476571301071240500151730ustar00rootroot00000000000000/* The standard CSS for doxygen */ /* @group Heading Levels */ div.contents .textblock h1 { text-align: left; font-size: 20pt; font-weight: normal; margin-top: 1.5em; padding: 0 0 0.4em 0; border-bottom: 1px solid #999; border-top-width: 0; border-left-width: 0; border-right-width: 0; background-color: transparent; } h1.groupheader { font-size: 150%; } .title { font-size: 20pt; font-weight: normal; margin: 10px 2px; } dt { font-weight: bold; } div.multicol { -moz-column-gap: 1em; -webkit-column-gap: 1em; -moz-column-count: 3; -webkit-column-count: 3; } p.startli, p.startdd, p.starttd { margin-top: 2px; } p.endli { margin-bottom: 0px; } p.enddd { margin-bottom: 4px; } p.endtd { margin-bottom: 2px; } /* @end */ caption { font-weight: bold; } span.legend { font-size: 70%; text-align: center; } h3.version { font-size: 90%; text-align: center; } div.qindex { margin-bottom: 1em; } div.qindex, div.navtab{ background-color: #eee; border: 1px solid #999; text-align: center; } div.qindex, div.navpath { width: 100%; line-height: 140%; } div.navtab { margin-right: 15px; } /* @group Link Styling */ a.qindex { font-weight: bold; } a.qindexHL { font-weight: bold; background-color: #9CAFD4; color: #ffffff; border: 1px double #869DCA; } /* @end */ dl.el { margin-left: -1cm; } a.el { padding: 1px; text-decoration: none; color: #577E25; } a.el:hover { text-decoration: underline; } pre.fragment { /*border: 1px solid #C4CFE5; background-color: #FBFCFD; padding: 4px 6px; margin: 4px 8px 4px 2px; overflow: auto; word-wrap: break-word; font-size: 9pt; line-height: 125%; font-family: monospace, fixed; font-size: 105%;*/ font-family: Consolas, "Liberation Mono", Courier, monospace; font-size: 10pt; padding: 0.5em 1em; background-color: #f5f5f5; border: 1px solid #bbb; .border-radius(5px); } div.fragment { /*margin: 0 0 0 5px; padding: 0.5em 1em; font-family: Consolas, "Liberation Mono", Courier, monospace; font-size: 10pt; background-color: #eef7e3; border-left: 3px solid #8DC841; border-right: 0; border-bottom: 0;*/ font-family: Consolas, "Liberation Mono", Courier, monospace; font-size: 10pt; padding: 0.5em 1em; background-color: #f5f5f5; border: 1px solid #bbb; .border-radius(5px); } div.line { min-height: 13px; text-wrap: unrestricted; white-space: -moz-pre-wrap; /* Moz */ white-space: -pre-wrap; /* Opera 4-6 */ white-space: -o-pre-wrap; /* Opera 7 */ white-space: pre-wrap; /* CSS3 */ word-wrap: break-word; /* IE 5.5+ */ text-indent: -53px; padding-left: 53px; padding-bottom: 0px; margin: 0px; } span.lineno { padding-right: 4px; text-align: right; background-color: #E8E8E8; white-space: pre; } div.ah { width: 100%; background-color: #eee; font-weight: bold; color: #000; margin-bottom: 1px; margin-top: 1px; border: solid 1px #999; } div.groupHeader { margin-left: 16px; margin-top: 12px; font-weight: bold; } div.groupText { margin-left: 16px; font-style: italic; } body { background-color: white; color: black; margin: 0; } div.contents { width: 950px; margin: 0 auto; } td.indexkey { background-color: #EBEFF6; font-weight: bold; border: 1px solid #C4CFE5; margin: 2px 0px 2px 0; padding: 2px 10px; white-space: nowrap; vertical-align: top; } td.indexvalue { background-color: #EBEFF6; border: 1px solid #C4CFE5; padding: 2px 10px; margin: 2px 0px; } tr.memlist { background-color: #EEF1F7; } p.formulaDsp { text-align: center; } img.formulaDsp { } img.formulaInl { vertical-align: middle; } div.center { text-align: center; margin-top: 0px; margin-bottom: 0px; padding: 0px; } div.center img { border: 0px; } address.footer { text-align: right; padding-right: 12px; } img.footer { border: 0px; vertical-align: middle; } /* @group Code Colorization */ span.keyword { color: #008000 } span.keywordtype { color: #604020 } span.keywordflow { color: #e08000 } span.comment { color: #800000 } span.preprocessor { color: #806020 } span.stringliteral { color: #002080 } span.charliteral { color: #008080 } span.vhdldigit { color: #ff00ff } span.vhdlchar { color: #000000 } span.vhdlkeyword { color: #700070 } span.vhdllogic { color: #ff0000 } blockquote { background-color: #F7F8FB; border-left: 2px solid #9CAFD4; margin: 0 24px 0 4px; padding: 0 12px 0 16px; } /* @end */ td.tiny { font-size: 75%; } .dirtab { padding: 4px; border-collapse: collapse; border: 1px solid #A3B4D7; } th.dirtab { background: #EBEFF6; font-weight: bold; } hr { display: none; height: 0px; border: none; border-top: 1px solid #4A6AAA; } hr.footer { height: 1px; } /* @group Member Descriptions */ table.memberdecls { border-spacing: 0px; padding: 0px; } .memberdecls td, .fieldtable tr { -webkit-transition-property: background-color, box-shadow; -webkit-transition-duration: 0.5s; -moz-transition-property: background-color, box-shadow; -moz-transition-duration: 0.5s; -ms-transition-property: background-color, box-shadow; -ms-transition-duration: 0.5s; -o-transition-property: background-color, box-shadow; -o-transition-duration: 0.5s; transition-property: background-color, box-shadow; transition-duration: 0.5s; } .memberdecls td.glow, .fieldtable tr.glow { background-color: cyan; /*box-shadow: 0 0 15px cyan;*/ } .mdescLeft, .mdescRight, .memItemLeft, .memItemRight, .memTemplItemLeft, .memTemplItemRight, .memTemplParams { background-color: #F9FAFC; border: none; margin: 4px; padding: 1px 0 0 8px; } .mdescLeft, .mdescRight { padding: 0px 8px 4px 8px; color: #555; } .memSeparator { border-bottom: 1px solid #DEE4F0; line-height: 1px; margin: 0px; padding: 0px; } .memItemLeft, .memTemplItemLeft { white-space: nowrap; } .memItemRight { width: 100%; } .memTemplParams { color: #4665A2; white-space: nowrap; font-size: 80%; } /* @end */ /* @group Member Details */ /* Styles for detailed member documentation */ .memtemplate { font-size: 80%; color: #4665A2; font-weight: normal; margin-left: 9px; } .memnav { background-color: #EBEFF6; border: 1px solid #A3B4D7; text-align: center; margin: 2px; margin-right: 15px; padding: 2px; } .mempage { width: 100%; } .memitem { padding: 0; /*margin-bottom: 10px;*/ margin-right: 5px; display: table !important; width: 100%; } .memname { font-weight: bold; margin-left: 6px; } .memname td { vertical-align: bottom; } .memproto, dl.reflist dt { border-top: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; border-right: 1px solid #A8B8D9; padding: 6px 0px 6px 0px; color: #000; font-weight: bold; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); background-color: #eee; border-top-right-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -moz-border-radius-topleft: 4px; -webkit-border-top-right-radius: 4px; -webkit-border-top-left-radius: 4px; } .memdoc, dl.reflist dd { border: 1px solid #A8B8D9; padding: 6px 10px 2px 10px; background-color: #FBFCFD; background-color: #FFFFFF; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-left-radius: 4px; -webkit-border-bottom-right-radius: 4px; } dl.reflist dt { padding: 5px; } dl.reflist dd { margin: 0px 0px 10px 0px; padding: 5px; } .paramkey { text-align: right; } .paramtype { white-space: nowrap; } .paramname { color: #602020; white-space: nowrap; } .paramname em { font-style: normal; } .paramname code { line-height: 14px; } .params, .retval, .exception, .tparams { margin-left: 0px; padding-left: 0px; } .params .paramname, .retval .paramname { font-weight: bold; vertical-align: top; } .params .paramtype { font-style: italic; vertical-align: top; } .params .paramdir { font-family: "courier new",courier,monospace; vertical-align: top; } table.mlabels { border-spacing: 0px; } td.mlabels-left { width: 100%; padding: 0px; } td.mlabels-right { vertical-align: bottom; padding: 0px; white-space: nowrap; } span.mlabels { margin-left: 8px; } span.mlabel { background-color: #728DC1; border-top:1px solid #5373B4; border-left:1px solid #5373B4; border-right:1px solid #C4CFE5; border-bottom:1px solid #C4CFE5; text-shadow: none; color: white; margin-right: 4px; padding: 2px 3px; border-radius: 3px; font-size: 7pt; white-space: nowrap; vertical-align: middle; } /* @end */ /* these are for tree view when not used as main index */ div.directory { margin: 10px 0px; border-top: 1px solid #bbb; width: 100%; } .directory table { border-collapse:collapse; } .directory td { margin: 0px; padding: 0px; vertical-align: top; } .directory td.entry { white-space: nowrap; padding: 5px 5px 5px 0; } .directory td.entry a { outline:none; } .directory td.entry a img { border: none; } .directory td.desc { width: 100%; padding-left: 6px; padding-right: 6px; padding-top: 3px; /*border-left: 1px solid rgba(0,0,0,0.05);*/ } .directory tr.even { padding-left: 6px; background-color: #F7F8FB; } .directory img { vertical-align: -30%; } .directory .levels { white-space: nowrap; width: 100%; text-align: right; font-size: 9pt; } .directory .levels span { cursor: pointer; padding-left: 2px; padding-right: 2px; color: #3D578C; } div.dynheader { margin-top: 8px; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } address { font-style: normal; color: #2A3D61; } table table { width: 90%; } .memitem table table { width: auto; } table.doxtable { border-collapse:collapse; margin-top: 4px; margin-bottom: 4px; } table.doxtable td, table.doxtable th { border: 1px solid #2D4068; padding: 3px 7px 2px; } table.doxtable th { background-color: #374F7F; color: #FFFFFF; font-size: 110%; padding-bottom: 4px; padding-top: 5px; } table.fieldtable { width: 100%; margin-bottom: 10px; border: 1px solid #A8B8D9; border-spacing: 0px; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } .fieldtable td, .fieldtable th { padding: 3px 7px 2px; } .fieldtable td.fieldtype, .fieldtable td.fieldname { white-space: nowrap; border-right: 1px solid #A8B8D9; border-bottom: 1px solid #A8B8D9; vertical-align: top; } .fieldtable td.fielddoc { border-bottom: 1px solid #A8B8D9; width: 100%; } .fieldtable tr:last-child td { border-bottom: none; } .fieldtable th { background-color: #E2E8F2; font-size: 90%; color: #253555; padding-bottom: 4px; padding-top: 5px; text-align:left; -moz-border-radius-topleft: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-left-radius: 4px; -webkit-border-top-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom: 1px solid #A8B8D9; } .tabsearch { top: 0px; left: 10px; height: 36px; z-index: 101; overflow: hidden; font-size: 13px; } .navpath { display: none; } .navpath ul { font-size: 11px; height:30px; line-height:30px; color:#8AA0CC; border:solid 1px #C2CDE4; overflow:hidden; margin:0px; padding:0px; } .navpath li { list-style-type:none; float:left; padding-left:10px; padding-right:15px; color:#364D7C; } .navpath li.navelem a { height:32px; display:block; text-decoration: none; outline: none; color: #283A5D; font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); text-decoration: none; } .navpath li.navelem a:hover { color:#6884BD; } .navpath li.footer { list-style-type:none; float:right; padding-left:10px; padding-right:15px; background-image:none; background-repeat:no-repeat; background-position:right; color:#364D7C; font-size: 8pt; } div.summary { float: right; font-size: 8pt; padding-right: 5px; width: 50%; text-align: right; } div.summary a { white-space: nowrap; padding: 1px; text-decoration: none; color: #577E25; } div.summary a:hover { text-decoration: underline; } div.ingroups { font-size: 8pt; width: 50%; text-align: left; } div.ingroups a { white-space: nowrap; } div.header { width: 950px; margin: 2em auto; border-bottom: 1px solid #999; } dl { padding: 0 0 0 10px; } /* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug */ dl.section { margin-left: 0px; padding-left: 0px; } dl.note { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #D0C000; } dl.warning, dl.attention { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #FF0000; } dl.pre, dl.post, dl.invariant { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #00D000; } dl.deprecated { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #505050; } dl.todo { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #00C0E0; } dl.test { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #3030E0; } dl.bug { margin-left:-7px; padding-left: 3px; border-left:4px solid; border-color: #C08050; } dl.section dd { margin-bottom: 6px; } #projectlogo { text-align: center; vertical-align: bottom; border-collapse: separate; } #projectlogo img { border: 0px none; } #projectname { font: 300% Tahoma, Arial,sans-serif; margin: 0px; padding: 2px 0px; } #projectbrief { font: 120% Tahoma, Arial,sans-serif; margin: 0px; padding: 0px; } #projectnumber { font: 50% Tahoma, Arial,sans-serif; margin: 0px; padding: 0px; } #titlearea { padding: 0px; margin: 0px; width: 100%; border-bottom: 1px solid #5373B4; } .image { text-align: center; } .dotgraph { text-align: center; } .mscgraph { text-align: center; } .caption { font-weight: bold; } div.zoom { border: 1px solid #90A5CE; } dl.citelist { margin-bottom:50px; } dl.citelist dt { color:#334975; float:left; font-weight:bold; margin-right:10px; padding:5px; } dl.citelist dd { margin:2px 0; padding:5px 0; } div.toc { padding: 14px 25px; background-color: #F4F6FA; border: 1px solid #D8DFEE; border-radius: 7px 7px 7px 7px; float: right; height: auto; margin: 0 20px 10px 10px; width: 200px; } div.toc li { font: 10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif; margin-top: 5px; padding-left: 10px; padding-top: 2px; } div.toc h3 { font: bold 12px/1.2 Arial,FreeSans,sans-serif; color: #4665A2; border-bottom: 0 none; margin: 0; } div.toc ul { list-style: none outside none; border: medium none; padding: 0px; } div.toc li.level1 { margin-left: 0px; } div.toc li.level2 { margin-left: 15px; } div.toc li.level3 { margin-left: 30px; } div.toc li.level4 { margin-left: 45px; } .inherit_header { font-weight: bold; color: gray; cursor: pointer; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .inherit_header td { padding: 6px 0px 2px 5px; } .inherit { display: none; } tr.heading h2 { margin-top: 12px; margin-bottom: 4px; } @media print { #top { display: none; } #side-nav { display: none; } #nav-path { display: none; } body { overflow:visible; } h1, h2, h3, h4, h5, h6 { page-break-after: avoid; } .summary { display: none; } .memitem { page-break-inside: avoid; } #doc-content { margin-left:0 !important; height:auto !important; width:auto !important; overflow:inherit; display:inline; } } /* tabs.css */ .tabs, .tabs2, .tabs3 { width: 100%; z-index: 101; font-size: 11pt; background-color: #EAF5DB; border-left: 1px solid #999; border-right: 1px solid #999; border-bottom: 1px solid #999; padding: 0; margin: 0; } .tabs2 { font-size: 10pt; } .tabs3 { font-size: 9pt; } #navrow1 .tablist, #navrow2 .tablist, #navrow3 .tablist, #navrow4 .tablist { margin: 0; padding: 0; display: table; } .tablist li { float: left; display: table-cell; list-style: none; } #navrow1 { border-top: 1px solid #999; margin-top: 2em; } #navrow1 .tablist a, #navrow2 .tablist a, #navrow3 .tablist a, #navrow4 .tablist a { display: block; margin: 8px 0; padding: 0 8px; border-right: 1px solid #bbb; } .tablist li { margin-bottom: 0 !important; } .tablist li.current a { font-weight: bold; } /* SFML css */ body { font-family: 'Ubuntu', 'Arial', sans-serif; line-height: 140%; margin: 0 0 2em 0; padding: 0; } #banner-container { width: 100%; margin-top: 25px; border-top: 2px solid #999; border-bottom: 2px solid #999; background-color: rgb(140, 200, 65); } #banner { width: 950px; height: 60px; line-height: 54px; margin: 0 auto; text-align: center; } #banner #sfml { display: inline; vertical-align: top; margin-left: 15px; color: #fff; font-size: 50pt; text-shadow: rgba(0, 0, 0, 0.5) 1px 1px 5px; } #footer-container { clear: both; width: 100%; margin-top: 50px; border-top: 1px solid #999; } #footer { width: 950px; margin: 10px auto; text-align: center; font-size: 10pt; color: #555; } #footer a { padding: 1px; text-decoration: none; color: rgb(70, 100, 30); } #footer a:hover { text-decoration: underline; } div.contents, #content { width: 950px; margin: 0 auto; padding: 0; } div.contents h1 { color: #333; padding: 0.5em 0; margin-top: 30px; margin-bottom: 0; text-align: center; font-size: 26pt; font-weight: normal; } div.contents h2 { font-size: 20pt; font-weight: normal; margin-top: 1.5em; padding-bottom: 0.4em; border-bottom: 1px solid #999; } div.contents h3 { font-size: 16pt; font-weight: normal; } div.contents p { color: #333; text-align: justify; } div.contents a, #content a { padding: 1px; text-decoration: none; color: rgb(70, 100, 30); } div.contents a:hover, #content a:hover { text-decoration: underline; } div.contents code { font-size: 11pt; font-family: Consolas, "Liberation Mono", Courier, monospace; } div.contents pre code { font-family: Consolas, "Liberation Mono", Courier, monospace; font-size: 10pt; padding: 0.5em 1em; background-color: #f5f5f5; border: 1px solid #bbb; } div.contents ul { list-style-type: square; list-style-position: outside; margin: 0 0 0 1.5em; padding: 0; } div.contents ul li { color: #333; margin: 0 0 0.3em 0; } CSFML-2.4/doc/footer.htm000066400000000000000000000005011301071240500147650ustar00rootroot00000000000000 CSFML-2.4/doc/header.htm000066400000000000000000000014021301071240500147200ustar00rootroot00000000000000 CSFML - C binding of the Simple and Fast Multimedia Library
CSFML-2.4/doc/mainpage.hpp000066400000000000000000000055201301071240500152550ustar00rootroot00000000000000//////////////////////////////////////////////////////////// /// \mainpage /// /// \section welcome Welcome /// Welcome to the official SFML documentation for C. Here you will find a detailed /// view of all the SFML functions.
/// If you are looking for tutorials, you can visit the official website /// at www.sfml-dev.org. /// /// \section example Short example /// Here is a short example, to show you how simple it is to use SFML in C : /// /// \code /// /// #include /// #include /// /// int main() /// { /// sfVideoMode mode = {800, 600, 32}; /// sfRenderWindow* window; /// sfTexture* texture; /// sfSprite* sprite; /// sfFont* font; /// sfText* text; /// sfMusic* music; /// sfEvent event; /// /// /* Create the main window */ /// window = sfRenderWindow_create(mode, "SFML window", sfResize | sfClose, NULL); /// if (!window) /// return EXIT_FAILURE; /// /// /* Load a sprite to display */ /// texture = sfTexture_createFromFile("cute_image.jpg", NULL); /// if (!texture) /// return EXIT_FAILURE; /// sprite = sfSprite_create(); /// sfSprite_setTexture(sprite, texture, sfTrue); /// /// /* Create a graphical text to display */ /// font = sfFont_createFromFile("arial.ttf"); /// if (!font) /// return EXIT_FAILURE; /// text = sfText_create(); /// sfText_setString(text, "Hello SFML"); /// sfText_setFont(text, font); /// sfText_setCharacterSize(text, 50); /// /// /* Load a music to play */ /// music = sfMusic_createFromFile("nice_music.ogg"); /// if (!music) /// return EXIT_FAILURE; /// /// /* Play the music */ /// sfMusic_play(music); /// /// /* Start the game loop */ /// while (sfRenderWindow_isOpen(window)) /// { /// /* Process events */ /// while (sfRenderWindow_pollEvent(window, &event)) /// { /// /* Close window : exit */ /// if (event.type == sfEvtClosed) /// sfRenderWindow_close(window); /// } /// /// /* Clear the screen */ /// sfRenderWindow_clear(window, sfBlack); /// /// /* Draw the sprite */ /// sfRenderWindow_drawSprite(window, sprite, NULL); /// /// /* Draw the text */ /// sfRenderWindow_drawText(window, text, NULL); /// /// /* Update the window */ /// sfRenderWindow_display(window); /// } /// /// /* Cleanup resources */ /// sfMusic_destroy(music); /// sfText_destroy(text); /// sfFont_destroy(font); /// sfSprite_destroy(sprite); /// sfTexture_destroy(texture); /// sfRenderWindow_destroy(window); /// /// return EXIT_SUCCESS; /// } /// \endcode //////////////////////////////////////////////////////////// CSFML-2.4/include/000077500000000000000000000000001301071240500136375ustar00rootroot00000000000000CSFML-2.4/include/SFML/000077500000000000000000000000001301071240500144005ustar00rootroot00000000000000CSFML-2.4/include/SFML/Audio.h000066400000000000000000000031201301071240500156060ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_AUDIO_H #define SFML_AUDIO_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include #include #include #include #endif // SFML_AUDIO_H CSFML-2.4/include/SFML/Audio/000077500000000000000000000000001301071240500154415ustar00rootroot00000000000000CSFML-2.4/include/SFML/Audio/Export.h000066400000000000000000000031731301071240500170770ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_AUDIO_EXPORT_H #define SFML_AUDIO_EXPORT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// // Define portable import / export macros //////////////////////////////////////////////////////////// #if defined(CSFML_AUDIO_EXPORTS) #define CSFML_AUDIO_API CSFML_API_EXPORT #else #define CSFML_AUDIO_API CSFML_API_IMPORT #endif #endif // SFML_AUDIO_EXPORT_H CSFML-2.4/include/SFML/Audio/Listener.h000066400000000000000000000111671301071240500174050ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_LISTENER_H #define SFML_LISTENER_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include //////////////////////////////////////////////////////////// /// \brief Change the global volume of all the sounds and musics /// /// The volume is a number between 0 and 100; it is combined with /// the individual volume of each sound / music. /// The default value for the volume is 100 (maximum). /// /// \param volume New global volume, in the range [0, 100] /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfListener_setGlobalVolume(float volume); //////////////////////////////////////////////////////////// /// \brief Get the current value of the global volume /// /// \return Current global volume, in the range [0, 100] /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API float sfListener_getGlobalVolume(void); //////////////////////////////////////////////////////////// /// \brief Set the position of the listener in the scene /// /// The default listener's position is (0, 0, 0). /// /// \param position New position of the listener /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfListener_setPosition(sfVector3f position); //////////////////////////////////////////////////////////// /// \brief Get the current position of the listener in the scene /// /// \return The listener's position /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfVector3f sfListener_getPosition(); //////////////////////////////////////////////////////////// /// \brief Set the orientation of the forward vector in the scene /// /// The direction (also called "at vector") is the vector /// pointing forward from the listener's perspective. Together /// with the up vector, it defines the 3D orientation of the /// listener in the scene. The direction vector doesn't /// have to be normalized. /// The default listener's direction is (0, 0, -1). /// /// \param direction New listener's direction /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfListener_setDirection(sfVector3f direction); //////////////////////////////////////////////////////////// /// \brief Get the current forward vector of the listener in the scene /// /// \return Listener's forward vector (not normalized) /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfVector3f sfListener_getDirection(); //////////////////////////////////////////////////////////// /// \brief Set the upward vector of the listener in the scene /// /// The up vector is the vector that points upward from the /// listener's perspective. Together with the direction, it /// defines the 3D orientation of the listener in the scene. /// The up vector doesn't have to be normalized. /// The default listener's up vector is (0, 1, 0). It is usually /// not necessary to change it, especially in 2D scenarios. /// /// \param upVector New listener's up vector /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfListener_setUpVector(sfVector3f upVector); //////////////////////////////////////////////////////////// /// \brief Get the current upward vector of the listener in the scene /// /// \return Listener's upward vector (not normalized) /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfVector3f sfListener_getUpVector(); #endif // SFML_LISTENER_H CSFML-2.4/include/SFML/Audio/Music.h000066400000000000000000000333701301071240500167000ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_MUSIC_H #define SFML_MUSIC_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include #include //////////////////////////////////////////////////////////// /// \brief Create a new music and load it from a file /// /// This function doesn't start playing the music (call /// sfMusic_play to do so). /// Here is a complete list of all the supported audio formats: /// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, /// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64. /// /// \param filename Path of the music file to open /// /// \return A new sfMusic object (NULL if failed) /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfMusic* sfMusic_createFromFile(const char* filename); //////////////////////////////////////////////////////////// /// \brief Create a new music and load it from a file in memory /// /// This function doesn't start playing the music (call /// sfMusic_play to do so). /// Here is a complete list of all the supported audio formats: /// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, /// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64. /// /// \param data Pointer to the file data in memory /// \param sizeInBytes Size of the data to load, in bytes /// /// \return A new sfMusic object (NULL if failed) /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfMusic* sfMusic_createFromMemory(const void* data, size_t sizeInBytes); //////////////////////////////////////////////////////////// /// \brief Create a new music and load it from a custom stream /// /// This function doesn't start playing the music (call /// sfMusic_play to do so). /// Here is a complete list of all the supported audio formats: /// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, /// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64. /// /// \param stream Source stream to read from /// /// \return A new sfMusic object (NULL if failed) /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfMusic* sfMusic_createFromStream(sfInputStream* stream); //////////////////////////////////////////////////////////// /// \brief Destroy a music /// /// \param music Music to destroy /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfMusic_destroy(sfMusic* music); //////////////////////////////////////////////////////////// /// \brief Set whether or not a music should loop after reaching the end /// /// If set, the music will restart from beginning after /// reaching the end and so on, until it is stopped or /// sfMusic_setLoop(music, sfFalse) is called. /// The default looping state for musics is false. /// /// \param music Music object /// \param loop sfTrue to play in loop, sfFalse to play once /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfMusic_setLoop(sfMusic* music, sfBool loop); //////////////////////////////////////////////////////////// /// \brief Tell whether or not a music is in loop mode /// /// \param music Music object /// /// \return sfTrue if the music is looping, sfFalse otherwise /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfBool sfMusic_getLoop(const sfMusic* music); //////////////////////////////////////////////////////////// /// \brief Get the total duration of a music /// /// \param music Music object /// /// \return Music duration /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfTime sfMusic_getDuration(const sfMusic* music); //////////////////////////////////////////////////////////// /// \brief Start or resume playing a music /// /// This function starts the music if it was stopped, resumes /// it if it was paused, and restarts it from beginning if it /// was it already playing. /// This function uses its own thread so that it doesn't block /// the rest of the program while the music is played. /// /// \param music Music object /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfMusic_play(sfMusic* music); //////////////////////////////////////////////////////////// /// \brief Pause a music /// /// This function pauses the music if it was playing, /// otherwise (music already paused or stopped) it has no effect. /// /// \param music Music object /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfMusic_pause(sfMusic* music); //////////////////////////////////////////////////////////// /// \brief Stop playing a music /// /// This function stops the music if it was playing or paused, /// and does nothing if it was already stopped. /// It also resets the playing position (unlike sfMusic_pause). /// /// \param music Music object /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfMusic_stop(sfMusic* music); //////////////////////////////////////////////////////////// /// \brief Return the number of channels of a music /// /// 1 channel means a mono sound, 2 means stereo, etc. /// /// \param music Music object /// /// \return Number of channels /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API unsigned int sfMusic_getChannelCount(const sfMusic* music); //////////////////////////////////////////////////////////// /// \brief Get the sample rate of a music /// /// The sample rate is the number of audio samples played per /// second. The higher, the better the quality. /// /// \param music Music object /// /// \return Sample rate, in number of samples per second /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API unsigned int sfMusic_getSampleRate(const sfMusic* music); //////////////////////////////////////////////////////////// /// \brief Get the current status of a music (stopped, paused, playing) /// /// \param music Music object /// /// \return Current status /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfSoundStatus sfMusic_getStatus(const sfMusic* music); //////////////////////////////////////////////////////////// /// \brief Get the current playing position of a music /// /// \param music Music object /// /// \return Current playing position /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfTime sfMusic_getPlayingOffset(const sfMusic* music); //////////////////////////////////////////////////////////// /// \brief Set the pitch of a music /// /// The pitch represents the perceived fundamental frequency /// of a sound; thus you can make a music more acute or grave /// by changing its pitch. A side effect of changing the pitch /// is to modify the playing speed of the music as well. /// The default value for the pitch is 1. /// /// \param music Music object /// \param pitch New pitch to apply to the music /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfMusic_setPitch(sfMusic* music, float pitch); //////////////////////////////////////////////////////////// /// \brief Set the volume of a music /// /// The volume is a value between 0 (mute) and 100 (full volume). /// The default value for the volume is 100. /// /// \param music Music object /// \param volume Volume of the music /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfMusic_setVolume(sfMusic* music, float volume); //////////////////////////////////////////////////////////// /// \brief Set the 3D position of a music in the audio scene /// /// Only musics with one channel (mono musics) can be /// spatialized. /// The default position of a music is (0, 0, 0). /// /// \param music Music object /// \param position Position of the music in the scene // //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfMusic_setPosition(sfMusic* music, sfVector3f position); //////////////////////////////////////////////////////////// /// \brief Make a musics's position relative to the listener or absolute /// /// Making a music relative to the listener will ensure that it will always /// be played the same way regardless the position of the listener. /// This can be useful for non-spatialized musics, musics that are /// produced by the listener, or musics attached to it. /// The default value is false (position is absolute). /// /// \param music Music object /// \param relative sfTrue to set the position relative, sfFalse to set it absolute /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfMusic_setRelativeToListener(sfMusic* music, sfBool relative); //////////////////////////////////////////////////////////// /// \brief Set the minimum distance of a music /// /// The "minimum distance" of a music is the maximum /// distance at which it is heard at its maximum volume. Further /// than the minimum distance, it will start to fade out according /// to its attenuation factor. A value of 0 ("inside the head /// of the listener") is an invalid value and is forbidden. /// The default value of the minimum distance is 1. /// /// \param music Music object /// \param distance New minimum distance of the music /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfMusic_setMinDistance(sfMusic* music, float distance); //////////////////////////////////////////////////////////// /// \brief Set the attenuation factor of a music /// /// The attenuation is a multiplicative factor which makes /// the music more or less loud according to its distance /// from the listener. An attenuation of 0 will produce a /// non-attenuated music, i.e. its volume will always be the same /// whether it is heard from near or from far. On the other hand, /// an attenuation value such as 100 will make the music fade out /// very quickly as it gets further from the listener. /// The default value of the attenuation is 1. /// /// \param music Music object /// \param attenuation New attenuation factor of the music /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfMusic_setAttenuation(sfMusic* music, float attenuation); //////////////////////////////////////////////////////////// /// \brief Change the current playing position of a music /// /// The playing position can be changed when the music is /// either paused or playing. /// /// \param music Music object /// \param timeOffset New playing position /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfMusic_setPlayingOffset(sfMusic* music, sfTime timeOffset); //////////////////////////////////////////////////////////// /// \brief Get the pitch of a music /// /// \param music Music object /// /// \return Pitch of the music /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API float sfMusic_getPitch(const sfMusic* music); //////////////////////////////////////////////////////////// /// \brief Get the volume of a music /// /// \param music Music object /// /// \return Volume of the music, in the range [0, 100] /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API float sfMusic_getVolume(const sfMusic* music); //////////////////////////////////////////////////////////// /// \brief Get the 3D position of a music in the audio scene /// /// \param music Music object /// /// \return Position of the music in the world /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfVector3f sfMusic_getPosition(const sfMusic* music); //////////////////////////////////////////////////////////// /// \brief Tell whether a music's position is relative to the /// listener or is absolute /// /// \param music Music object /// /// \return sfTrue if the position is relative, sfFalse if it's absolute /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfBool sfMusic_isRelativeToListener(const sfMusic* music); //////////////////////////////////////////////////////////// /// \brief Get the minimum distance of a music /// /// \param music Music object /// /// \return Minimum distance of the music /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API float sfMusic_getMinDistance(const sfMusic* music); //////////////////////////////////////////////////////////// /// \brief Get the attenuation factor of a music /// /// \param music Music object /// /// \return Attenuation factor of the music /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API float sfMusic_getAttenuation(const sfMusic* music); #endif // SFML_MUSIC_H CSFML-2.4/include/SFML/Audio/Sound.h000066400000000000000000000300431301071240500167020ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SOUND_H #define SFML_SOUND_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include //////////////////////////////////////////////////////////// /// \brief Create a new sound /// /// \return A new sfSound object /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfSound* sfSound_create(void); //////////////////////////////////////////////////////////// /// \brief Create a new sound by copying an existing one /// /// \param sound Sound to copy /// /// \return A new sfSound object which is a copy of \a sound /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfSound* sfSound_copy(const sfSound* sound); //////////////////////////////////////////////////////////// /// \brief Destroy a sound /// /// \param sound Sound to destroy /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSound_destroy(sfSound* sound); //////////////////////////////////////////////////////////// /// \brief Start or resume playing a sound /// /// This function starts the sound if it was stopped, resumes /// it if it was paused, and restarts it from beginning if it /// was it already playing. /// This function uses its own thread so that it doesn't block /// the rest of the program while the sound is played. /// /// \param sound Sound object /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSound_play(sfSound* sound); //////////////////////////////////////////////////////////// /// \brief Pause a sound /// /// This function pauses the sound if it was playing, /// otherwise (sound already paused or stopped) it has no effect. /// /// \param sound Sound object /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSound_pause(sfSound* sound); //////////////////////////////////////////////////////////// /// \brief Stop playing a sound /// /// This function stops the sound if it was playing or paused, /// and does nothing if it was already stopped. /// It also resets the playing position (unlike sfSound_pause). /// /// \param sound Sound object /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSound_stop(sfSound* sound); //////////////////////////////////////////////////////////// /// \brief Set the source buffer containing the audio data to play /// /// It is important to note that the sound buffer is not copied, /// thus the sfSoundBuffer object must remain alive as long /// as it is attached to the sound. /// /// \param sound Sound object /// \param buffer Sound buffer to attach to the sound /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSound_setBuffer(sfSound* sound, const sfSoundBuffer* buffer); //////////////////////////////////////////////////////////// /// \brief Get the audio buffer attached to a sound /// /// \param sound Sound object /// /// \return Sound buffer attached to the sound (can be NULL) /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API const sfSoundBuffer* sfSound_getBuffer(const sfSound* sound); //////////////////////////////////////////////////////////// /// \brief Set whether or not a sound should loop after reaching the end /// /// If set, the sound will restart from beginning after /// reaching the end and so on, until it is stopped or /// sfSound_setLoop(sound, sfFalse) is called. /// The default looping state for sounds is false. /// /// \param sound Sound object /// \param loop sfTrue to play in loop, sfFalse to play once /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSound_setLoop(sfSound* sound, sfBool loop); //////////////////////////////////////////////////////////// /// \brief Tell whether or not a sound is in loop mode /// /// \param sound Sound object /// /// \return sfTrue if the sound is looping, sfFalse otherwise /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfBool sfSound_getLoop(const sfSound* sound); //////////////////////////////////////////////////////////// /// \brief Get the current status of a sound (stopped, paused, playing) /// /// \param sound Sound object /// /// \return Current status /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfSoundStatus sfSound_getStatus(const sfSound* sound); //////////////////////////////////////////////////////////// /// \brief Set the pitch of a sound /// /// The pitch represents the perceived fundamental frequency /// of a sound; thus you can make a sound more acute or grave /// by changing its pitch. A side effect of changing the pitch /// is to modify the playing speed of the sound as well. /// The default value for the pitch is 1. /// /// \param sound Sound object /// \param pitch New pitch to apply to the sound /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSound_setPitch(sfSound* sound, float pitch); //////////////////////////////////////////////////////////// /// \brief Set the volume of a sound /// /// The volume is a value between 0 (mute) and 100 (full volume). /// The default value for the volume is 100. /// /// \param sound Sound object /// \param volume Volume of the sound /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSound_setVolume(sfSound* sound, float volume); //////////////////////////////////////////////////////////// /// \brief Set the 3D position of a sound in the audio scene /// /// Only sounds with one channel (mono sounds) can be /// spatialized. /// The default position of a sound is (0, 0, 0). /// /// \param sound Sound object /// \param position Position of the sound in the scene /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSound_setPosition(sfSound* sound, sfVector3f position); //////////////////////////////////////////////////////////// /// \brief Make the sound's position relative to the listener or absolute /// /// Making a sound relative to the listener will ensure that it will always /// be played the same way regardless the position of the listener. /// This can be useful for non-spatialized sounds, sounds that are /// produced by the listener, or sounds attached to it. /// The default value is false (position is absolute). /// /// \param sound Sound object /// \param relative sfTrue to set the position relative, sfFalse to set it absolute /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSound_setRelativeToListener(sfSound* sound, sfBool relative); //////////////////////////////////////////////////////////// /// \brief Set the minimum distance of a sound /// /// The "minimum distance" of a sound is the maximum /// distance at which it is heard at its maximum volume. Further /// than the minimum distance, it will start to fade out according /// to its attenuation factor. A value of 0 ("inside the head /// of the listener") is an invalid value and is forbidden. /// The default value of the minimum distance is 1. /// /// \param sound Sound object /// \param distance New minimum distance of the sound /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSound_setMinDistance(sfSound* sound, float distance); //////////////////////////////////////////////////////////// /// \brief Set the attenuation factor of a sound /// /// The attenuation is a multiplicative factor which makes /// the sound more or less loud according to its distance /// from the listener. An attenuation of 0 will produce a /// non-attenuated sound, i.e. its volume will always be the same /// whether it is heard from near or from far. On the other hand, /// an attenuation value such as 100 will make the sound fade out /// very quickly as it gets further from the listener. /// The default value of the attenuation is 1. /// /// \param sound Sound object /// \param attenuation New attenuation factor of the sound /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSound_setAttenuation(sfSound* sound, float attenuation); //////////////////////////////////////////////////////////// /// \brief Change the current playing position of a sound /// /// The playing position can be changed when the sound is /// either paused or playing. /// /// \param sound Sound object /// \param timeOffset New playing position /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSound_setPlayingOffset(sfSound* sound, sfTime timeOffset); //////////////////////////////////////////////////////////// /// \brief Get the pitch of a sound /// /// \param sound Sound object /// /// \return Pitch of the sound /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API float sfSound_getPitch(const sfSound* sound); //////////////////////////////////////////////////////////// /// \brief Get the volume of a sound /// /// \param sound Sound object /// /// \return Volume of the sound, in the range [0, 100] /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API float sfSound_getVolume(const sfSound* sound); //////////////////////////////////////////////////////////// /// \brief Get the 3D position of a sound in the audio scene /// /// \param sound Sound object /// /// \return Position of the sound in the world /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfVector3f sfSound_getPosition(const sfSound* sound); //////////////////////////////////////////////////////////// /// \brief Tell whether a sound's position is relative to the /// listener or is absolute /// /// \param sound Sound object /// /// \return sfTrue if the position is relative, sfFalse if it's absolute /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfBool sfSound_isRelativeToListener(const sfSound* sound); //////////////////////////////////////////////////////////// /// \brief Get the minimum distance of a sound /// /// \param sound Sound object /// /// \return Minimum distance of the sound /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API float sfSound_getMinDistance(const sfSound* sound); //////////////////////////////////////////////////////////// /// \brief Get the attenuation factor of a sound /// /// \param sound Sound object /// /// \return Attenuation factor of the sound /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API float sfSound_getAttenuation(const sfSound* sound); //////////////////////////////////////////////////////////// /// \brief Get the current playing position of a sound /// /// \param sound Sound object /// /// \return Current playing position /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfTime sfSound_getPlayingOffset(const sfSound* sound); #endif // SFML_SOUND_H CSFML-2.4/include/SFML/Audio/SoundBuffer.h000066400000000000000000000172041301071240500200400ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SOUNDBUFFER_H #define SFML_SOUNDBUFFER_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include //////////////////////////////////////////////////////////// /// \brief Create a new sound buffer and load it from a file /// /// Here is a complete list of all the supported audio formats: /// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, /// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64. /// /// \param filename Path of the sound file to load /// /// \return A new sfSoundBuffer object (NULL if failed) /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromFile(const char* filename); //////////////////////////////////////////////////////////// /// \brief Create a new sound buffer and load it from a file in memory /// /// Here is a complete list of all the supported audio formats: /// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, /// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64. /// /// \param data Pointer to the file data in memory /// \param sizeInBytes Size of the data to load, in bytes /// /// \return A new sfSoundBuffer object (NULL if failed) /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromMemory(const void* data, size_t sizeInBytes); //////////////////////////////////////////////////////////// /// \brief Create a new sound buffer and load it from a custom stream /// /// Here is a complete list of all the supported audio formats: /// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, /// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64. /// /// \param stream Source stream to read from /// /// \return A new sfSoundBuffer object (NULL if failed) /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromStream(sfInputStream* stream); //////////////////////////////////////////////////////////// /// \brief Create a new sound buffer and load it from an array of samples in memory /// /// The assumed format of the audio samples is 16 bits signed integer /// (sfInt16). /// /// \param samples Pointer to the array of samples in memory /// \param sampleCount Number of samples in the array /// \param channelCount Number of channels (1 = mono, 2 = stereo, ...) /// \param sampleRate Sample rate (number of samples to play per second) /// /// \return A new sfSoundBuffer object (NULL if failed) /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromSamples(const sfInt16* samples, sfUint64 sampleCount, unsigned int channelCount, unsigned int sampleRate); //////////////////////////////////////////////////////////// /// \brief Create a new sound buffer by copying an existing one /// /// \param soundBuffer Sound buffer to copy /// /// \return A new sfSoundBuffer object which is a copy of \a soundBuffer /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_copy(const sfSoundBuffer* soundBuffer); //////////////////////////////////////////////////////////// /// \brief Destroy a sound buffer /// /// \param soundBuffer Sound buffer to destroy /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSoundBuffer_destroy(sfSoundBuffer* soundBuffer); //////////////////////////////////////////////////////////// /// \brief Save a sound buffer to an audio file /// /// Here is a complete list of all the supported audio formats: /// ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, /// w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64. /// /// \param soundBuffer Sound buffer object /// \param filename Path of the sound file to write /// /// \return sfTrue if saving succeeded, sfFalse if it failed /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfBool sfSoundBuffer_saveToFile(const sfSoundBuffer* soundBuffer, const char* filename); //////////////////////////////////////////////////////////// /// \brief Get the array of audio samples stored in a sound buffer /// /// The format of the returned samples is 16 bits signed integer /// (sfInt16). The total number of samples in this array /// is given by the sfSoundBuffer_getSampleCount function. /// /// \param soundBuffer Sound buffer object /// /// \return Read-only pointer to the array of sound samples /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API const sfInt16* sfSoundBuffer_getSamples(const sfSoundBuffer* soundBuffer); //////////////////////////////////////////////////////////// /// \brief Get the number of samples stored in a sound buffer /// /// The array of samples can be accessed with the /// sfSoundBuffer_getSamples function. /// /// \param soundBuffer Sound buffer object /// /// \return Number of samples /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfUint64 sfSoundBuffer_getSampleCount(const sfSoundBuffer* soundBuffer); //////////////////////////////////////////////////////////// /// \brief Get the sample rate of a sound buffer /// /// The sample rate is the number of samples played per second. /// The higher, the better the quality (for example, 44100 /// samples/s is CD quality). /// /// \param soundBuffer Sound buffer object /// /// \return Sample rate (number of samples per second) /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API unsigned int sfSoundBuffer_getSampleRate(const sfSoundBuffer* soundBuffer); //////////////////////////////////////////////////////////// /// \brief Get the number of channels used by a sound buffer /// /// If the sound is mono then the number of channels will /// be 1, 2 for stereo, etc. /// /// \param soundBuffer Sound buffer object /// /// \return Number of channels /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API unsigned int sfSoundBuffer_getChannelCount(const sfSoundBuffer* soundBuffer); //////////////////////////////////////////////////////////// /// \brief Get the total duration of a sound buffer /// /// \param soundBuffer Sound buffer object /// /// \return Sound duration /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfTime sfSoundBuffer_getDuration(const sfSoundBuffer* soundBuffer); #endif // SFML_SOUNDBUFFER_H CSFML-2.4/include/SFML/Audio/SoundBufferRecorder.h000066400000000000000000000130131301071240500215200ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SOUNDBUFFERRECORDER_H #define SFML_SOUNDBUFFERRECORDER_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include //////////////////////////////////////////////////////////// /// \brief Create a new sound buffer recorder /// /// \return A new sfSoundBufferRecorder object (NULL if failed) /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfSoundBufferRecorder* sfSoundBufferRecorder_create(void); //////////////////////////////////////////////////////////// /// \brief Destroy a sound buffer recorder /// /// \param soundBufferRecorder Sound buffer recorder to destroy /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSoundBufferRecorder_destroy(sfSoundBufferRecorder* soundBufferRecorder); //////////////////////////////////////////////////////////// /// \brief Start the capture of a sound recorder recorder /// /// The \a sampleRate parameter defines the number of audio samples /// captured per second. The higher, the better the quality /// (for example, 44100 samples/sec is CD quality). /// This function uses its own thread so that it doesn't block /// the rest of the program while the capture runs. /// Please note that only one capture can happen at the same time. /// /// \param soundBufferRecorder Sound buffer recorder object /// \param sampleRate Desired capture rate, in number of samples per second /// /// \return sfTrue, if it was able to start recording /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfBool sfSoundBufferRecorder_start(sfSoundBufferRecorder* soundBufferRecorder, unsigned int sampleRate); //////////////////////////////////////////////////////////// /// \brief Stop the capture of a sound recorder /// /// \param soundBufferRecorder Sound buffer recorder object /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSoundBufferRecorder_stop(sfSoundBufferRecorder* soundBufferRecorder); //////////////////////////////////////////////////////////// /// \brief Get the sample rate of a sound buffer recorder /// /// The sample rate defines the number of audio samples /// captured per second. The higher, the better the quality /// (for example, 44100 samples/sec is CD quality). /// /// \param soundBufferRecorder Sound buffer recorder object /// /// \return Sample rate, in samples per second /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API unsigned int sfSoundBufferRecorder_getSampleRate(const sfSoundBufferRecorder* soundBufferRecorder); //////////////////////////////////////////////////////////// /// \brief Get the sound buffer containing the captured audio data /// /// The sound buffer is valid only after the capture has ended. /// This function provides a read-only access to the internal /// sound buffer, but it can be copied if you need to /// make any modification to it. /// /// \param soundBufferRecorder Sound buffer recorder object /// /// \return Read-only access to the sound buffer /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API const sfSoundBuffer* sfSoundBufferRecorder_getBuffer(const sfSoundBufferRecorder* soundBufferRecorder); //////////////////////////////////////////////////////////// /// \brief Set the audio capture device /// /// This function sets the audio capture device to the device /// with the given name. It can be called on the fly (i.e: /// while recording). If you do so while recording and /// opening the device fails, it stops the recording. /// /// \param soundBufferRecorder Sound buffer recorder object /// \param name The name of the audio capture device /// /// \return sfTrue, if it was able to set the requested device /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfBool sfSoundBufferRecorder_setDevice(sfSoundBufferRecorder* soundBufferRecorder, const char* name); //////////////////////////////////////////////////////////// /// \brief Get the name of the current audio capture device /// /// \param soundBufferRecorder Sound buffer recorder object /// /// \return The name of the current audio capture device /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API const char* sfSoundBufferRecorder_getDevice(sfSoundBufferRecorder* soundBufferRecorder); #endif // SFML_SOUNDBUFFERRECORDER_H CSFML-2.4/include/SFML/Audio/SoundRecorder.h000066400000000000000000000222041301071240500203700ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SOUNDRECORDER_H #define SFML_SOUNDRECORDER_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include typedef sfBool (*sfSoundRecorderStartCallback)(void*); ///< Type of the callback used when starting a capture typedef sfBool (*sfSoundRecorderProcessCallback)(const sfInt16*, size_t, void*); ///< Type of the callback used to process audio data typedef void (*sfSoundRecorderStopCallback)(void*); ///< Type of the callback used when stopping a capture //////////////////////////////////////////////////////////// /// \brief Construct a new sound recorder from callback functions /// /// \param onStart Callback function which will be called when a new capture starts (can be NULL) /// \param onProcess Callback function which will be called each time there's audio data to process /// \param onStop Callback function which will be called when the current capture stops (can be NULL) /// \param userData Data to pass to the callback function (can be NULL) /// /// \return A new sfSoundRecorder object (NULL if failed) /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfSoundRecorder* sfSoundRecorder_create(sfSoundRecorderStartCallback onStart, sfSoundRecorderProcessCallback onProcess, sfSoundRecorderStopCallback onStop, void* userData); //////////////////////////////////////////////////////////// /// \brief Destroy a sound recorder /// /// \param soundRecorder Sound recorder to destroy /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSoundRecorder_destroy(sfSoundRecorder* soundRecorder); //////////////////////////////////////////////////////////// /// \brief Start the capture of a sound recorder /// /// The \a sampleRate parameter defines the number of audio samples /// captured per second. The higher, the better the quality /// (for example, 44100 samples/sec is CD quality). /// This function uses its own thread so that it doesn't block /// the rest of the program while the capture runs. /// Please note that only one capture can happen at the same time. /// /// \param soundRecorder Sound recorder object /// \param sampleRate Desired capture rate, in number of samples per second /// /// \return True, if start of capture was successful /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfBool sfSoundRecorder_start(sfSoundRecorder* soundRecorder, unsigned int sampleRate); //////////////////////////////////////////////////////////// /// \brief Stop the capture of a sound recorder /// /// \param soundRecorder Sound recorder object /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSoundRecorder_stop(sfSoundRecorder* soundRecorder); //////////////////////////////////////////////////////////// /// \brief Get the sample rate of a sound recorder /// /// The sample rate defines the number of audio samples /// captured per second. The higher, the better the quality /// (for example, 44100 samples/sec is CD quality). /// /// \param soundRecorder Sound recorder object /// /// \return Sample rate, in samples per second /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API unsigned int sfSoundRecorder_getSampleRate(const sfSoundRecorder* soundRecorder); //////////////////////////////////////////////////////////// /// \brief Check if the system supports audio capture /// /// This function should always be called before using /// the audio capture features. If it returns false, then /// any attempt to use sfSoundRecorder will fail. /// /// \return sfTrue if audio capture is supported, sfFalse otherwise /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfBool sfSoundRecorder_isAvailable(void); //////////////////////////////////////////////////////////// /// \brief Set the processing interval /// /// The processing interval controls the period /// between calls to the onProcessSamples function. You may /// want to use a small interval if you want to process the /// recorded data in real time, for example. /// /// Note: this is only a hint, the actual period may vary. /// So don't rely on this parameter to implement precise timing. /// /// The default processing interval is 100 ms. /// /// \param soundRecorder Sound recorder object /// \param interval Processing interval /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSoundRecorder_setProcessingInterval(sfSoundRecorder* soundRecorder, sfTime interval); //////////////////////////////////////////////////////////// /// \brief Get a list of the names of all availabe audio capture devices /// /// This function returns an array of strings (null terminated), /// containing the names of all availabe audio capture devices. /// If no devices are available then NULL is returned. /// /// \param count Pointer to a variable that will be filled with the number of modes in the array /// /// \return An array of strings containing the names /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API const char** sfSoundRecorder_getAvailableDevices(size_t* count); //////////////////////////////////////////////////////////// /// \brief Get the name of the default audio capture device /// /// This function returns the name of the default audio /// capture device. If none is available, NULL is returned. /// /// \return The name of the default audio capture device (null terminated) /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API const char* sfSoundRecorder_getDefaultDevice(); //////////////////////////////////////////////////////////// /// \brief Set the audio capture device /// /// This function sets the audio capture device to the device /// with the given name. It can be called on the fly (i.e: /// while recording). If you do so while recording and /// opening the device fails, it stops the recording. /// /// \param soundRecorder Sound recorder object /// \param name The name of the audio capture device /// /// \return sfTrue, if it was able to set the requested device /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfBool sfSoundRecorder_setDevice(sfSoundRecorder* soundRecorder, const char* name); //////////////////////////////////////////////////////////// /// \brief Get the name of the current audio capture device /// /// \param soundRecorder Sound recorder object /// /// \return The name of the current audio capture device /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API const char* sfSoundRecorder_getDevice(sfSoundRecorder* soundRecorder); //////////////////////////////////////////////////////////// /// \brief Set the channel count of the audio capture device /// /// This method allows you to specify the number of channels /// used for recording. Currently only 16-bit mono and /// 16-bit stereo are supported. /// /// \param channelCount Number of channels. Currently only /// mono (1) and stereo (2) are supported. /// /// \see sfSoundRecorder_getChannelCount /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSoundRecorder_setChannelCount(sfSoundRecorder* soundRecorder, unsigned int channelCount); //////////////////////////////////////////////////////////// /// \brief Get the number of channels used by this recorder /// /// Currently only mono and stereo are supported, so the /// value is either 1 (for mono) or 2 (for stereo). /// /// \return Number of channels /// /// \see sfSoundRecorder_setChannelCount /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API unsigned int sfSoundRecorder_getChannelCount(const sfSoundRecorder* soundRecorder); #endif // SFML_SOUNDRECORDER_H CSFML-2.4/include/SFML/Audio/SoundStatus.h000066400000000000000000000032571301071240500201150ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SOUNDSTATUS_H #define SFML_SOUNDSTATUS_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// /// \brief Enumeration of statuses for sounds and musics /// //////////////////////////////////////////////////////////// typedef enum { sfStopped, ///< Sound / music is not playing sfPaused, ///< Sound / music is paused sfPlaying ///< Sound / music is playing } sfSoundStatus; #endif // SFML_SOUNDSTATUS_H CSFML-2.4/include/SFML/Audio/SoundStream.h000066400000000000000000000337111301071240500200630ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SOUNDSTREAM_H #define SFML_SOUNDSTREAM_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include //////////////////////////////////////////////////////////// /// \brief defines the data to fill by the OnGetData callback /// //////////////////////////////////////////////////////////// typedef struct { sfInt16* samples; ///< Pointer to the audio samples unsigned int sampleCount; ///< Number of samples pointed by Samples } sfSoundStreamChunk; typedef sfBool (*sfSoundStreamGetDataCallback)(sfSoundStreamChunk*, void*); ///< Type of the callback used to get a sound stream data typedef void (*sfSoundStreamSeekCallback)(sfTime, void*); ///< Type of the callback used to seek in a sound stream //////////////////////////////////////////////////////////// /// \brief Create a new sound stream /// /// \param onGetData Function called when the stream needs more data (can't be NULL) /// \param onSeek Function called when the stream seeks (can't be NULL) /// \param channelCount Number of channels to use (1 = mono, 2 = stereo) /// \param sampleRate Sample rate of the sound (44100 = CD quality) /// \param userData Data to pass to the callback functions /// /// \return A new sfSoundStream object /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfSoundStream* sfSoundStream_create(sfSoundStreamGetDataCallback onGetData, sfSoundStreamSeekCallback onSeek, unsigned int channelCount, unsigned int sampleRate, void* userData); //////////////////////////////////////////////////////////// /// \brief Destroy a sound stream /// /// \param soundStream Sound stream to destroy /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSoundStream_destroy(sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// \brief Start or resume playing a sound stream /// /// This function starts the stream if it was stopped, resumes /// it if it was paused, and restarts it from beginning if it /// was it already playing. /// This function uses its own thread so that it doesn't block /// the rest of the program while the music is played. /// /// \param soundStream Sound stream object /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSoundStream_play(sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// \brief Pause a sound stream /// /// This function pauses the stream if it was playing, /// otherwise (stream already paused or stopped) it has no effect. /// /// \param soundStream Sound stream object /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSoundStream_pause(sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// \brief Stop playing a sound stream /// /// This function stops the stream if it was playing or paused, /// and does nothing if it was already stopped. /// It also resets the playing position (unlike sfSoundStream_pause). /// /// \param soundStream Sound stream object /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSoundStream_stop(sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// \brief Get the current status of a sound stream (stopped, paused, playing) /// /// \param soundStream Sound stream object /// /// \return Current status /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfSoundStatus sfSoundStream_getStatus(const sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// \brief Return the number of channels of a sound stream /// /// 1 channel means a mono sound, 2 means stereo, etc. /// /// \param soundStream Sound stream object /// /// \return Number of channels /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API unsigned int sfSoundStream_getChannelCount(const sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// \brief Get the sample rate of a sound stream /// /// The sample rate is the number of audio samples played per /// second. The higher, the better the quality. /// /// \param soundStream Sound stream object /// /// \return Sample rate, in number of samples per second /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API unsigned int sfSoundStream_getSampleRate(const sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// \brief Set the pitch of a sound stream /// /// The pitch represents the perceived fundamental frequency /// of a sound; thus you can make a stream more acute or grave /// by changing its pitch. A side effect of changing the pitch /// is to modify the playing speed of the stream as well. /// The default value for the pitch is 1. /// /// \param soundStream Sound stream object /// \param pitch New pitch to apply to the stream /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSoundStream_setPitch(sfSoundStream* soundStream, float pitch); //////////////////////////////////////////////////////////// /// \brief Set the volume of a sound stream /// /// The volume is a value between 0 (mute) and 100 (full volume). /// The default value for the volume is 100. /// /// \param soundStream Sound stream object /// \param volume Volume of the stream /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSoundStream_setVolume(sfSoundStream* soundStream, float volume); //////////////////////////////////////////////////////////// /// \brief Set the 3D position of a sound stream in the audio scene /// /// Only streams with one channel (mono streams) can be /// spatialized. /// The default position of a stream is (0, 0, 0). /// /// \param soundStream Sound stream object /// \param position Position of the stream in the scene /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSoundStream_setPosition(sfSoundStream* soundStream, sfVector3f position); //////////////////////////////////////////////////////////// /// \brief Make a sound stream's position relative to the listener or absolute /// /// Making a stream relative to the listener will ensure that it will always /// be played the same way regardless the position of the listener. /// This can be useful for non-spatialized streams, streams that are /// produced by the listener, or streams attached to it. /// The default value is false (position is absolute). /// /// \param soundStream Sound stream object /// \param relative sfTrue to set the position relative, sfFalse to set it absolute /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSoundStream_setRelativeToListener(sfSoundStream* soundStream, sfBool relative); //////////////////////////////////////////////////////////// /// \brief Set the minimum distance of a sound stream /// /// The "minimum distance" of a stream is the maximum /// distance at which it is heard at its maximum volume. Further /// than the minimum distance, it will start to fade out according /// to its attenuation factor. A value of 0 ("inside the head /// of the listener") is an invalid value and is forbidden. /// The default value of the minimum distance is 1. /// /// \param soundStream Sound stream object /// \param distance New minimum distance of the stream /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSoundStream_setMinDistance(sfSoundStream* soundStream, float distance); //////////////////////////////////////////////////////////// /// \brief Set the attenuation factor of a sound stream /// /// The attenuation is a multiplicative factor which makes /// the stream more or less loud according to its distance /// from the listener. An attenuation of 0 will produce a /// non-attenuated stream, i.e. its volume will always be the same /// whether it is heard from near or from far. On the other hand, /// an attenuation value such as 100 will make the stream fade out /// very quickly as it gets further from the listener. /// The default value of the attenuation is 1. /// /// \param soundStream Sound stream object /// \param attenuation New attenuation factor of the stream /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSoundStream_setAttenuation(sfSoundStream* soundStream, float attenuation); //////////////////////////////////////////////////////////// /// \brief Change the current playing position of a sound stream /// /// The playing position can be changed when the stream is /// either paused or playing. /// /// \param soundStream Sound stream object /// \param timeOffset New playing position /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSoundStream_setPlayingOffset(sfSoundStream* soundStream, sfTime timeOffset); //////////////////////////////////////////////////////////// /// \brief Set whether or not a sound stream should loop after reaching the end /// /// If set, the stream will restart from beginning after /// reaching the end and so on, until it is stopped or /// sfSoundStream_setLoop(stream, sfFalse) is called. /// The default looping state for sound streams is false. /// /// \param soundStream Sound stream object /// \param loop sfTrue to play in loop, sfFalse to play once /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API void sfSoundStream_setLoop(sfSoundStream* soundStream, sfBool loop); //////////////////////////////////////////////////////////// /// \brief Get the pitch of a sound stream /// /// \param soundStream Sound stream object /// /// \return Pitch of the stream /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API float sfSoundStream_getPitch(const sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// \brief Get the volume of a sound stream /// /// \param soundStream Sound stream object /// /// \return Volume of the stream, in the range [0, 100] /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API float sfSoundStream_getVolume(const sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// \brief Get the 3D position of a sound stream in the audio scene /// /// \param soundStream Sound stream object /// /// \return Position of the stream in the world /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfVector3f sfSoundStream_getPosition(const sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// \brief Tell whether a sound stream's position is relative to the /// listener or is absolute /// /// \param soundStream Sound stream object /// /// \return sfTrue if the position is relative, sfFalse if it's absolute /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfBool sfSoundStream_isRelativeToListener(const sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// \brief Get the minimum distance of a sound stream /// /// \param soundStream Sound stream object /// /// \return Minimum distance of the stream /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API float sfSoundStream_getMinDistance(const sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// \brief Get the attenuation factor of a sound stream /// /// \param soundStream Sound stream object /// /// \return Attenuation factor of the stream /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API float sfSoundStream_getAttenuation(const sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// \brief Tell whether or not a sound stream is in loop mode /// /// \param soundStream Sound stream object /// /// \return sfTrue if the music is looping, sfFalse otherwise /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfBool sfSoundStream_getLoop(const sfSoundStream* soundStream); //////////////////////////////////////////////////////////// /// \brief Get the current playing position of a sound stream /// /// \param soundStream Sound stream object /// /// \return Current playing position /// //////////////////////////////////////////////////////////// CSFML_AUDIO_API sfTime sfSoundStream_getPlayingOffset(const sfSoundStream* soundStream); #endif // SFML_SOUNDSTREAM_H CSFML-2.4/include/SFML/Audio/Types.h000066400000000000000000000026551301071240500167260ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_AUDIO_TYPES_H #define SFML_AUDIO_TYPES_H typedef struct sfMusic sfMusic; typedef struct sfSound sfSound; typedef struct sfSoundBuffer sfSoundBuffer; typedef struct sfSoundBufferRecorder sfSoundBufferRecorder; typedef struct sfSoundRecorder sfSoundRecorder; typedef struct sfSoundStream sfSoundStream; #endif // SFML_AUDIO_TYPES_H CSFML-2.4/include/SFML/Config.h000066400000000000000000000133151301071240500157610ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_CONFIG_H #define SFML_CONFIG_H //////////////////////////////////////////////////////////// // Define the CSFML version //////////////////////////////////////////////////////////// #define CSFML_VERSION_MAJOR 2 #define CSFML_VERSION_MINOR 4 #define CSFML_VERSION_PATCH 0 //////////////////////////////////////////////////////////// // Check if we need to mark functions as extern "C" //////////////////////////////////////////////////////////// #ifdef __cplusplus #define CSFML_EXTERN_C extern "C" #else #define CSFML_EXTERN_C extern #endif //////////////////////////////////////////////////////////// // Identify the operating system //////////////////////////////////////////////////////////// #if defined(_WIN32) || defined(__WIN32__) // Windows #define CSFML_SYSTEM_WINDOWS #elif defined(linux) || defined(__linux) // Linux #define CSFML_SYSTEM_LINUX #elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh) // MacOS #define CSFML_SYSTEM_MACOS #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) // FreeBSD #define CSFML_SYSTEM_FREEBSD #else // Unsupported system #error This operating system is not supported by SFML library #endif //////////////////////////////////////////////////////////// // Define helpers to create portable import / export macros for each module //////////////////////////////////////////////////////////// #if defined(CSFML_SYSTEM_WINDOWS) // Windows compilers need specific (and different) keywords for export and import #define CSFML_API_EXPORT extern "C" __declspec(dllexport) #define CSFML_API_IMPORT CSFML_EXTERN_C __declspec(dllimport) // For Visual C++ compilers, we also need to turn off this annoying C4251 warning #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, // the same keyword is used for both importing and exporting #define CSFML_API_EXPORT extern "C" __attribute__ ((__visibility__ ("default"))) #define CSFML_API_IMPORT CSFML_EXTERN_C __attribute__ ((__visibility__ ("default"))) #else // GCC < 4 has no mechanism to explicitely hide symbols, everything's exported #define CSFML_API_EXPORT extern "C" #define CSFML_API_IMPORT CSFML_EXTERN_C #endif #endif //////////////////////////////////////////////////////////// // Cross-platform warning for deprecated functions and classes // // Usage: // struct CSFML_DEPRECATED MyStruct // { // ... // }; // // CSFML_DEPRECATED void globalFunc(); //////////////////////////////////////////////////////////// #if defined(CSFML_NO_DEPRECATED_WARNINGS) // User explicitly requests to disable deprecation warnings #define CSFML_DEPRECATED #elif defined(_MSC_VER) // Microsoft C++ compiler // Note: On newer MSVC versions, using deprecated functions causes a compiler error. In order to // trigger a warning instead of an error, the compiler flag /sdl- (instead of /sdl) must be specified. #define CSFML_DEPRECATED __declspec(deprecated) #elif defined(__GNUC__) // g++ and Clang #define CSFML_DEPRECATED __attribute__ ((deprecated)) #else // Other compilers are not supported, leave class or function as-is. // With a bit of luck, the #pragma directive works, otherwise users get a warning (no error!) for unrecognized #pragma. #pragma message("CSFML_DEPRECATED is not supported for your compiler, please contact the CSFML team") #define CSFML_DEPRECATED #endif //////////////////////////////////////////////////////////// // Define a portable boolean type //////////////////////////////////////////////////////////// typedef int sfBool; #define sfFalse 0 #define sfTrue 1 //////////////////////////////////////////////////////////// // Define portable fixed-size types //////////////////////////////////////////////////////////// // All "common" platforms use the same size for char, short and int // (basically there are 3 types for 3 sizes, so no other match is possible), // we can use them without doing any kind of check // 8 bits integer types typedef signed char sfInt8; typedef unsigned char sfUint8; // 16 bits integer types typedef signed short sfInt16; typedef unsigned short sfUint16; // 32 bits integer types typedef signed int sfInt32; typedef unsigned int sfUint32; // 64 bits integer types #if defined(_MSC_VER) typedef signed __int64 sfInt64; typedef unsigned __int64 sfUint64; #else typedef signed long long sfInt64; typedef unsigned long long sfUint64; #endif #endif // SFML_CONFIG_H CSFML-2.4/include/SFML/Graphics.h000066400000000000000000000042431301071240500163140ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_GRAPHICS_H #define SFML_GRAPHICS_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #endif // SFML_GRAPHICS_H CSFML-2.4/include/SFML/Graphics/000077500000000000000000000000001301071240500161405ustar00rootroot00000000000000CSFML-2.4/include/SFML/Graphics/BlendMode.h000066400000000000000000000073311301071240500201460ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_BLENDMODE_H #define SFML_BLENDMODE_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// /// \brief Enumeration of the blending factors /// //////////////////////////////////////////////////////////// typedef enum { sfBlendFactorZero, ///< (0, 0, 0, 0) sfBlendFactorOne, ///< (1, 1, 1, 1) sfBlendFactorSrcColor, ///< (src.r, src.g, src.b, src.a) sfBlendFactorOneMinusSrcColor, ///< (1, 1, 1, 1) - (src.r, src.g, src.b, src.a) sfBlendFactorDstColor, ///< (dst.r, dst.g, dst.b, dst.a) sfBlendFactorOneMinusDstColor, ///< (1, 1, 1, 1) - (dst.r, dst.g, dst.b, dst.a) sfBlendFactorSrcAlpha, ///< (src.a, src.a, src.a, src.a) sfBlendFactorOneMinusSrcAlpha, ///< (1, 1, 1, 1) - (src.a, src.a, src.a, src.a) sfBlendFactorDstAlpha, ///< (dst.a, dst.a, dst.a, dst.a) sfBlendFactorOneMinusDstAlpha ///< (1, 1, 1, 1) - (dst.a, dst.a, dst.a, dst.a) } sfBlendFactor; //////////////////////////////////////////////////////////// /// \brief Enumeration of the blending equations /// //////////////////////////////////////////////////////////// typedef enum { sfBlendEquationAdd, ///< Pixel = Src * SrcFactor + Dst * DstFactor sfBlendEquationSubtract, ///< Pixel = Src * SrcFactor - Dst * DstFactor sfBlendEquationReverseSubtract ///< Pixel = Dst * DstFactor - Src * SrcFactor } sfBlendEquation; //////////////////////////////////////////////////////////// /// \brief Blending mode for drawing /// //////////////////////////////////////////////////////////// typedef struct { sfBlendFactor colorSrcFactor; ///< Source blending factor for the color channels sfBlendFactor colorDstFactor; ///< Destination blending factor for the color channels sfBlendEquation colorEquation; ///< Blending equation for the color channels sfBlendFactor alphaSrcFactor; ///< Source blending factor for the alpha channel sfBlendFactor alphaDstFactor; ///< Destination blending factor for the alpha channel sfBlendEquation alphaEquation; ///< Blending equation for the alpha channel } sfBlendMode; CSFML_GRAPHICS_API const sfBlendMode sfBlendAlpha; ///< Blend source and dest according to dest alpha CSFML_GRAPHICS_API const sfBlendMode sfBlendAdd; ///< Add source to dest CSFML_GRAPHICS_API const sfBlendMode sfBlendMultiply; ///< Multiply source and dest CSFML_GRAPHICS_API const sfBlendMode sfBlendNone; ///< Overwrite dest with source #endif // SFML_BLENDMODE_H CSFML-2.4/include/SFML/Graphics/CircleShape.h000066400000000000000000000402431301071240500204760ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_CIRCLESHAPE_H #define SFML_CIRCLESHAPE_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include #include //////////////////////////////////////////////////////////// /// \brief Create a new circle shape /// /// \return A new sfCircleShape object, or NULL if it failed /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfCircleShape* sfCircleShape_create(void); //////////////////////////////////////////////////////////// /// \brief Copy an existing circle shape /// /// \param shape Shape to copy /// /// \return Copied object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfCircleShape* sfCircleShape_copy(const sfCircleShape* shape); //////////////////////////////////////////////////////////// /// \brief Destroy an existing circle Shape /// /// \param shape Shape to delete /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfCircleShape_destroy(sfCircleShape* shape); //////////////////////////////////////////////////////////// /// \brief Set the position of a circle shape /// /// This function completely overwrites the previous position. /// See sfCircleShape_move to apply an offset based on the previous position instead. /// The default position of a circle Shape object is (0, 0). /// /// \param shape Shape object /// \param position New position /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfCircleShape_setPosition(sfCircleShape* shape, sfVector2f position); //////////////////////////////////////////////////////////// /// \brief Set the orientation of a circle shape /// /// This function completely overwrites the previous rotation. /// See sfCircleShape_rotate to add an angle based on the previous rotation instead. /// The default rotation of a circle Shape object is 0. /// /// \param shape Shape object /// \param angle New rotation, in degrees /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfCircleShape_setRotation(sfCircleShape* shape, float angle); //////////////////////////////////////////////////////////// /// \brief Set the scale factors of a circle shape /// /// This function completely overwrites the previous scale. /// See sfCircleShape_scale to add a factor based on the previous scale instead. /// The default scale of a circle Shape object is (1, 1). /// /// \param shape Shape object /// \param scale New scale factors /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfCircleShape_setScale(sfCircleShape* shape, sfVector2f scale); //////////////////////////////////////////////////////////// /// \brief Set the local origin of a circle shape /// /// The origin of an object defines the center point for /// all transformations (position, scale, rotation). /// The coordinates of this point must be relative to the /// top-left corner of the object, and ignore all /// transformations (position, scale, rotation). /// The default origin of a circle Shape object is (0, 0). /// /// \param shape Shape object /// \param origin New origin /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfCircleShape_setOrigin(sfCircleShape* shape, sfVector2f origin); //////////////////////////////////////////////////////////// /// \brief Get the position of a circle shape /// /// \param shape Shape object /// /// \return Current position /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfCircleShape_getPosition(const sfCircleShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the orientation of a circle shape /// /// The rotation is always in the range [0, 360]. /// /// \param shape Shape object /// /// \return Current rotation, in degrees /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API float sfCircleShape_getRotation(const sfCircleShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the current scale of a circle shape /// /// \param shape Shape object /// /// \return Current scale factors /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfCircleShape_getScale(const sfCircleShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the local origin of a circle shape /// /// \param shape Shape object /// /// \return Current origin /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfCircleShape_getOrigin(const sfCircleShape* shape); //////////////////////////////////////////////////////////// /// \brief Move a circle shape by a given offset /// /// This function adds to the current position of the object, /// unlike sfCircleShape_setPosition which overwrites it. /// /// \param shape Shape object /// \param offset Offset /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfCircleShape_move(sfCircleShape* shape, sfVector2f offset); //////////////////////////////////////////////////////////// /// \brief Rotate a circle shape /// /// This function adds to the current rotation of the object, /// unlike sfCircleShape_setRotation which overwrites it. /// /// \param shape Shape object /// \param angle Angle of rotation, in degrees /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfCircleShape_rotate(sfCircleShape* shape, float angle); //////////////////////////////////////////////////////////// /// \brief Scale a circle shape /// /// This function multiplies the current scale of the object, /// unlike sfCircleShape_setScale which overwrites it. /// /// \param shape Shape object /// \param factors Scale factors /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfCircleShape_scale(sfCircleShape* shape, sfVector2f factors); //////////////////////////////////////////////////////////// /// \brief Get the combined transform of a circle shape /// /// \param shape Shape object /// /// \return Transform combining the position/rotation/scale/origin of the object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfTransform sfCircleShape_getTransform(const sfCircleShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the inverse of the combined transform of a circle shape /// /// \param shape Shape object /// /// \return Inverse of the combined transformations applied to the object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfTransform sfCircleShape_getInverseTransform(const sfCircleShape* shape); //////////////////////////////////////////////////////////// /// \brief Change the source texture of a circle shape /// /// The \a texture argument refers to a texture that must /// exist as long as the shape uses it. Indeed, the shape /// doesn't store its own copy of the texture, but rather keeps /// a pointer to the one that you passed to this function. /// If the source texture is destroyed and the shape tries to /// use it, the behaviour is undefined. /// \a texture can be NULL to disable texturing. /// If \a resetRect is true, the TextureRect property of /// the shape is automatically adjusted to the size of the new /// texture. If it is false, the texture rect is left unchanged. /// /// \param shape Shape object /// \param texture New texture /// \param resetRect Should the texture rect be reset to the size of the new texture? /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfCircleShape_setTexture(sfCircleShape* shape, const sfTexture* texture, sfBool resetRect); //////////////////////////////////////////////////////////// /// \brief Set the sub-rectangle of the texture that a circle shape will display /// /// The texture rect is useful when you don't want to display /// the whole texture, but rather a part of it. /// By default, the texture rect covers the entire texture. /// /// \param shape Shape object /// \param rect Rectangle defining the region of the texture to display /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfCircleShape_setTextureRect(sfCircleShape* shape, sfIntRect rect); //////////////////////////////////////////////////////////// /// \brief Set the fill color of a circle shape /// /// This color is modulated (multiplied) with the shape's /// texture if any. It can be used to colorize the shape, /// or change its global opacity. /// You can use sfTransparent to make the inside of /// the shape transparent, and have the outline alone. /// By default, the shape's fill color is opaque white. /// /// \param shape Shape object /// \param color New color of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfCircleShape_setFillColor(sfCircleShape* shape, sfColor color); //////////////////////////////////////////////////////////// /// \brief Set the outline color of a circle shape /// /// You can use sfTransparent to disable the outline. /// By default, the shape's outline color is opaque white. /// /// \param shape Shape object /// \param color New outline color of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfCircleShape_setOutlineColor(sfCircleShape* shape, sfColor color); //////////////////////////////////////////////////////////// /// \brief Set the thickness of a circle shape's outline /// /// This number cannot be negative. Using zero disables /// the outline. /// By default, the outline thickness is 0. /// /// \param shape Shape object /// \param thickness New outline thickness /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfCircleShape_setOutlineThickness(sfCircleShape* shape, float thickness); //////////////////////////////////////////////////////////// /// \brief Get the source texture of a circle shape /// /// If the shape has no source texture, a NULL pointer is returned. /// The returned pointer is const, which means that you can't /// modify the texture when you retrieve it with this function. /// /// \param shape Shape object /// /// \return Pointer to the shape's texture /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API const sfTexture* sfCircleShape_getTexture(const sfCircleShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the sub-rectangle of the texture displayed by a circle shape /// /// \param shape Shape object /// /// \return Texture rectangle of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfIntRect sfCircleShape_getTextureRect(const sfCircleShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the fill color of a circle shape /// /// \param shape Shape object /// /// \return Fill color of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfColor sfCircleShape_getFillColor(const sfCircleShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the outline color of a circle shape /// /// \param shape Shape object /// /// \return Outline color of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfColor sfCircleShape_getOutlineColor(const sfCircleShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the outline thickness of a circle shape /// /// \param shape Shape object /// /// \return Outline thickness of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API float sfCircleShape_getOutlineThickness(const sfCircleShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the total number of points of a circle shape /// /// \param shape Shape object /// /// \return Number of points of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API size_t sfCircleShape_getPointCount(const sfCircleShape* shape); //////////////////////////////////////////////////////////// /// \brief Get a point of a circle shape /// /// The result is undefined if \a index is out of the valid range. /// /// \param shape Shape object /// \param index Index of the point to get, in range [0 .. getPointCount() - 1] /// /// \return Index-th point of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfCircleShape_getPoint(const sfCircleShape* shape, size_t index); //////////////////////////////////////////////////////////// /// \brief Set the radius of a circle /// /// \param shape Shape object /// \param radius New radius of the circle /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfCircleShape_setRadius(sfCircleShape* shape, float radius); //////////////////////////////////////////////////////////// /// \brief Get the radius of a circle /// /// \param shape Shape object /// /// \return Radius of the circle /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API float sfCircleShape_getRadius(const sfCircleShape* shape); //////////////////////////////////////////////////////////// /// \brief Set the number of points of a circle /// /// \param shape Shape object /// \param count New number of points of the circle /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfCircleShape_setPointCount(sfCircleShape* shape, size_t count); //////////////////////////////////////////////////////////// /// \brief Get the local bounding rectangle of a circle shape /// /// The returned rectangle is in local coordinates, which means /// that it ignores the transformations (translation, rotation, /// scale, ...) that are applied to the entity. /// In other words, this function returns the bounds of the /// entity in the entity's coordinate system. /// /// \param shape Shape object /// /// \return Local bounding rectangle of the entity /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfFloatRect sfCircleShape_getLocalBounds(const sfCircleShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the global bounding rectangle of a circle shape /// /// The returned rectangle is in global coordinates, which means /// that it takes in account the transformations (translation, /// rotation, scale, ...) that are applied to the entity. /// In other words, this function returns the bounds of the /// sprite in the global 2D world's coordinate system. /// /// \param shape Shape object /// /// \return Global bounding rectangle of the entity /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfFloatRect sfCircleShape_getGlobalBounds(const sfCircleShape* shape); #endif // SFML_CIRCLESHAPE_H CSFML-2.4/include/SFML/Graphics/Color.h000066400000000000000000000116511301071240500173730ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_COLOR_H #define SFML_COLOR_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// /// \brief Utility class for manpulating RGBA colors /// //////////////////////////////////////////////////////////// typedef struct { sfUint8 r; sfUint8 g; sfUint8 b; sfUint8 a; } sfColor; CSFML_GRAPHICS_API sfColor sfBlack; ///< Black predefined color CSFML_GRAPHICS_API sfColor sfWhite; ///< White predefined color CSFML_GRAPHICS_API sfColor sfRed; ///< Red predefined color CSFML_GRAPHICS_API sfColor sfGreen; ///< Green predefined color CSFML_GRAPHICS_API sfColor sfBlue; ///< Blue predefined color CSFML_GRAPHICS_API sfColor sfYellow; ///< Yellow predefined color CSFML_GRAPHICS_API sfColor sfMagenta; ///< Magenta predefined color CSFML_GRAPHICS_API sfColor sfCyan; ///< Cyan predefined color CSFML_GRAPHICS_API sfColor sfTransparent; ///< Transparent (black) predefined color //////////////////////////////////////////////////////////// /// \brief Construct a color from its 3 RGB components /// /// \param red Red component (0 .. 255) /// \param green Green component (0 .. 255) /// \param blue Blue component (0 .. 255) /// /// \return sfColor constructed from the components /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfColor sfColor_fromRGB(sfUint8 red, sfUint8 green, sfUint8 blue); //////////////////////////////////////////////////////////// /// \brief Construct a color from its 4 RGBA components /// /// \param red Red component (0 .. 255) /// \param green Green component (0 .. 255) /// \param blue Blue component (0 .. 255) /// \param alpha Alpha component (0 .. 255) /// /// \return sfColor constructed from the components /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfColor sfColor_fromRGBA(sfUint8 red, sfUint8 green, sfUint8 blue, sfUint8 alpha); //////////////////////////////////////////////////////////// /// \brief Construct the color from 32-bit unsigned integer /// /// \param color Number containing the RGBA components (in that order) /// /// \return sfColor constructed from the 32-bit unsigned integer /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfColor sfColor_fromInteger(sfUint32 color); //////////////////////////////////////////////////////////// /// \brief Convert a color to a 32-bit unsigned integer /// /// \return Color represented as a 32-bit unsigned integer /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfUint32 sfColor_toInteger(sfColor color); //////////////////////////////////////////////////////////// /// \brief Add two colors /// /// \param color1 First color /// \param color2 Second color /// /// \return Component-wise saturated addition of the two colors /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfColor sfColor_add(sfColor color1, sfColor color2); //////////////////////////////////////////////////////////// /// \brief Subtract two colors /// /// \param color1 First color /// \param color2 Second color /// /// \return Component-wise saturated subtraction of the two colors /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfColor sfColor_subtract(sfColor color1, sfColor color2); //////////////////////////////////////////////////////////// /// \brief Modulate two colors /// /// \param color1 First color /// \param color2 Second color /// /// \return Component-wise multiplication of the two colors /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfColor sfColor_modulate(sfColor color1, sfColor color2); #endif // SFML_COLOR_H CSFML-2.4/include/SFML/Graphics/ConvexShape.h000066400000000000000000000404211301071240500205350ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_CONVEXSHAPE_H #define SFML_CONVEXSHAPE_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include #include //////////////////////////////////////////////////////////// /// \brief Create a new convex shape /// /// \return A new sfConvexShape object, or NULL if it failed /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfConvexShape* sfConvexShape_create(void); //////////////////////////////////////////////////////////// /// \brief Copy an existing convex shape /// /// \param shape Shape to copy /// /// \return Copied object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfConvexShape* sfConvexShape_copy(const sfConvexShape* shape); //////////////////////////////////////////////////////////// /// \brief Destroy an existing convex Shape /// /// \param shape Shape to delete /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfConvexShape_destroy(sfConvexShape* shape); //////////////////////////////////////////////////////////// /// \brief Set the position of a convex shape /// /// This function completely overwrites the previous position. /// See sfConvexShape_move to apply an offset based on the previous position instead. /// The default position of a circle Shape object is (0, 0). /// /// \param shape Shape object /// \param position New position /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfConvexShape_setPosition(sfConvexShape* shape, sfVector2f position); //////////////////////////////////////////////////////////// /// \brief Set the orientation of a convex shape /// /// This function completely overwrites the previous rotation. /// See sfConvexShape_rotate to add an angle based on the previous rotation instead. /// The default rotation of a circle Shape object is 0. /// /// \param shape Shape object /// \param angle New rotation, in degrees /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfConvexShape_setRotation(sfConvexShape* shape, float angle); //////////////////////////////////////////////////////////// /// \brief Set the scale factors of a convex shape /// /// This function completely overwrites the previous scale. /// See sfConvexShape_scale to add a factor based on the previous scale instead. /// The default scale of a circle Shape object is (1, 1). /// /// \param shape Shape object /// \param scale New scale factors /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfConvexShape_setScale(sfConvexShape* shape, sfVector2f scale); //////////////////////////////////////////////////////////// /// \brief Set the local origin of a convex shape /// /// The origin of an object defines the center point for /// all transformations (position, scale, rotation). /// The coordinates of this point must be relative to the /// top-left corner of the object, and ignore all /// transformations (position, scale, rotation). /// The default origin of a circle Shape object is (0, 0). /// /// \param shape Shape object /// \param origin New origin /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfConvexShape_setOrigin(sfConvexShape* shape, sfVector2f origin); //////////////////////////////////////////////////////////// /// \brief Get the position of a convex shape /// /// \param shape Shape object /// /// \return Current position /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfConvexShape_getPosition(const sfConvexShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the orientation of a convex shape /// /// The rotation is always in the range [0, 360]. /// /// \param shape Shape object /// /// \return Current rotation, in degrees /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API float sfConvexShape_getRotation(const sfConvexShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the current scale of a convex shape /// /// \param shape Shape object /// /// \return Current scale factors /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfConvexShape_getScale(const sfConvexShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the local origin of a convex shape /// /// \param shape Shape object /// /// \return Current origin /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfConvexShape_getOrigin(const sfConvexShape* shape); //////////////////////////////////////////////////////////// /// \brief Move a convex shape by a given offset /// /// This function adds to the current position of the object, /// unlike sfConvexShape_setPosition which overwrites it. /// /// \param shape Shape object /// \param offset Offset /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfConvexShape_move(sfConvexShape* shape, sfVector2f offset); //////////////////////////////////////////////////////////// /// \brief Rotate a convex shape /// /// This function adds to the current rotation of the object, /// unlike sfConvexShape_setRotation which overwrites it. /// /// \param shape Shape object /// \param angle Angle of rotation, in degrees /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfConvexShape_rotate(sfConvexShape* shape, float angle); //////////////////////////////////////////////////////////// /// \brief Scale a convex shape /// /// This function multiplies the current scale of the object, /// unlike sfConvexShape_setScale which overwrites it. /// /// \param shape Shape object /// \param factors Scale factors /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfConvexShape_scale(sfConvexShape* shape, sfVector2f factors); //////////////////////////////////////////////////////////// /// \brief Get the combined transform of a convex shape /// /// \param shape shape object /// /// \return Transform combining the position/rotation/scale/origin of the object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfTransform sfConvexShape_getTransform(const sfConvexShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the inverse of the combined transform of a convex shape /// /// \param shape shape object /// /// \return Inverse of the combined transformations applied to the object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfTransform sfConvexShape_getInverseTransform(const sfConvexShape* shape); //////////////////////////////////////////////////////////// /// \brief Change the source texture of a convex shape /// /// The \a texture argument refers to a texture that must /// exist as long as the shape uses it. Indeed, the shape /// doesn't store its own copy of the texture, but rather keeps /// a pointer to the one that you passed to this function. /// If the source texture is destroyed and the shape tries to /// use it, the behaviour is undefined. /// \a texture can be NULL to disable texturing. /// If \a resetRect is true, the TextureRect property of /// the shape is automatically adjusted to the size of the new /// texture. If it is false, the texture rect is left unchanged. /// /// \param shape Shape object /// \param texture New texture /// \param resetRect Should the texture rect be reset to the size of the new texture? /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfConvexShape_setTexture(sfConvexShape* shape, const sfTexture* texture, sfBool resetRect); //////////////////////////////////////////////////////////// /// \brief Set the sub-rectangle of the texture that a convex shape will display /// /// The texture rect is useful when you don't want to display /// the whole texture, but rather a part of it. /// By default, the texture rect covers the entire texture. /// /// \param shape Shape object /// \param rect Rectangle defining the region of the texture to display /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfConvexShape_setTextureRect(sfConvexShape* shape, sfIntRect rect); //////////////////////////////////////////////////////////// /// \brief Set the fill color of a convex shape /// /// This color is modulated (multiplied) with the shape's /// texture if any. It can be used to colorize the shape, /// or change its global opacity. /// You can use sfTransparent to make the inside of /// the shape transparent, and have the outline alone. /// By default, the shape's fill color is opaque white. /// /// \param shape Shape object /// \param color New color of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfConvexShape_setFillColor(sfConvexShape* shape, sfColor color); //////////////////////////////////////////////////////////// /// \brief Set the outline color of a convex shape /// /// You can use sfTransparent to disable the outline. /// By default, the shape's outline color is opaque white. /// /// \param shape Shape object /// \param color New outline color of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfConvexShape_setOutlineColor(sfConvexShape* shape, sfColor color); //////////////////////////////////////////////////////////// /// \brief Set the thickness of a convex shape's outline /// /// This number cannot be negative. Using zero disables /// the outline. /// By default, the outline thickness is 0. /// /// \param shape Shape object /// \param thickness New outline thickness /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfConvexShape_setOutlineThickness(sfConvexShape* shape, float thickness); //////////////////////////////////////////////////////////// /// \brief Get the source texture of a convex shape /// /// If the shape has no source texture, a NULL pointer is returned. /// The returned pointer is const, which means that you can't /// modify the texture when you retrieve it with this function. /// /// \param shape Shape object /// /// \return Pointer to the shape's texture /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API const sfTexture* sfConvexShape_getTexture(const sfConvexShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the sub-rectangle of the texture displayed by a convex shape /// /// \param shape Shape object /// /// \return Texture rectangle of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfIntRect sfConvexShape_getTextureRect(const sfConvexShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the fill color of a convex shape /// /// \param shape Shape object /// /// \return Fill color of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfColor sfConvexShape_getFillColor(const sfConvexShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the outline color of a convex shape /// /// \param shape Shape object /// /// \return Outline color of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfColor sfConvexShape_getOutlineColor(const sfConvexShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the outline thickness of a convex shape /// /// \param shape Shape object /// /// \return Outline thickness of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API float sfConvexShape_getOutlineThickness(const sfConvexShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the total number of points of a convex shape /// /// \param shape Shape object /// /// \return Number of points of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API size_t sfConvexShape_getPointCount(const sfConvexShape* shape); //////////////////////////////////////////////////////////// /// \brief Get a point of a convex shape /// /// The result is undefined if \a index is out of the valid range. /// /// \param shape Shape object /// \param index Index of the point to get, in range [0 .. getPointCount() - 1] /// /// \return Index-th point of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfConvexShape_getPoint(const sfConvexShape* shape, size_t index); //////////////////////////////////////////////////////////// /// \brief Set the number of points of a convex shap /// /// \a count must be greater than 2 to define a valid shape. /// /// \param shape Shape object /// \param count New number of points of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfConvexShape_setPointCount(sfConvexShape* shape, size_t count); //////////////////////////////////////////////////////////// /// \brief Set the position of a point in a convex shape /// /// Don't forget that the polygon must remain convex, and /// the points need to stay ordered! /// setPointCount must be called first in order to set the total /// number of points. The result is undefined if \a index is out /// of the valid range. /// /// \param shape Shape object /// \param index Index of the point to change, in range [0 .. GetPointCount() - 1] /// \param point New point /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfConvexShape_setPoint(sfConvexShape* shape, size_t index, sfVector2f point); //////////////////////////////////////////////////////////// /// \brief Get the local bounding rectangle of a convex shape /// /// The returned rectangle is in local coordinates, which means /// that it ignores the transformations (translation, rotation, /// scale, ...) that are applied to the entity. /// In other words, this function returns the bounds of the /// entity in the entity's coordinate system. /// /// \param shape Shape object /// /// \return Local bounding rectangle of the entity /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfFloatRect sfConvexShape_getLocalBounds(const sfConvexShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the global bounding rectangle of a convex shape /// /// The returned rectangle is in global coordinates, which means /// that it takes in account the transformations (translation, /// rotation, scale, ...) that are applied to the entity. /// In other words, this function returns the bounds of the /// sprite in the global 2D world's coordinate system. /// /// \param shape Shape object /// /// \return Global bounding rectangle of the entity /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfFloatRect sfConvexShape_getGlobalBounds(const sfConvexShape* shape); #endif // SFML_CONVEXSHAPE_H CSFML-2.4/include/SFML/Graphics/Export.h000066400000000000000000000032151301071240500175730ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_GRAPHICS_EXPORT_H #define SFML_GRAPHICS_EXPORT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// // Define portable import / export macros //////////////////////////////////////////////////////////// #if defined(CSFML_GRAPHICS_EXPORTS) #define CSFML_GRAPHICS_API CSFML_API_EXPORT #else #define CSFML_GRAPHICS_API CSFML_API_IMPORT #endif #endif // SFML_GRAPHICS_EXPORT_H CSFML-2.4/include/SFML/Graphics/Font.h000066400000000000000000000151341301071240500172230ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_FONT_H #define SFML_FONT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include //////////////////////////////////////////////////////////// /// \brief Create a new font from a file /// /// \param filename Path of the font file to load /// /// \return A new sfFont object, or NULL if it failed /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfFont* sfFont_createFromFile(const char* filename); //////////////////////////////////////////////////////////// /// \brief Create a new image font a file in memory /// /// \param data Pointer to the file data in memory /// \param sizeInBytes Size of the data to load, in bytes /// /// \return A new sfFont object, or NULL if it failed /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfFont* sfFont_createFromMemory(const void* data, size_t sizeInBytes); //////////////////////////////////////////////////////////// /// \brief Create a new image font a custom stream /// /// \param stream Source stream to read from /// /// \return A new sfFont object, or NULL if it failed /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfFont* sfFont_createFromStream(sfInputStream* stream); //////////////////////////////////////////////////////////// /// \brief Copy an existing font /// /// \param font Font to copy /// /// \return Copied object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfFont* sfFont_copy(const sfFont* font); //////////////////////////////////////////////////////////// /// \brief Destroy an existing font /// /// \param font Font to delete /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfFont_destroy(sfFont* font); //////////////////////////////////////////////////////////// /// \brief Get a glyph in a font /// /// \param font Source font /// \param codePoint Unicode code point of the character to get /// \param characterSize Character size, in pixels /// \param bold Retrieve the bold version or the regular one? /// \param outlineThickness Thickness of outline (when != 0 the glyph will not be filled) /// /// \return The corresponding glyph /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfGlyph sfFont_getGlyph(sfFont* font, sfUint32 codePoint, unsigned int characterSize, sfBool bold, float outlineThickness); //////////////////////////////////////////////////////////// /// \brief Get the kerning value corresponding to a given pair of characters in a font /// /// \param font Source font /// \param first Unicode code point of the first character /// \param second Unicode code point of the second character /// \param characterSize Character size, in pixels /// /// \return Kerning offset, in pixels /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API float sfFont_getKerning(sfFont* font, sfUint32 first, sfUint32 second, unsigned int characterSize); //////////////////////////////////////////////////////////// /// \brief Get the line spacing value /// /// \param font Source font /// \param characterSize Character size, in pixels /// /// \return Line spacing, in pixels /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API float sfFont_getLineSpacing(sfFont* font, unsigned int characterSize); //////////////////////////////////////////////////////////// /// \brief Get the position of the underline /// /// Underline position is the vertical offset to apply between the /// baseline and the underline. /// /// \param font Source font /// \param characterSize Reference character size /// /// \return Underline position, in pixels /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API float sfFont_getUnderlinePosition(sfFont* font, unsigned int characterSize); //////////////////////////////////////////////////////////// /// \brief Get the thickness of the underline /// /// Underline thickness is the vertical size of the underline. /// /// \param font Source font /// \param characterSize Reference character size /// /// \return Underline thickness, in pixels /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API float sfFont_getUnderlineThickness(sfFont* font, unsigned int characterSize); //////////////////////////////////////////////////////////// /// \brief Get the texture containing the glyphs of a given size in a font /// /// \param font Source font /// \param characterSize Character size, in pixels /// /// \return Read-only pointer to the texture /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API const sfTexture* sfFont_getTexture(sfFont* font, unsigned int characterSize); //////////////////////////////////////////////////////////// /// \brief Get the font information /// /// The returned structure will remain valid only if the font /// is still valid. If the font is invalid an invalid structure /// is returned. /// /// \param font Source font /// /// \return A structure that holds the font information /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfFontInfo sfFont_getInfo(const sfFont* font); #endif // SFML_FONT_H CSFML-2.4/include/SFML/Graphics/FontInfo.h000066400000000000000000000030561301071240500200370ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_FONTINFO_H #define SFML_FONTINFO_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// /// sfFontInfo holds various information about a font //////////////////////////////////////////////////////////// typedef struct { const char* family; } sfFontInfo; #endif // SFML_FONTINFO_H CSFML-2.4/include/SFML/Graphics/Glsl.h000066400000000000000000000041521301071240500172140ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_GLSL_H #define SFML_GLSL_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include // 2D vectors typedef sfVector2f sfGlslVec2; typedef sfVector2i sfGlslIvec2; typedef struct { sfBool x; sfBool y; } sfGlslBvec2; // 3D vectors typedef sfVector3f sfGlslVec3; typedef struct { int x; int y; int z; } sfGlslIvec3; typedef struct { sfBool x; sfBool y; sfBool z; } sfGlslBvec3; // 4D vectors typedef struct { float x; float y; float z; float w; } sfGlslVec4; typedef struct { int x; int y; int z; int w; } sfGlslIvec4; typedef struct { sfBool x; sfBool y; sfBool z; sfBool w; } sfGlslBvec4; // matrices typedef struct { float array[3 * 3]; } sfGlslMat3; typedef struct { float array[4 * 4]; } sfGlslMat4; #endif // SFML_GLSL_H CSFML-2.4/include/SFML/Graphics/Glyph.h000066400000000000000000000034551301071240500174030ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_GLYPH_H #define SFML_GLYPH_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// /// \brief sfGlyph describes a glyph (a visual character) /// //////////////////////////////////////////////////////////// typedef struct { float advance; ///< Offset to move horizontically to the next character sfFloatRect bounds; ///< Bounding rectangle of the glyph, in coordinates relative to the baseline sfIntRect textureRect; ///< Texture coordinates of the glyph inside the font's image } sfGlyph; #endif // SFML_GLYPH_H CSFML-2.4/include/SFML/Graphics/Image.h000066400000000000000000000244451301071240500173440ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_IMAGE_H #define SFML_IMAGE_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include #include //////////////////////////////////////////////////////////// /// \brief Create an image /// /// This image is filled with black pixels. /// /// \param width Width of the image /// \param height Height of the image /// /// \return A new sfImage object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfImage* sfImage_create(unsigned int width, unsigned int height); //////////////////////////////////////////////////////////// /// \brief Create an image and fill it with a unique color /// /// \param width Width of the image /// \param height Height of the image /// \param color Fill color /// /// \return A new sfImage object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfImage* sfImage_createFromColor(unsigned int width, unsigned int height, sfColor color); //////////////////////////////////////////////////////////// /// \brief Create an image from an array of pixels /// /// The \a pixel array is assumed to contain 32-bits RGBA pixels, /// and have the given \a width and \a height. If not, this is /// an undefined behaviour. /// If \a pixels is null, an empty image is created. /// /// \param width Width of the image /// \param height Height of the image /// \param pixels Array of pixels to copy to the image /// /// \return A new sfImage object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfImage* sfImage_createFromPixels(unsigned int width, unsigned int height, const sfUint8* pixels); //////////////////////////////////////////////////////////// /// \brief Create an image from a file on disk /// /// The supported image formats are bmp, png, tga, jpg, gif, /// psd, hdr and pic. Some format options are not supported, /// like progressive jpeg. /// If this function fails, the image is left unchanged. /// /// \param filename Path of the image file to load /// /// \return A new sfImage object, or NULL if it failed /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfImage* sfImage_createFromFile(const char* filename); //////////////////////////////////////////////////////////// /// \brief Create an image from a file in memory /// /// The supported image formats are bmp, png, tga, jpg, gif, /// psd, hdr and pic. Some format options are not supported, /// like progressive jpeg. /// If this function fails, the image is left unchanged. /// /// \param data Pointer to the file data in memory /// \param size Size of the data to load, in bytes /// /// \return A new sfImage object, or NULL if it failed /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfImage* sfImage_createFromMemory(const void* data, size_t size); //////////////////////////////////////////////////////////// /// \brief Create an image from a custom stream /// /// The supported image formats are bmp, png, tga, jpg, gif, /// psd, hdr and pic. Some format options are not supported, /// like progressive jpeg. /// If this function fails, the image is left unchanged. /// /// \param stream Source stream to read from /// /// \return A new sfImage object, or NULL if it failed /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfImage* sfImage_createFromStream(sfInputStream* stream); //////////////////////////////////////////////////////////// /// \brief Copy an existing image /// /// \param image Image to copy /// /// \return Copied object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfImage* sfImage_copy(const sfImage* image); //////////////////////////////////////////////////////////// /// \brief Destroy an existing image /// /// \param image Image to delete /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfImage_destroy(sfImage* image); //////////////////////////////////////////////////////////// /// \brief Save an image to a file on disk /// /// The format of the image is automatically deduced from /// the extension. The supported image formats are bmp, png, /// tga and jpg. The destination file is overwritten /// if it already exists. This function fails if the image is empty. /// /// \param image Image object /// \param filename Path of the file to save /// /// \return sfTrue if saving was successful /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfBool sfImage_saveToFile(const sfImage* image, const char* filename); //////////////////////////////////////////////////////////// /// \brief Return the size of an image /// /// \param image Image object /// /// \return Size in pixels /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2u sfImage_getSize(const sfImage* image); //////////////////////////////////////////////////////////// /// \brief Create a transparency mask from a specified color-key /// /// This function sets the alpha value of every pixel matching /// the given color to \a alpha (0 by default), so that they /// become transparent. /// /// \param image Image object /// \param color Color to make transparent /// \param alpha Alpha value to assign to transparent pixels /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfImage_createMaskFromColor(sfImage* image, sfColor color, sfUint8 alpha); //////////////////////////////////////////////////////////// /// \brief Copy pixels from an image onto another /// /// This function does a slow pixel copy and should not be /// used intensively. It can be used to prepare a complex /// static image from several others, but if you need this /// kind of feature in real-time you'd better use sfRenderTexture. /// /// If \a sourceRect is empty, the whole image is copied. /// If \a applyAlpha is set to true, the transparency of /// source pixels is applied. If it is false, the pixels are /// copied unchanged with their alpha value. /// /// \param image Image object /// \param source Source image to copy /// \param destX X coordinate of the destination position /// \param destY Y coordinate of the destination position /// \param sourceRect Sub-rectangle of the source image to copy /// \param applyAlpha Should the copy take in account the source transparency? /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfImage_copyImage(sfImage* image, const sfImage* source, unsigned int destX, unsigned int destY, sfIntRect sourceRect, sfBool applyAlpha); //////////////////////////////////////////////////////////// /// \brief Change the color of a pixel in an image /// /// This function doesn't check the validity of the pixel /// coordinates, using out-of-range values will result in /// an undefined behaviour. /// /// \param image Image object /// \param x X coordinate of pixel to change /// \param y Y coordinate of pixel to change /// \param color New color of the pixel /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfImage_setPixel(sfImage* image, unsigned int x, unsigned int y, sfColor color); //////////////////////////////////////////////////////////// /// \brief Get the color of a pixel in an image /// /// This function doesn't check the validity of the pixel /// coordinates, using out-of-range values will result in /// an undefined behaviour. /// /// \param image Image object /// \param x X coordinate of pixel to get /// \param y Y coordinate of pixel to get /// /// \return Color of the pixel at coordinates (x, y) /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfColor sfImage_getPixel(const sfImage* image, unsigned int x, unsigned int y); //////////////////////////////////////////////////////////// /// \brief Get a read-only pointer to the array of pixels of an image /// /// The returned value points to an array of RGBA pixels made of /// 8 bits integers components. The size of the array is /// getWidth() * getHeight() * 4. /// Warning: the returned pointer may become invalid if you /// modify the image, so you should never store it for too long. /// If the image is empty, a null pointer is returned. /// /// \param image Image object /// /// \return Read-only pointer to the array of pixels /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API const sfUint8* sfImage_getPixelsPtr(const sfImage* image); //////////////////////////////////////////////////////////// /// \brief Flip an image horizontally (left <-> right) /// /// \param image Image object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfImage_flipHorizontally(sfImage* image); //////////////////////////////////////////////////////////// /// \brief Flip an image vertically (top <-> bottom) /// /// \param image Image object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfImage_flipVertically(sfImage* image); #endif // SFML_IMAGE_H CSFML-2.4/include/SFML/Graphics/PrimitiveType.h000066400000000000000000000047351301071240500211340ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_PRIMITIVETYPE_H #define SFML_PRIMITIVETYPE_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// /// \brief Types of primitives that a sf::VertexArray can render /// /// Points and lines have no area, therefore their thickness /// will always be 1 pixel, regardless the current transform /// and view. /// //////////////////////////////////////////////////////////// typedef enum { sfPoints, ///< List of individual points sfLines, ///< List of individual lines sfLineStrip, ///< List of connected lines, a point uses the previous point to form a line sfTriangles, ///< List of individual triangles sfTriangleStrip, ///< List of connected triangles, a point uses the two previous points to form a triangle sfTriangleFan, ///< List of connected triangles, a point uses the common center and the previous point to form a triangle sfQuads, ///< List of individual quads sfLinesStrip = sfLineStrip, ///< \deprecated Use sfLineStrip instead sfTrianglesStrip = sfTriangleStrip, ///< \deprecated Use sfTriangleStrip instead sfTrianglesFan = sfTriangleFan ///< \deprecated Use sfTriangleFan instead } sfPrimitiveType; #endif // SFML_BLENDMODE_H CSFML-2.4/include/SFML/Graphics/Rect.h000066400000000000000000000055651301071240500172210ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_RECT_H #define SFML_RECT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// /// sfFloatRect and sfIntRect are utility classes for /// manipulating rectangles. //////////////////////////////////////////////////////////// typedef struct { float left; float top; float width; float height; } sfFloatRect; typedef struct { int left; int top; int width; int height; } sfIntRect; //////////////////////////////////////////////////////////// /// \brief Check if a point is inside a rectangle's area /// /// \param rect Rectangle to test /// \param x X coordinate of the point to test /// \param y Y coordinate of the point to test /// /// \return sfTrue if the point is inside /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfBool sfFloatRect_contains(const sfFloatRect* rect, float x, float y); CSFML_GRAPHICS_API sfBool sfIntRect_contains(const sfIntRect* rect, int x, int y); //////////////////////////////////////////////////////////// /// \brief Check intersection between two rectangles /// /// \param rect1 First rectangle to test /// \param rect2 Second rectangle to test /// \param intersection Rectangle to be filled with overlapping rect (can be NULL) /// /// \return sfTrue if rectangles overlap /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfBool sfFloatRect_intersects(const sfFloatRect* rect1, const sfFloatRect* rect2, sfFloatRect* intersection); CSFML_GRAPHICS_API sfBool sfIntRect_intersects(const sfIntRect* rect1, const sfIntRect* rect2, sfIntRect* intersection); #endif // SFML_RECT_H CSFML-2.4/include/SFML/Graphics/RectangleShape.h000066400000000000000000000402301301071240500211750ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_RECTANGLESHAPE_H #define SFML_RECTANGLESHAPE_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include #include //////////////////////////////////////////////////////////// /// \brief Create a new rectangle shape /// /// \return A new sfRectangleShape object, or NULL if it failed /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfRectangleShape* sfRectangleShape_create(void); //////////////////////////////////////////////////////////// /// \brief Copy an existing rectangle shape /// /// \param shape Shape to copy /// /// \return Copied object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfRectangleShape* sfRectangleShape_copy(const sfRectangleShape* shape); //////////////////////////////////////////////////////////// /// \brief Destroy an existing rectangle shape /// /// \param shape Shape to delete /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRectangleShape_destroy(sfRectangleShape* shape); //////////////////////////////////////////////////////////// /// \brief Set the position of a rectangle shape /// /// This function completely overwrites the previous position. /// See sfRectangleShape_move to apply an offset based on the previous position instead. /// The default position of a circle Shape object is (0, 0). /// /// \param shape Shape object /// \param position New position /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRectangleShape_setPosition(sfRectangleShape* shape, sfVector2f position); //////////////////////////////////////////////////////////// /// \brief Set the orientation of a rectangle shape /// /// This function completely overwrites the previous rotation. /// See sfRectangleShape_rotate to add an angle based on the previous rotation instead. /// The default rotation of a circle Shape object is 0. /// /// \param shape Shape object /// \param angle New rotation, in degrees /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRectangleShape_setRotation(sfRectangleShape* shape, float angle); //////////////////////////////////////////////////////////// /// \brief Set the scale factors of a rectangle shape /// /// This function completely overwrites the previous scale. /// See sfRectangleShape_scale to add a factor based on the previous scale instead. /// The default scale of a circle Shape object is (1, 1). /// /// \param shape Shape object /// \param scale New scale factors /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRectangleShape_setScale(sfRectangleShape* shape, sfVector2f scale); //////////////////////////////////////////////////////////// /// \brief Set the local origin of a rectangle shape /// /// The origin of an object defines the center point for /// all transformations (position, scale, rotation). /// The coordinates of this point must be relative to the /// top-left corner of the object, and ignore all /// transformations (position, scale, rotation). /// The default origin of a circle Shape object is (0, 0). /// /// \param shape Shape object /// \param origin New origin /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRectangleShape_setOrigin(sfRectangleShape* shape, sfVector2f origin); //////////////////////////////////////////////////////////// /// \brief Get the position of a rectangle shape /// /// \param shape Shape object /// /// \return Current position /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfRectangleShape_getPosition(const sfRectangleShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the orientation of a rectangle shape /// /// The rotation is always in the range [0, 360]. /// /// \param shape Shape object /// /// \return Current rotation, in degrees /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API float sfRectangleShape_getRotation(const sfRectangleShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the current scale of a rectangle shape /// /// \param shape Shape object /// /// \return Current scale factors /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfRectangleShape_getScale(const sfRectangleShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the local origin of a rectangle shape /// /// \param shape Shape object /// /// \return Current origin /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfRectangleShape_getOrigin(const sfRectangleShape* shape); //////////////////////////////////////////////////////////// /// \brief Move a rectangle shape by a given offset /// /// This function adds to the current position of the object, /// unlike sfRectangleShape_setPosition which overwrites it. /// /// \param shape Shape object /// \param offset Offset /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRectangleShape_move(sfRectangleShape* shape, sfVector2f offset); //////////////////////////////////////////////////////////// /// \brief Rotate a rectangle shape /// /// This function adds to the current rotation of the object, /// unlike sfRectangleShape_setRotation which overwrites it. /// /// \param shape Shape object /// \param angle Angle of rotation, in degrees /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRectangleShape_rotate(sfRectangleShape* shape, float angle); //////////////////////////////////////////////////////////// /// \brief Scale a rectangle shape /// /// This function multiplies the current scale of the object, /// unlike sfRectangleShape_setScale which overwrites it. /// /// \param shape Shape object /// \param factors Scale factors /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRectangleShape_scale(sfRectangleShape* shape, sfVector2f factors); //////////////////////////////////////////////////////////// /// \brief Get the combined transform of a rectangle shape /// /// \param shape shape object /// /// \return Transform combining the position/rotation/scale/origin of the object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfTransform sfRectangleShape_getTransform(const sfRectangleShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the inverse of the combined transform of a rectangle shape /// /// \param shape shape object /// /// \return Inverse of the combined transformations applied to the object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfTransform sfRectangleShape_getInverseTransform(const sfRectangleShape* shape); //////////////////////////////////////////////////////////// /// \brief Change the source texture of a rectangle shape /// /// The \a texture argument refers to a texture that must /// exist as long as the shape uses it. Indeed, the shape /// doesn't store its own copy of the texture, but rather keeps /// a pointer to the one that you passed to this function. /// If the source texture is destroyed and the shape tries to /// use it, the behaviour is undefined. /// \a texture can be NULL to disable texturing. /// If \a resetRect is true, the TextureRect property of /// the shape is automatically adjusted to the size of the new /// texture. If it is false, the texture rect is left unchanged. /// /// \param shape Shape object /// \param texture New texture /// \param resetRect Should the texture rect be reset to the size of the new texture? /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRectangleShape_setTexture(sfRectangleShape* shape, const sfTexture* texture, sfBool resetRect); //////////////////////////////////////////////////////////// /// \brief Set the sub-rectangle of the texture that a rectangle shape will display /// /// The texture rect is useful when you don't want to display /// the whole texture, but rather a part of it. /// By default, the texture rect covers the entire texture. /// /// \param shape Shape object /// \param rect Rectangle defining the region of the texture to display /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRectangleShape_setTextureRect(sfRectangleShape* shape, sfIntRect rect); //////////////////////////////////////////////////////////// /// \brief Set the fill color of a rectangle shape /// /// This color is modulated (multiplied) with the shape's /// texture if any. It can be used to colorize the shape, /// or change its global opacity. /// You can use sfTransparent to make the inside of /// the shape transparent, and have the outline alone. /// By default, the shape's fill color is opaque white. /// /// \param shape Shape object /// \param color New color of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRectangleShape_setFillColor(sfRectangleShape* shape, sfColor color); //////////////////////////////////////////////////////////// /// \brief Set the outline color of a rectangle shape /// /// You can use sfTransparent to disable the outline. /// By default, the shape's outline color is opaque white. /// /// \param shape Shape object /// \param color New outline color of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRectangleShape_setOutlineColor(sfRectangleShape* shape, sfColor color); //////////////////////////////////////////////////////////// /// \brief Set the thickness of a rectangle shape's outline /// /// This number cannot be negative. Using zero disables /// the outline. /// By default, the outline thickness is 0. /// /// \param shape Shape object /// \param thickness New outline thickness /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRectangleShape_setOutlineThickness(sfRectangleShape* shape, float thickness); //////////////////////////////////////////////////////////// /// \brief Get the source texture of a rectangle shape /// /// If the shape has no source texture, a NULL pointer is returned. /// The returned pointer is const, which means that you can't /// modify the texture when you retrieve it with this function. /// /// \param shape Shape object /// /// \return Pointer to the shape's texture /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API const sfTexture* sfRectangleShape_getTexture(const sfRectangleShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the sub-rectangle of the texture displayed by a rectangle shape /// /// \param shape Shape object /// /// \return Texture rectangle of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfIntRect sfRectangleShape_getTextureRect(const sfRectangleShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the fill color of a rectangle shape /// /// \param shape Shape object /// /// \return Fill color of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfColor sfRectangleShape_getFillColor(const sfRectangleShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the outline color of a rectangle shape /// /// \param shape Shape object /// /// \return Outline color of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfColor sfRectangleShape_getOutlineColor(const sfRectangleShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the outline thickness of a rectangle shape /// /// \param shape Shape object /// /// \return Outline thickness of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API float sfRectangleShape_getOutlineThickness(const sfRectangleShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the total number of points of a rectangle shape /// /// \param shape Shape object /// /// \return Number of points of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API size_t sfRectangleShape_getPointCount(const sfRectangleShape* shape); //////////////////////////////////////////////////////////// /// \brief Get a point of a rectangle shape /// /// The result is undefined if \a index is out of the valid range. /// /// \param shape Shape object /// \param index Index of the point to get, in range [0 .. getPointCount() - 1] /// /// \return Index-th point of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfRectangleShape_getPoint(const sfRectangleShape* shape, size_t index); //////////////////////////////////////////////////////////// /// \brief Set the size of a rectangle shape /// /// \param shape Shape object /// \param size New size of the rectangle /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRectangleShape_setSize(sfRectangleShape* shape, sfVector2f size); //////////////////////////////////////////////////////////// /// \brief Get the size of a rectangle shape /// /// \param shape Shape object // /// \return height Size of the rectangle /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfRectangleShape_getSize(const sfRectangleShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the local bounding rectangle of a rectangle shape /// /// The returned rectangle is in local coordinates, which means /// that it ignores the transformations (translation, rotation, /// scale, ...) that are applied to the entity. /// In other words, this function returns the bounds of the /// entity in the entity's coordinate system. /// /// \param shape Shape object /// /// \return Local bounding rectangle of the entity /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfFloatRect sfRectangleShape_getLocalBounds(const sfRectangleShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the global bounding rectangle of a rectangle shape /// /// The returned rectangle is in global coordinates, which means /// that it takes in account the transformations (translation, /// rotation, scale, ...) that are applied to the entity. /// In other words, this function returns the bounds of the /// sprite in the global 2D world's coordinate system. /// /// \param shape Shape object /// /// \return Global bounding rectangle of the entity /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfFloatRect sfRectangleShape_getGlobalBounds(const sfRectangleShape* shape); #endif // SFML_RECTANGLESHAPE_H CSFML-2.4/include/SFML/Graphics/RenderStates.h000066400000000000000000000035331301071240500207200ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_RENDERSTATES_H #define SFML_RENDERSTATES_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include //////////////////////////////////////////////////////////// /// \brief Define the states used for drawing to a RenderTarget /// //////////////////////////////////////////////////////////// typedef struct { sfBlendMode blendMode; ///< Blending mode sfTransform transform; ///< Transform const sfTexture* texture; ///< Texture const sfShader* shader; ///< Shader } sfRenderStates; #endif // SFML_RENDERSTATES_H CSFML-2.4/include/SFML/Graphics/RenderTexture.h000066400000000000000000000360471301071240500211230ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_RENDERTEXTURE_H #define SFML_RENDERTEXTURE_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include #include #include #include //////////////////////////////////////////////////////////// /// \brief Construct a new render texture /// /// \param width Width of the render texture /// \param height Height of the render texture /// \param depthBuffer Do you want a depth-buffer attached? (useful only if you're doing 3D OpenGL on the rendertexture) /// /// \return A new sfRenderTexture object, or NULL if it failed /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfRenderTexture* sfRenderTexture_create(unsigned int width, unsigned int height, sfBool depthBuffer); //////////////////////////////////////////////////////////// /// \brief Destroy an existing render texture /// /// \param renderTexture Render texture to destroy /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderTexture_destroy(sfRenderTexture* renderTexture); //////////////////////////////////////////////////////////// /// \brief Get the size of the rendering region of a render texture /// /// \param renderTexture Render texture object /// /// \return Size in pixels /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2u sfRenderTexture_getSize(const sfRenderTexture* renderTexture); //////////////////////////////////////////////////////////// /// \brief Activate or deactivate a render texture as the current target for rendering /// /// \param renderTexture Render texture object /// \param active sfTrue to activate, sfFalse to deactivate /// /// \return True if operation was successful, false otherwise /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfBool sfRenderTexture_setActive(sfRenderTexture* renderTexture, sfBool active); //////////////////////////////////////////////////////////// /// \brief Update the contents of the target texture /// /// \param renderTexture Render texture object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderTexture_display(sfRenderTexture* renderTexture); //////////////////////////////////////////////////////////// /// \brief Clear the rendertexture with the given color /// /// \param renderTexture Render texture object /// \param color Fill color /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderTexture_clear(sfRenderTexture* renderTexture, sfColor color); //////////////////////////////////////////////////////////// /// \brief Change the current active view of a render texture /// /// \param renderTexture Render texture object /// \param view Pointer to the new view /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderTexture_setView(sfRenderTexture* renderTexture, const sfView* view); //////////////////////////////////////////////////////////// /// \brief Get the current active view of a render texture /// /// \param renderTexture Render texture object /// /// \return Current active view /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API const sfView* sfRenderTexture_getView(const sfRenderTexture* renderTexture); //////////////////////////////////////////////////////////// /// \brief Get the default view of a render texture /// /// \param renderTexture Render texture object /// /// \return Default view of the rendertexture /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API const sfView* sfRenderTexture_getDefaultView(const sfRenderTexture* renderTexture); //////////////////////////////////////////////////////////// /// \brief Get the viewport of a view applied to this target /// /// \param renderTexture Render texture object /// \param view Target view /// /// \return Viewport rectangle, expressed in pixels in the current target /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfIntRect sfRenderTexture_getViewport(const sfRenderTexture* renderTexture, const sfView* view); //////////////////////////////////////////////////////////// /// \brief Convert a point from texture coordinates to world coordinates /// /// This function finds the 2D position that matches the /// given pixel of the render-texture. In other words, it does /// the inverse of what the graphics card does, to find the /// initial position of a rendered pixel. /// /// Initially, both coordinate systems (world units and target pixels) /// match perfectly. But if you define a custom view or resize your /// render-texture, this assertion is not true anymore, ie. a point /// located at (10, 50) in your render-texture may map to the point /// (150, 75) in your 2D world -- if the view is translated by (140, 25). /// /// This version uses a custom view for calculations, see the other /// overload of the function if you want to use the current view of the /// render-texture. /// /// \param renderTexture Render texture object /// \param point Pixel to convert /// \param view The view to use for converting the point /// /// \return The converted point, in "world" units /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfRenderTexture_mapPixelToCoords(const sfRenderTexture* renderTexture, sfVector2i point, const sfView* view); //////////////////////////////////////////////////////////// /// \brief Convert a point from world coordinates to texture coordinates /// /// This function finds the pixel of the render-texture that matches /// the given 2D point. In other words, it goes through the same process /// as the graphics card, to compute the final position of a rendered point. /// /// Initially, both coordinate systems (world units and target pixels) /// match perfectly. But if you define a custom view or resize your /// render-texture, this assertion is not true anymore, ie. a point /// located at (150, 75) in your 2D world may map to the pixel /// (10, 50) of your render-texture -- if the view is translated by (140, 25). /// /// This version uses a custom view for calculations, see the other /// overload of the function if you want to use the current view of the /// render-texture. /// /// \param renderTexture Render texture object /// \param point Point to convert /// \param view The view to use for converting the point /// /// \return The converted point, in target coordinates (pixels) /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2i sfRenderTexture_mapCoordsToPixel(const sfRenderTexture* renderTexture, sfVector2f point, const sfView* view); //////////////////////////////////////////////////////////// /// \brief Draw a drawable object to the render-target /// /// \param renderTexture Render texture object /// \param object Object to draw /// \param states Render states to use for drawing (NULL to use the default states) /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderTexture_drawSprite(sfRenderTexture* renderTexture, const sfSprite* object, const sfRenderStates* states); CSFML_GRAPHICS_API void sfRenderTexture_drawText(sfRenderTexture* renderTexture, const sfText* object, const sfRenderStates* states); CSFML_GRAPHICS_API void sfRenderTexture_drawShape(sfRenderTexture* renderTexture, const sfShape* object, const sfRenderStates* states); CSFML_GRAPHICS_API void sfRenderTexture_drawCircleShape(sfRenderTexture* renderTexture, const sfCircleShape* object, const sfRenderStates* states); CSFML_GRAPHICS_API void sfRenderTexture_drawConvexShape(sfRenderTexture* renderTexture, const sfConvexShape* object, const sfRenderStates* states); CSFML_GRAPHICS_API void sfRenderTexture_drawRectangleShape(sfRenderTexture* renderTexture, const sfRectangleShape* object, const sfRenderStates* states); CSFML_GRAPHICS_API void sfRenderTexture_drawVertexArray(sfRenderTexture* renderTexture, const sfVertexArray* object, const sfRenderStates* states); //////////////////////////////////////////////////////////// /// \brief Draw primitives defined by an array of vertices to a render texture /// /// \param renderTexture Render texture object /// \param vertices Pointer to the vertices /// \param vertexCount Number of vertices in the array /// \param type Type of primitives to draw /// \param states Render states to use for drawing (NULL to use the default states) /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderTexture_drawPrimitives(sfRenderTexture* renderTexture, const sfVertex* vertices, size_t vertexCount, sfPrimitiveType type, const sfRenderStates* states); //////////////////////////////////////////////////////////// /// \brief Save the current OpenGL render states and matrices /// /// This function can be used when you mix SFML drawing /// and direct OpenGL rendering. Combined with popGLStates, /// it ensures that: /// \li SFML's internal states are not messed up by your OpenGL code /// \li your OpenGL states are not modified by a call to a SFML function /// /// Note that this function is quite expensive: it saves all the /// possible OpenGL states and matrices, even the ones you /// don't care about. Therefore it should be used wisely. /// It is provided for convenience, but the best results will /// be achieved if you handle OpenGL states yourself (because /// you know which states have really changed, and need to be /// saved and restored). Take a look at the resetGLStates /// function if you do so. /// /// \param renderTexture Render texture object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderTexture_pushGLStates(sfRenderTexture* renderTexture); //////////////////////////////////////////////////////////// /// \brief Restore the previously saved OpenGL render states and matrices /// /// See the description of pushGLStates to get a detailed /// description of these functions. /// /// \param renderTexture Render texture object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderTexture_popGLStates(sfRenderTexture* renderTexture); //////////////////////////////////////////////////////////// /// \brief Reset the internal OpenGL states so that the target is ready for drawing /// /// This function can be used when you mix SFML drawing /// and direct OpenGL rendering, if you choose not to use /// pushGLStates/popGLStates. It makes sure that all OpenGL /// states needed by SFML are set, so that subsequent sfRenderTexture_draw*() /// calls will work as expected. /// /// \param renderTexture Render texture object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderTexture_resetGLStates(sfRenderTexture* renderTexture); //////////////////////////////////////////////////////////// /// \brief Get the target texture of a render texture /// /// \param renderTexture Render texture object /// /// \return Pointer to the target texture /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API const sfTexture* sfRenderTexture_getTexture(const sfRenderTexture* renderTexture); //////////////////////////////////////////////////////////// /// \brief Enable or disable the smooth filter on a render texture /// /// \param renderTexture Render texture object /// \param smooth sfTrue to enable smoothing, sfFalse to disable it /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderTexture_setSmooth(sfRenderTexture* renderTexture, sfBool smooth); //////////////////////////////////////////////////////////// /// \brief Tell whether the smooth filter is enabled or not for a render texture /// /// \param renderTexture Render texture object /// /// \return sfTrue if smoothing is enabled, sfFalse if it is disabled /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfBool sfRenderTexture_isSmooth(const sfRenderTexture* renderTexture); //////////////////////////////////////////////////////////// /// \brief Enable or disable texture repeating /// /// \param renderTexture Render texture object /// \param repeated sfTrue to enable repeating, sfFalse to disable it /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderTexture_setRepeated(sfRenderTexture* renderTexture, sfBool repeated); //////////////////////////////////////////////////////////// /// \brief Tell whether the texture is repeated or not /// /// \param renderTexture Render texture object /// /// \return sfTrue if repeat mode is enabled, sfFalse if it is disabled /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfBool sfRenderTexture_isRepeated(const sfRenderTexture* renderTexture); //////////////////////////////////////////////////////////// /// \brief Generate a mipmap using the current texture data /// /// This function is similar to sfTexture_generateMipmap and operates /// on the texture used as the target for drawing. /// Be aware that any draw operation may modify the base level image data. /// For this reason, calling this function only makes sense after all /// drawing is completed and display has been called. Not calling display /// after subsequent drawing will lead to undefined behavior if a mipmap /// had been previously generated. /// /// \return sfTrue if mipmap generation was successful, sfFalse if unsuccessful /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfBool sfRenderTexture_generateMipmap(sfRenderTexture* renderTexture); #endif // SFML_RENDERTEXTURE_H CSFML-2.4/include/SFML/Graphics/RenderWindow.h000066400000000000000000000620631301071240500207270ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_RENDERWINDOW_H #define SFML_RENDERWINDOW_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include #include #include #include #include #include #include #include //////////////////////////////////////////////////////////// /// \brief Construct a new render window /// /// \param mode Video mode to use /// \param title Title of the window /// \param style Window style /// \param settings Creation settings (pass NULL to use default values) /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfRenderWindow* sfRenderWindow_create(sfVideoMode mode, const char* title, sfUint32 style, const sfContextSettings* settings); //////////////////////////////////////////////////////////// /// \brief Construct a new render window (with a UTF-32 title) /// /// \param mode Video mode to use /// \param title Title of the window (UTF-32) /// \param style Window style /// \param settings Creation settings (pass NULL to use default values) /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfRenderWindow* sfRenderWindow_createUnicode(sfVideoMode mode, const sfUint32* title, sfUint32 style, const sfContextSettings* settings); //////////////////////////////////////////////////////////// /// \brief Construct a render window from an existing control /// /// \param handle Platform-specific handle of the control /// \param settings Creation settings (pass NULL to use default values) /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfRenderWindow* sfRenderWindow_createFromHandle(sfWindowHandle handle, const sfContextSettings* settings); //////////////////////////////////////////////////////////// /// \brief Destroy an existing render window /// /// \param renderWindow Render window to destroy /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderWindow_destroy(sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// \brief Close a render window (but doesn't destroy the internal data) /// /// \param renderWindow Render window to close /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderWindow_close(sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// \brief Tell whether or not a render window is opened /// /// \param renderWindow Render window object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfBool sfRenderWindow_isOpen(const sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// \brief Get the creation settings of a render window /// /// \param renderWindow Render window object /// /// \return Settings used to create the window /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfContextSettings sfRenderWindow_getSettings(const sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// \brief Get the event on top of event queue of a render window, if any, and pop it /// /// \param renderWindow Render window object /// \param event Event to fill, if any /// /// \return sfTrue if an event was returned, sfFalse if event queue was empty /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfBool sfRenderWindow_pollEvent(sfRenderWindow* renderWindow, sfEvent* event); //////////////////////////////////////////////////////////// /// \brief Wait for an event and return it /// /// \param renderWindow Render window object /// \param event Event to fill /// /// \return sfFalse if an error occured /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfBool sfRenderWindow_waitEvent(sfRenderWindow* renderWindow, sfEvent* event); //////////////////////////////////////////////////////////// /// \brief Get the position of a render window /// /// \param renderWindow Render window object /// /// \return Position in pixels /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2i sfRenderWindow_getPosition(const sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// \brief Change the position of a render window on screen /// /// Only works for top-level windows /// /// \param renderWindow Render window object /// \param position New position, in pixels /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderWindow_setPosition(sfRenderWindow* renderWindow, sfVector2i position); //////////////////////////////////////////////////////////// /// \brief Get the size of the rendering region of a render window /// /// \param renderWindow Render window object /// /// \return Size in pixels /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2u sfRenderWindow_getSize(const sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// \brief Change the size of the rendering region of a render window /// /// \param renderWindow Render window object /// \param size New size, in pixels /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderWindow_setSize(sfRenderWindow* renderWindow, sfVector2u size); //////////////////////////////////////////////////////////// /// \brief Change the title of a render window /// /// \param renderWindow Render window object /// \param title New title /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderWindow_setTitle(sfRenderWindow* renderWindow, const char* title); //////////////////////////////////////////////////////////// /// \brief Change the title of a render window (with a UTF-32 string) /// /// \param renderWindow Render window object /// \param title New title /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderWindow_setUnicodeTitle(sfRenderWindow* renderWindow, const sfUint32* title); //////////////////////////////////////////////////////////// /// \brief Change a render window's icon /// /// \param renderWindow Render window object /// \param width Icon's width, in pixels /// \param height Icon's height, in pixels /// \param pixels Pointer to the pixels in memory, format must be RGBA 32 bits /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderWindow_setIcon(sfRenderWindow* renderWindow, unsigned int width, unsigned int height, const sfUint8* pixels); //////////////////////////////////////////////////////////// /// \brief Show or hide a render window /// /// \param renderWindow Render window object /// \param visible sfTrue to show the window, sfFalse to hide it /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderWindow_setVisible(sfRenderWindow* renderWindow, sfBool visible); //////////////////////////////////////////////////////////// /// \brief Enable / disable vertical synchronization on a render window /// /// \param renderWindow Render window object /// \param enabled sfTrue to enable v-sync, sfFalse to deactivate /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderWindow_setVerticalSyncEnabled(sfRenderWindow* renderWindow, sfBool enabled); //////////////////////////////////////////////////////////// /// \brief Show or hide the mouse cursor on a render window /// /// \param renderWindow Render window object /// \param show sfTrue to show, sfFalse to hide /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderWindow_setMouseCursorVisible(sfRenderWindow* renderWindow, sfBool show); //////////////////////////////////////////////////////////// /// \brief Grab or release the mouse cursor /// /// If set, grabs the mouse cursor inside this window's client /// area so it may no longer be moved outside its bounds. /// Note that grabbing is only active while the window has /// focus and calling this function for fullscreen windows /// won't have any effect (fullscreen windows always grab the /// cursor). /// /// \param grabbed sfTrue to enable, sfFalse to disable /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderWindow_setMouseCursorGrabbed(sfRenderWindow* renderWindow, sfBool grabbed); //////////////////////////////////////////////////////////// /// \brief Enable or disable automatic key-repeat for keydown events /// /// Automatic key-repeat is enabled by default /// /// \param renderWindow Render window object /// \param enabled sfTrue to enable, sfFalse to disable /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderWindow_setKeyRepeatEnabled(sfRenderWindow* renderWindow, sfBool enabled); //////////////////////////////////////////////////////////// /// \brief Limit the framerate to a maximum fixed frequency for a render window /// /// \param renderWindow Render window object /// \param limit Framerate limit, in frames per seconds (use 0 to disable limit) /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderWindow_setFramerateLimit(sfRenderWindow* renderWindow, unsigned int limit); //////////////////////////////////////////////////////////// /// \brief Change the joystick threshold, ie. the value below which no move event will be generated /// /// \param renderWindow Render window object /// \param threshold New threshold, in range [0, 100] /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderWindow_setJoystickThreshold(sfRenderWindow* renderWindow, float threshold); //////////////////////////////////////////////////////////// /// \brief Activate or deactivate a render window as the current target for rendering /// /// \param renderWindow Render window object /// \param active sfTrue to activate, sfFalse to deactivate /// /// \return True if operation was successful, false otherwise /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfBool sfRenderWindow_setActive(sfRenderWindow* renderWindow, sfBool active); /////////////////////////////////////////////////////////// /// \brief Request the current render window to be made the active /// foreground window /// /// At any given time, only one window may have the input focus /// to receive input events such as keystrokes or mouse events. /// If a window requests focus, it only hints to the operating /// system, that it would like to be focused. The operating system /// is free to deny the request. /// This is not to be confused with sfWindow_setActive(). /// /////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderWindow_requestFocus(sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// \brief Check whether the render window has the input focus /// /// At any given time, only one window may have the input focus /// to receive input events such as keystrokes or most mouse /// events. /// /// \return True if window has focus, false otherwise /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfBool sfRenderWindow_hasFocus(const sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// \brief Display a render window on screen /// /// \param renderWindow Render window object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderWindow_display(sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// \brief Retrieve the OS-specific handle of a render window /// /// \param renderWindow Render window object /// /// \return Window handle /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfWindowHandle sfRenderWindow_getSystemHandle(const sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// \brief Clear a render window with the given color /// /// \param renderWindow Render window object /// \param color Fill color /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderWindow_clear(sfRenderWindow* renderWindow, sfColor color); //////////////////////////////////////////////////////////// /// \brief Change the current active view of a render window /// /// \param renderWindow Render window object /// \param view Pointer to the new view /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderWindow_setView(sfRenderWindow* renderWindow, const sfView* view); //////////////////////////////////////////////////////////// /// \brief Get the current active view of a render window /// /// \param renderWindow Render window object /// /// \return Current active view /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API const sfView* sfRenderWindow_getView(const sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// \brief Get the default view of a render window /// /// \param renderWindow Render window object /// /// \return Default view of the render window /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API const sfView* sfRenderWindow_getDefaultView(const sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// \brief Get the viewport of a view applied to this target /// /// \param renderWindow Render window object /// \param view Target view /// /// \return Viewport rectangle, expressed in pixels in the current target /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfIntRect sfRenderWindow_getViewport(const sfRenderWindow* renderWindow, const sfView* view); //////////////////////////////////////////////////////////// /// \brief Convert a point from window coordinates to world coordinates /// /// This function finds the 2D position that matches the /// given pixel of the render-window. In other words, it does /// the inverse of what the graphics card does, to find the /// initial position of a rendered pixel. /// /// Initially, both coordinate systems (world units and target pixels) /// match perfectly. But if you define a custom view or resize your /// render-window, this assertion is not true anymore, ie. a point /// located at (10, 50) in your render-window may map to the point /// (150, 75) in your 2D world -- if the view is translated by (140, 25). /// /// This function is typically used to find which point (or object) is /// located below the mouse cursor. /// /// This version uses a custom view for calculations, see the other /// overload of the function if you want to use the current view of the /// render-window. /// /// \param renderWindow Render window object /// \param point Pixel to convert /// \param view The view to use for converting the point /// /// \return The converted point, in "world" units /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfRenderWindow_mapPixelToCoords(const sfRenderWindow* renderWindow, sfVector2i point, const sfView* view); //////////////////////////////////////////////////////////// /// \brief Convert a point from world coordinates to window coordinates /// /// This function finds the pixel of the render-window that matches /// the given 2D point. In other words, it goes through the same process /// as the graphics card, to compute the final position of a rendered point. /// /// Initially, both coordinate systems (world units and target pixels) /// match perfectly. But if you define a custom view or resize your /// render-window, this assertion is not true anymore, ie. a point /// located at (150, 75) in your 2D world may map to the pixel /// (10, 50) of your render-window -- if the view is translated by (140, 25). /// /// This version uses a custom view for calculations, see the other /// overload of the function if you want to use the current view of the /// render-window. /// /// \param renderWindow Render window object /// \param point Point to convert /// \param view The view to use for converting the point /// /// \return The converted point, in target coordinates (pixels) /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2i sfRenderWindow_mapCoordsToPixel(const sfRenderWindow* renderWindow, sfVector2f point, const sfView* view); //////////////////////////////////////////////////////////// /// \brief Draw a drawable object to the render-target /// /// \param renderWindow render window object /// \param object Object to draw /// \param states Render states to use for drawing (NULL to use the default states) /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderWindow_drawSprite(sfRenderWindow* renderWindow, const sfSprite* object, const sfRenderStates* states); CSFML_GRAPHICS_API void sfRenderWindow_drawText(sfRenderWindow* renderWindow, const sfText* object, const sfRenderStates* states); CSFML_GRAPHICS_API void sfRenderWindow_drawShape(sfRenderWindow* renderWindow, const sfShape* object, const sfRenderStates* states); CSFML_GRAPHICS_API void sfRenderWindow_drawCircleShape(sfRenderWindow* renderWindow, const sfCircleShape* object, const sfRenderStates* states); CSFML_GRAPHICS_API void sfRenderWindow_drawConvexShape(sfRenderWindow* renderWindow, const sfConvexShape* object, const sfRenderStates* states); CSFML_GRAPHICS_API void sfRenderWindow_drawRectangleShape(sfRenderWindow* renderWindow, const sfRectangleShape* object, const sfRenderStates* states); CSFML_GRAPHICS_API void sfRenderWindow_drawVertexArray(sfRenderWindow* renderWindow, const sfVertexArray* object, const sfRenderStates* states); //////////////////////////////////////////////////////////// /// \brief Draw primitives defined by an array of vertices to a render window /// /// \param renderWindow render window object /// \param vertices Pointer to the vertices /// \param vertexCount Number of vertices in the array /// \param type Type of primitives to draw /// \param states Render states to use for drawing (NULL to use the default states) /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderWindow_drawPrimitives(sfRenderWindow* renderWindow, const sfVertex* vertices, size_t vertexCount, sfPrimitiveType type, const sfRenderStates* states); //////////////////////////////////////////////////////////// /// \brief Save the current OpenGL render states and matrices /// /// This function can be used when you mix SFML drawing /// and direct OpenGL rendering. Combined with popGLStates, /// it ensures that: /// \li SFML's internal states are not messed up by your OpenGL code /// \li your OpenGL states are not modified by a call to a SFML function /// /// Note that this function is quite expensive: it saves all the /// possible OpenGL states and matrices, even the ones you /// don't care about. Therefore it should be used wisely. /// It is provided for convenience, but the best results will /// be achieved if you handle OpenGL states yourself (because /// you know which states have really changed, and need to be /// saved and restored). Take a look at the resetGLStates /// function if you do so. /// /// \param renderWindow render window object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderWindow_pushGLStates(sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// \brief Restore the previously saved OpenGL render states and matrices /// /// See the description of pushGLStates to get a detailed /// description of these functions. /// /// \param renderWindow render window object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderWindow_popGLStates(sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// \brief Reset the internal OpenGL states so that the target is ready for drawing /// /// This function can be used when you mix SFML drawing /// and direct OpenGL rendering, if you choose not to use /// pushGLStates/popGLStates. It makes sure that all OpenGL /// states needed by SFML are set, so that subsequent sfRenderWindow_draw*() /// calls will work as expected. /// /// \param renderWindow render window object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfRenderWindow_resetGLStates(sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// \brief Copy the current contents of the window to an image /// /// \deprecated /// Use a sfTexture and its /// sfTexture_updateFromRenderWindow(sfTexture*, const sfRenderWindow*, unsigned int, unsigned int) /// function and copy its contents into an sfImage instead. /// \code /// sfVector2u windowSize = sfRenderWindow_getSize(window); /// sfTexture* texture = sfTexture_create(windowSize.x, windowSize.y); /// sfTexture_updateFromRenderWindow(texture, window, windowSize.x, windowSize.y); /// sfImage* screenshot = sfTexture_copyToImage(texture); /// \endcode /// /// This is a slow operation, whose main purpose is to make /// screenshots of the application. If you want to update an /// image with the contents of the window and then use it for /// drawing, you should rather use a sfTexture and the /// sfTexture_updateFromWindow(sfTexture*, const sfWindow*, unsigned int, unsigned int) function. /// You can also draw things directly to a texture with the /// sfRenderTexture class. /// /// \return sfImage containing the captured contents. /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API CSFML_DEPRECATED sfImage* sfRenderWindow_capture(const sfRenderWindow* renderWindow); //////////////////////////////////////////////////////////// /// \brief Get the current position of the mouse relative to a render-window /// /// This function returns the current position of the mouse /// cursor relative to the given render-window, or desktop if NULL is passed. /// /// \param relativeTo Reference window /// /// \return Position of the mouse cursor, relative to the given render window /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2i sfMouse_getPositionRenderWindow(const sfRenderWindow* relativeTo); //////////////////////////////////////////////////////////// /// \brief Set the current position of the mouse relative to a render window /// /// This function sets the current position of the mouse /// cursor relative to the given render-window, or desktop if NULL is passed. /// /// \param position New position of the mouse /// \param relativeTo Reference window /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfMouse_setPositionRenderWindow(sfVector2i position, const sfRenderWindow* relativeTo); //////////////////////////////////////////////////////////// /// \brief Get the current position of a touch in window coordinates /// /// This function returns the current touch position /// relative to the given render window, or desktop if NULL is passed. /// /// \param finger Finger index /// \param relativeTo Reference window /// /// \return Current position of \a finger, or undefined if it's not down /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2i sfTouch_getPositionRenderWindow(unsigned int finger, const sfRenderWindow* relativeTo); #endif // SFML_RENDERWINDOW_H CSFML-2.4/include/SFML/Graphics/Shader.h000066400000000000000000000704011301071240500175210ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SHADER_H #define SFML_SHADER_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include #include #include #include //////////////////////////////////////////////////////////// /// \brief Load the vertex, geometry and fragment shaders from files /// /// This function loads the vertex, geometry and fragment /// shaders. Pass NULL if you don't want to load /// a specific shader. /// The sources must be text files containing valid shaders /// in GLSL language. GLSL is a C-like language dedicated to /// OpenGL shaders; you'll probably need to read a good documentation /// for it before writing your own shaders. /// /// \param vertexShaderFilename Path of the vertex shader file to load, or NULL to skip this shader /// \param geometryShaderFilename Path of the geometry shader file to load, or NULL to skip this shader /// \param fragmentShaderFilename Path of the fragment shader file to load, or NULL to skip this shader /// /// \return A new sfShader object, or NULL if it failed /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfShader* sfShader_createFromFile(const char* vertexShaderFilename, const char* geometryShaderFilename, const char* fragmentShaderFilename); //////////////////////////////////////////////////////////// /// \brief Load the vertex, geometry and fragment shaders from source code in memory /// /// This function loads the vertex, geometry and fragment /// shaders. Pass NULL if you don't want to load /// a specific shader. /// The sources must be valid shaders in GLSL language. GLSL is /// a C-like language dedicated to OpenGL shaders; you'll /// probably need to read a good documentation for it before /// writing your own shaders. /// /// \param vertexShader String containing the source code of the vertex shader, or NULL to skip this shader /// \param geometryShader String containing the source code of the geometry shader, or NULL to skip this shader /// \param fragmentShader String containing the source code of the fragment shader, or NULL to skip this shader /// /// \return A new sfShader object, or NULL if it failed /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfShader* sfShader_createFromMemory(const char* vertexShader, const char* geometryShader, const char* fragmentShader); //////////////////////////////////////////////////////////// /// \brief Load the vertex, geometry and fragment shaders from custom streams /// /// This function loads the vertex, geometry and fragment /// shaders. Pass NULL if you don't want to load /// a specific shader. /// The source codes must be valid shaders in GLSL language. /// GLSL is a C-like language dedicated to OpenGL shaders; /// you'll probably need to read a good documentation for /// it before writing your own shaders. /// /// \param vertexShaderStream Source stream to read the vertex shader from, or NULL to skip this shader /// \param geometryShaderStream Source stream to read the geometry shader from, or NULL to skip this shader /// \param fragmentShaderStream Source stream to read the fragment shader from, or NULL to skip this shader /// /// \return A new sfShader object, or NULL if it failed /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfShader* sfShader_createFromStream(sfInputStream* vertexShaderStream, sfInputStream* geometryShaderStream, sfInputStream* fragmentShaderStream); //////////////////////////////////////////////////////////// /// \brief Destroy an existing shader /// /// \param shader Shader to delete /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_destroy(sfShader* shader); //////////////////////////////////////////////////////////// /// \brief Specify value for \p float uniform /// /// \param shader Shader object /// \param name Name of the uniform variable in GLSL /// \param x Value of the float scalar /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_setFloatUniform(sfShader* shader, const char* name, float x); //////////////////////////////////////////////////////////// /// \brief Specify value for \p vec2 uniform /// /// \param shader Shader object /// \param name Name of the uniform variable in GLSL /// \param vector Value of the vec2 vector /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_setVec2Uniform(sfShader* shader, const char* name, sfGlslVec2 vector); //////////////////////////////////////////////////////////// /// \brief Specify value for \p vec3 uniform /// /// \param shader Shader object /// \param name Name of the uniform variable in GLSL /// \param vector Value of the vec3 vector /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_setVec3Uniform(sfShader* shader, const char* name, sfGlslVec3 vector); //////////////////////////////////////////////////////////// /// \brief Specify value for \p vec4 uniform /// /// sfColor objects can be passed to this function via /// the use of sfGlslVec4_fromsfColor(sfColor); /// /// \param shader Shader object /// \param name Name of the uniform variable in GLSL /// \param vector Value of the vec4 vector /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_setVec4Uniform(sfShader* shader, const char* name, sfGlslVec4 vector); //////////////////////////////////////////////////////////// /// \brief Specify value for \p vec4 uniform /// /// \param shader Shader object /// \param name Name of the uniform variable in GLSL /// \param color Value of the vec4 vector /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_setColorUniform(sfShader* shader, const char* name, sfColor color); //////////////////////////////////////////////////////////// /// \brief Specify value for \p int uniform /// /// \param shader Shader object /// \param name Name of the uniform variable in GLSL /// \param x Value of the integer scalar /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_setIntUniform(sfShader* shader, const char* name, int x); //////////////////////////////////////////////////////////// /// \brief Specify value for \p ivec2 uniform /// /// \param shader Shader object /// \param name Name of the uniform variable in GLSL /// \param vector Value of the ivec2 vector /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_setIvec2Uniform(sfShader* shader, const char* name, sfGlslIvec2 vector); //////////////////////////////////////////////////////////// /// \brief Specify value for \p ivec3 uniform /// /// \param shader Shader object /// \param name Name of the uniform variable in GLSL /// \param vector Value of the ivec3 vector /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_setIvec3Uniform(sfShader* shader, const char* name, sfGlslIvec3 vector); //////////////////////////////////////////////////////////// /// \brief Specify value for \p ivec4 uniform /// /// sfColor objects can be passed to this function via /// the use of sfGlslIvec4_fromsfColor(sfColor); /// /// \param shader Shader object /// \param name Name of the uniform variable in GLSL /// \param vector Value of the ivec4 vector /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_setIvec4Uniform(sfShader* shader, const char* name, sfGlslIvec4 vector); //////////////////////////////////////////////////////////// /// \brief Specify value for \p ivec4 uniform /// /// \param shader Shader object /// \param name Name of the uniform variable in GLSL /// \param color Value of the ivec4 vector /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_setIntColorUniform(sfShader* shader, const char* name, sfColor color); //////////////////////////////////////////////////////////// /// \brief Specify value for \p bool uniform /// /// \param shader Shader object /// \param name Name of the uniform variable in GLSL /// \param x Value of the bool scalar /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_setBoolUniform(sfShader* shader, const char* name, sfBool x); //////////////////////////////////////////////////////////// /// \brief Specify value for \p bvec2 uniform /// /// \param shader Shader object /// \param name Name of the uniform variable in GLSL /// \param vector Value of the bvec2 vector /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_setBvec2Uniform(sfShader* shader, const char* name, sfGlslBvec2 vector); //////////////////////////////////////////////////////////// /// \brief Specify value for \p Bvec3 uniform /// /// \param shader Shader object /// \param name Name of the uniform variable in GLSL /// \param vector Value of the Bvec3 vector /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_setBvec3Uniform(sfShader* shader, const char* name, sfGlslBvec3 vector); //////////////////////////////////////////////////////////// /// \brief Specify value for \p bvec4 uniform /// /// sfColor objects can be passed to this function via /// the use of sfGlslIvec4_fromsfColor(sfColor); /// /// \param shader Shader object /// \param name Name of the uniform variable in GLSL /// \param vector Value of the bvec4 vector /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_setBvec4Uniform(sfShader* shader, const char* name, sfGlslBvec4 vector); //////////////////////////////////////////////////////////// /// \brief Specify value for \p mat3 matrix /// /// \param shader Shader object /// \param name Name of the uniform variable in GLSL /// \param matrix Value of the mat3 matrix /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_setMat3Uniform(sfShader* shader, const char* name, const sfGlslMat3* matrix); //////////////////////////////////////////////////////////// /// \brief Specify value for \p mat4 matrix /// /// \param shader Shader object /// \param name Name of the uniform variable in GLSL /// \param matrix Value of the mat4 matrix /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_setMat4Uniform(sfShader* shader, const char* name, const sfGlslMat4* matrix); //////////////////////////////////////////////////////////// /// \brief Specify a texture as \p sampler2D uniform /// /// \a name is the name of the variable to change in the shader. /// The corresponding parameter in the shader must be a 2D texture /// (\p sampler2D GLSL type). /// /// Example: /// \code /// uniform sampler2D the_texture; // this is the variable in the shader /// \endcode /// \code /// sfTexture texture; /// ... /// sfShader_setTextureUniform(shader, "the_texture", &texture); /// \endcode /// It is important to note that \a texture must remain alive as long /// as the shader uses it, no copy is made internally. /// /// To use the texture of the object being drawn, which cannot be /// known in advance, you can pass the special value /// sf::Shader::CurrentTexture: /// \code /// shader.setUniform("the_texture", sf::Shader::CurrentTexture). /// \endcode /// /// \param shader Shader object /// \param name Name of the texture in the shader /// \param texture Texture to assign /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_setTextureUniform(sfShader* shader, const char* name, const sfTexture* texture); //////////////////////////////////////////////////////////// /// \brief Specify current texture as \p sampler2D uniform /// /// This overload maps a shader texture variable to the /// texture of the object being drawn, which cannot be /// known in advance. /// The corresponding parameter in the shader must be a 2D texture /// (\p sampler2D GLSL type). /// /// Example: /// \code /// uniform sampler2D current; // this is the variable in the shader /// \endcode /// \code /// sfShader_setCurrentTextureUniform(shader, "current"); /// \endcode /// /// \param shader Shader object /// \param name Name of the texture in the shader /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_setCurrentTextureUniform(sfShader* shader, const char* name); //////////////////////////////////////////////////////////// /// \brief Specify values for \p float[] array uniform /// /// \param shader Shader object /// \param name Name of the uniform variable in GLSL /// \param scalarArray pointer to array of \p float values /// \param length Number of elements in the array /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_setFloatUniformArray(sfShader* shader, const char* name, const float* scalarArray, size_t length); //////////////////////////////////////////////////////////// /// \brief Specify values for \p vec2[] array uniform /// /// \param shader Shader object /// \param name Name of the uniform variable in GLSL /// \param vectorArray pointer to array of \p vec2 values /// \param length Number of elements in the array /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_setVec2UniformArray(sfShader* shader, const char* name, const sfGlslVec2* vectorArray, size_t length); //////////////////////////////////////////////////////////// /// \brief Specify values for \p vec3[] array uniform /// /// \param shader Shader object /// \param name Name of the uniform variable in GLSL /// \param vectorArray pointer to array of \p vec3 values /// \param length Number of elements in the array /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_setVec3UniformArray(sfShader* shader, const char* name, const sfGlslVec3* vectorArray, size_t length); //////////////////////////////////////////////////////////// /// \brief Specify values for \p vec4[] array uniform /// /// \param shader Shader object /// \param name Name of the uniform variable in GLSL /// \param vectorArray pointer to array of \p vec4 values /// \param length Number of elements in the array /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_setVec4UniformArray(sfShader* shader, const char* name, const sfGlslVec4* vectorArray, size_t length); //////////////////////////////////////////////////////////// /// \brief Specify values for \p mat3[] array uniform /// /// \param shader Shader object /// \param name Name of the uniform variable in GLSL /// \param matrixArray pointer to array of \p mat3 values /// \param length Number of elements in the array /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_setMat3UniformArray(sfShader* shader, const char* name, const sfGlslMat3* matrixArray, size_t length); //////////////////////////////////////////////////////////// /// \brief Specify values for \p mat4[] array uniform /// /// \param shader Shader object /// \param name Name of the uniform variable in GLSL /// \param matrixArray pointer to array of \p mat4 values /// \param length Number of elements in the array /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_setMat4UniformArray(sfShader* shader, const char* name, const sfGlslMat4* matrixArray, size_t length); //////////////////////////////////////////////////////////// /// \brief Change a float parameter of a shader /// /// \a name is the name of the variable to change in the shader. /// The corresponding parameter in the shader must be a float /// (float GLSL type). /// /// Example: /// \code /// uniform float myparam; // this is the variable in the shader /// \endcode /// \code /// sfShader_setFloatParameter(shader, "myparam", 5.2f); /// \endcode /// /// \param shader Shader object /// \param name Name of the parameter in the shader /// \param x Value to assign /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setFloatParameter(sfShader* shader, const char* name, float x); //////////////////////////////////////////////////////////// /// \brief Change a 2-components vector parameter of a shader /// /// \a name is the name of the variable to change in the shader. /// The corresponding parameter in the shader must be a 2x1 vector /// (vec2 GLSL type). /// /// Example: /// \code /// uniform vec2 myparam; // this is the variable in the shader /// \endcode /// \code /// sfShader_setFloat2Parameter(shader, "myparam", 5.2f, 6.0f); /// \endcode /// /// \param shader Shader object /// \param name Name of the parameter in the shader /// \param x First component of the value to assign /// \param y Second component of the value to assign /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setFloat2Parameter(sfShader* shader, const char* name, float x, float y); //////////////////////////////////////////////////////////// /// \brief Change a 3-components vector parameter of a shader /// /// \a name is the name of the variable to change in the shader. /// The corresponding parameter in the shader must be a 3x1 vector /// (vec3 GLSL type). /// /// Example: /// \code /// uniform vec3 myparam; // this is the variable in the shader /// \endcode /// \code /// sfShader_setFloat3Parameter(shader, "myparam", 5.2f, 6.0f, -8.1f); /// \endcode /// /// \param shader Shader object /// \param name Name of the parameter in the shader /// \param x First component of the value to assign /// \param y Second component of the value to assign /// \param z Third component of the value to assign /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setFloat3Parameter(sfShader* shader, const char* name, float x, float y, float z); //////////////////////////////////////////////////////////// /// \brief Change a 4-components vector parameter of a shader /// /// \a name is the name of the variable to change in the shader. /// The corresponding parameter in the shader must be a 4x1 vector /// (vec4 GLSL type). /// /// Example: /// \code /// uniform vec4 myparam; // this is the variable in the shader /// \endcode /// \code /// sfShader_setFloat4Parameter(shader, "myparam", 5.2f, 6.0f, -8.1f, 0.4f); /// \endcode /// /// \param shader Shader object /// \param name Name of the parameter in the shader /// \param x First component of the value to assign /// \param y Second component of the value to assign /// \param z Third component of the value to assign /// \param w Fourth component of the value to assign /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setFloat4Parameter(sfShader* shader, const char* name, float x, float y, float z, float w); //////////////////////////////////////////////////////////// /// \brief Change a 2-components vector parameter of a shader /// /// \a name is the name of the variable to change in the shader. /// The corresponding parameter in the shader must be a 2x1 vector /// (vec2 GLSL type). /// /// Example: /// \code /// uniform vec2 myparam; // this is the variable in the shader /// \endcode /// \code /// sfVector2f vec = {5.2f, 6.0f}; /// sfShader_setVector2Parameter(shader, "myparam", vec); /// \endcode /// /// \param shader Shader object /// \param name Name of the parameter in the shader /// \param vector Vector to assign /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setVector2Parameter(sfShader* shader, const char* name, sfVector2f vector); //////////////////////////////////////////////////////////// /// \brief Change a 3-components vector parameter of a shader /// /// \a name is the name of the variable to change in the shader. /// The corresponding parameter in the shader must be a 3x1 vector /// (vec3 GLSL type). /// /// Example: /// \code /// uniform vec3 myparam; // this is the variable in the shader /// \endcode /// \code /// sfVector3f vec = {5.2f, 6.0f, -8.1f}; /// sfShader_setVector3Parameter(shader, "myparam", vec); /// \endcode /// /// \param shader Shader object /// \param name Name of the parameter in the shader /// \param vector Vector to assign /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setVector3Parameter(sfShader* shader, const char* name, sfVector3f vector); //////////////////////////////////////////////////////////// /// \brief Change a color parameter of a shader /// /// \a name is the name of the variable to change in the shader. /// The corresponding parameter in the shader must be a 4x1 vector /// (vec4 GLSL type). /// /// It is important to note that the components of the color are /// normalized before being passed to the shader. Therefore, /// they are converted from range [0 .. 255] to range [0 .. 1]. /// For example, a sf::Color(255, 125, 0, 255) will be transformed /// to a vec4(1.0, 0.5, 0.0, 1.0) in the shader. /// /// Example: /// \code /// uniform vec4 color; // this is the variable in the shader /// \endcode /// \code /// sfShader_setColorParameter(shader, "color", sfColor_fromRGB(255, 128, 0)); /// \endcode /// /// \param shader Shader object /// \param name Name of the parameter in the shader /// \param color Color to assign /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setColorParameter(sfShader* shader, const char* name, sfColor color); //////////////////////////////////////////////////////////// /// \brief Change a matrix parameter of a shader /// /// \a name is the name of the variable to change in the shader. /// The corresponding parameter in the shader must be a 4x4 matrix /// (mat4 GLSL type). /// /// Example: /// \code /// uniform mat4 matrix; // this is the variable in the shader /// \endcode /// \code /// @todo /// sfShader_setTransformParameter(shader, "matrix", transform); /// \endcode /// /// \param shader Shader object /// \param name Name of the parameter in the shader /// \param transform Transform to assign /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setTransformParameter(sfShader* shader, const char* name, sfTransform transform); //////////////////////////////////////////////////////////// /// \brief Change a texture parameter of a shader /// /// \a name is the name of the variable to change in the shader. /// The corresponding parameter in the shader must be a 2D texture /// (sampler2D GLSL type). /// /// Example: /// \code /// uniform sampler2D the_texture; // this is the variable in the shader /// \endcode /// \code /// sf::Texture texture; /// ... /// sfShader_setTextureParameter(shader, "the_texture", texture); /// \endcode /// It is important to note that \a texture must remain alive as long /// as the shader uses it, no copy is made internally. /// /// To use the texture of the object being draw, which cannot be /// known in advance, you can use the special function /// sfShader_setCurrentTextureParameter: /// \code /// sfShader_setCurrentTextureParameter(shader, "the_texture"). /// \endcode /// /// \param shader Shader object /// \param name Name of the texture in the shader /// \param texture Texture to assign /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setTextureParameter(sfShader* shader, const char* name, const sfTexture* texture); //////////////////////////////////////////////////////////// /// \brief Change a texture parameter of a shader /// /// This function maps a shader texture variable to the /// texture of the object being drawn, which cannot be /// known in advance. /// The corresponding parameter in the shader must be a 2D texture /// (sampler2D GLSL type). /// /// Example: /// \code /// uniform sampler2D current; // this is the variable in the shader /// \endcode /// \code /// sfShader_setCurrentTextureParameter(shader, "current"); /// \endcode /// /// \param shader Shader object /// \param name Name of the texture in the shader /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setCurrentTextureParameter(sfShader* shader, const char* name); //////////////////////////////////////////////////////////// /// \brief Get the underlying OpenGL handle of the shader. /// /// You shouldn't need to use this function, unless you have /// very specific stuff to implement that SFML doesn't support, /// or implement a temporary workaround until a bug is fixed. /// /// \param shader Shader object /// /// \return OpenGL handle of the shader or 0 if not yet loaded /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API unsigned int sfShader_getNativeHandle(const sfShader* shader); //////////////////////////////////////////////////////////// /// \brief Bind a shader for rendering (activate it) /// /// This function is not part of the graphics API, it mustn't be /// used when drawing SFML entities. It must be used only if you /// mix sfShader with OpenGL code. /// /// \code /// sfShader *s1, *s2; /// ... /// sfShader_bind(s1); /// // draw OpenGL stuff that use s1... /// sfShader_bind(s2); /// // draw OpenGL stuff that use s2... /// sfShader_bind(0); /// // draw OpenGL stuff that use no shader... /// \endcode /// /// \param shader Shader to bind, can be null to use no shader /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShader_bind(const sfShader* shader); //////////////////////////////////////////////////////////// /// \brief Tell whether or not the system supports shaders /// /// This function should always be called before using /// the shader features. If it returns false, then /// any attempt to use sfShader will fail. /// /// \return sfTrue if the system can use shaders, sfFalse otherwise /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfBool sfShader_isAvailable(void); //////////////////////////////////////////////////////////// /// \brief Tell whether or not the system supports geometry shaders /// /// This function should always be called before using /// the geometry shader features. If it returns false, then /// any attempt to use sfShader geometry shader features will fail. /// /// This function can only return true if isAvailable() would also /// return true, since shaders in general have to be supported in /// order for geometry shaders to be supported as well. /// /// Note: The first call to this function, whether by your /// code or SFML will result in a context switch. /// /// \return True if geometry shaders are supported, false otherwise /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfBool sfShader_isGeometryAvailable(void); #endif // SFML_SHADER_H CSFML-2.4/include/SFML/Graphics/Shape.h000066400000000000000000000364701301071240500173630ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SHAPE_H #define SFML_SHAPE_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include #include typedef size_t (*sfShapeGetPointCountCallback)(void*); ///< Type of the callback used to get the number of points in a shape typedef sfVector2f (*sfShapeGetPointCallback)(size_t, void*); ///< Type of the callback used to get a point of a shape //////////////////////////////////////////////////////////// /// \brief Create a new shape /// /// \param getPointCount Callback that provides the point count of the shape /// \param getPoint Callback that provides the points of the shape /// \param userData Data to pass to the callback functions /// /// \return A new sfShape object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfShape* sfShape_create(sfShapeGetPointCountCallback getPointCount, sfShapeGetPointCallback getPoint, void* userData); //////////////////////////////////////////////////////////// /// \brief Destroy an existing shape /// /// \param shape Shape to delete /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShape_destroy(sfShape* shape); //////////////////////////////////////////////////////////// /// \brief Set the position of a shape /// /// This function completely overwrites the previous position. /// See sfShape_move to apply an offset based on the previous position instead. /// The default position of a circle Shape object is (0, 0). /// /// \param shape Shape object /// \param position New position /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShape_setPosition(sfShape* shape, sfVector2f position); //////////////////////////////////////////////////////////// /// \brief Set the orientation of a shape /// /// This function completely overwrites the previous rotation. /// See sfShape_rotate to add an angle based on the previous rotation instead. /// The default rotation of a circle Shape object is 0. /// /// \param shape Shape object /// \param angle New rotation, in degrees /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShape_setRotation(sfShape* shape, float angle); //////////////////////////////////////////////////////////// /// \brief Set the scale factors of a shape /// /// This function completely overwrites the previous scale. /// See sfShape_scale to add a factor based on the previous scale instead. /// The default scale of a circle Shape object is (1, 1). /// /// \param shape Shape object /// \param scale New scale factors /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShape_setScale(sfShape* shape, sfVector2f scale); //////////////////////////////////////////////////////////// /// \brief Set the local origin of a shape /// /// The origin of an object defines the center point for /// all transformations (position, scale, rotation). /// The coordinates of this point must be relative to the /// top-left corner of the object, and ignore all /// transformations (position, scale, rotation). /// The default origin of a circle Shape object is (0, 0). /// /// \param shape Shape object /// \param origin New origin /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShape_setOrigin(sfShape* shape, sfVector2f origin); //////////////////////////////////////////////////////////// /// \brief Get the position of a shape /// /// \param shape Shape object /// /// \return Current position /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfShape_getPosition(const sfShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the orientation of a shape /// /// The rotation is always in the range [0, 360]. /// /// \param shape Shape object /// /// \return Current rotation, in degrees /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API float sfShape_getRotation(const sfShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the current scale of a shape /// /// \param shape Shape object /// /// \return Current scale factors /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfShape_getScale(const sfShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the local origin of a shape /// /// \param shape Shape object /// /// \return Current origin /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfShape_getOrigin(const sfShape* shape); //////////////////////////////////////////////////////////// /// \brief Move a shape by a given offset /// /// This function adds to the current position of the object, /// unlike sfShape_setPosition which overwrites it. /// /// \param shape Shape object /// \param offset Offset /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShape_move(sfShape* shape, sfVector2f offset); //////////////////////////////////////////////////////////// /// \brief Rotate a shape /// /// This function adds to the current rotation of the object, /// unlike sfShape_setRotation which overwrites it. /// /// \param shape Shape object /// \param angle Angle of rotation, in degrees /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShape_rotate(sfShape* shape, float angle); //////////////////////////////////////////////////////////// /// \brief Scale a shape /// /// This function multiplies the current scale of the object, /// unlike sfShape_setScale which overwrites it. /// /// \param shape Shape object /// \param factors Scale factors /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShape_scale(sfShape* shape, sfVector2f factors); //////////////////////////////////////////////////////////// /// \brief Get the combined transform of a shape /// /// \param shape shape object /// /// \return Transform combining the position/rotation/scale/origin of the object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfTransform sfShape_getTransform(const sfShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the inverse of the combined transform of a shape /// /// \param shape shape object /// /// \return Inverse of the combined transformations applied to the object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfTransform sfShape_getInverseTransform(const sfShape* shape); //////////////////////////////////////////////////////////// /// \brief Change the source texture of a shape /// /// The \a texture argument refers to a texture that must /// exist as long as the shape uses it. Indeed, the shape /// doesn't store its own copy of the texture, but rather keeps /// a pointer to the one that you passed to this function. /// If the source texture is destroyed and the shape tries to /// use it, the behaviour is undefined. /// \a texture can be NULL to disable texturing. /// If \a resetRect is true, the TextureRect property of /// the shape is automatically adjusted to the size of the new /// texture. If it is false, the texture rect is left unchanged. /// /// \param shape Shape object /// \param texture New texture /// \param resetRect Should the texture rect be reset to the size of the new texture? /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShape_setTexture(sfShape* shape, const sfTexture* texture, sfBool resetRect); //////////////////////////////////////////////////////////// /// \brief Set the sub-rectangle of the texture that a shape will display /// /// The texture rect is useful when you don't want to display /// the whole texture, but rather a part of it. /// By default, the texture rect covers the entire texture. /// /// \param shape Shape object /// \param rect Rectangle defining the region of the texture to display /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShape_setTextureRect(sfShape* shape, sfIntRect rect); //////////////////////////////////////////////////////////// /// \brief Set the fill color of a shape /// /// This color is modulated (multiplied) with the shape's /// texture if any. It can be used to colorize the shape, /// or change its global opacity. /// You can use sfTransparent to make the inside of /// the shape transparent, and have the outline alone. /// By default, the shape's fill color is opaque white. /// /// \param shape Shape object /// \param color New color of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShape_setFillColor(sfShape* shape, sfColor color); //////////////////////////////////////////////////////////// /// \brief Set the outline color of a shape /// /// You can use sfTransparent to disable the outline. /// By default, the shape's outline color is opaque white. /// /// \param shape Shape object /// \param color New outline color of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShape_setOutlineColor(sfShape* shape, sfColor color); //////////////////////////////////////////////////////////// /// \brief Set the thickness of a shape's outline /// /// This number cannot be negative. Using zero disables /// the outline. /// By default, the outline thickness is 0. /// /// \param shape Shape object /// \param thickness New outline thickness /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShape_setOutlineThickness(sfShape* shape, float thickness); //////////////////////////////////////////////////////////// /// \brief Get the source texture of a shape /// /// If the shape has no source texture, a NULL pointer is returned. /// The returned pointer is const, which means that you can't /// modify the texture when you retrieve it with this function. /// /// \param shape Shape object /// /// \return Pointer to the shape's texture /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API const sfTexture* sfShape_getTexture(const sfShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the sub-rectangle of the texture displayed by a shape /// /// \param shape Shape object /// /// \return Texture rectangle of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfIntRect sfShape_getTextureRect(const sfShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the fill color of a shape /// /// \param shape Shape object /// /// \return Fill color of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfColor sfShape_getFillColor(const sfShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the outline color of a shape /// /// \param shape Shape object /// /// \return Outline color of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfColor sfShape_getOutlineColor(const sfShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the outline thickness of a shape /// /// \param shape Shape object /// /// \return Outline thickness of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API float sfShape_getOutlineThickness(const sfShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the total number of points of a shape /// /// \param shape Shape object /// /// \return Number of points of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API size_t sfShape_getPointCount(const sfShape* shape); //////////////////////////////////////////////////////////// /// \brief Get a point of a shape /// /// The result is undefined if \a index is out of the valid range. /// /// \param shape Shape object /// \param index Index of the point to get, in range [0 .. getPointCount() - 1] /// /// \return Index-th point of the shape /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfShape_getPoint(const sfShape* shape, size_t index); //////////////////////////////////////////////////////////// /// \brief Get the local bounding rectangle of a shape /// /// The returned rectangle is in local coordinates, which means /// that it ignores the transformations (translation, rotation, /// scale, ...) that are applied to the entity. /// In other words, this function returns the bounds of the /// entity in the entity's coordinate system. /// /// \param shape Shape object /// /// \return Local bounding rectangle of the entity /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfFloatRect sfShape_getLocalBounds(const sfShape* shape); //////////////////////////////////////////////////////////// /// \brief Get the global bounding rectangle of a shape /// /// The returned rectangle is in global coordinates, which means /// that it takes in account the transformations (translation, /// rotation, scale, ...) that are applied to the entity. /// In other words, this function returns the bounds of the /// sprite in the global 2D world's coordinate system. /// /// \param shape Shape object /// /// \return Global bounding rectangle of the entity /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfFloatRect sfShape_getGlobalBounds(const sfShape* shape); //////////////////////////////////////////////////////////// /// \brief Recompute the internal geometry of a shape /// /// This function must be called by specialized shape objects /// everytime their points change (ie. the result of either /// the getPointCount or getPoint callbacks is different). /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfShape_update(sfShape* shape); #endif // SFML_SHAPE_H CSFML-2.4/include/SFML/Graphics/Sprite.h000066400000000000000000000304331301071240500175620ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SPRITE_H #define SFML_SPRITE_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include #include //////////////////////////////////////////////////////////// /// \brief Create a new sprite /// /// \return A new sfSprite object, or NULL if it failed /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfSprite* sfSprite_create(void); //////////////////////////////////////////////////////////// /// \brief Copy an existing sprite /// /// \param sprite Sprite to copy /// /// \return Copied object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfSprite* sfSprite_copy(const sfSprite* sprite); //////////////////////////////////////////////////////////// /// \brief Destroy an existing sprite /// /// \param sprite Sprite to delete /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfSprite_destroy(sfSprite* sprite); //////////////////////////////////////////////////////////// /// \brief Set the position of a sprite /// /// This function completely overwrites the previous position. /// See sfSprite_move to apply an offset based on the previous position instead. /// The default position of a sprite Sprite object is (0, 0). /// /// \param sprite Sprite object /// \param position New position /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfSprite_setPosition(sfSprite* sprite, sfVector2f position); //////////////////////////////////////////////////////////// /// \brief Set the orientation of a sprite /// /// This function completely overwrites the previous rotation. /// See sfSprite_rotate to add an angle based on the previous rotation instead. /// The default rotation of a sprite Sprite object is 0. /// /// \param sprite Sprite object /// \param angle New rotation, in degrees /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfSprite_setRotation(sfSprite* sprite, float angle); //////////////////////////////////////////////////////////// /// \brief Set the scale factors of a sprite /// /// This function completely overwrites the previous scale. /// See sfSprite_scale to add a factor based on the previous scale instead. /// The default scale of a sprite Sprite object is (1, 1). /// /// \param sprite Sprite object /// \param scale New scale factors /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfSprite_setScale(sfSprite* sprite, sfVector2f scale); //////////////////////////////////////////////////////////// /// \brief Set the local origin of a sprite /// /// The origin of an object defines the center point for /// all transformations (position, scale, rotation). /// The coordinates of this point must be relative to the /// top-left corner of the object, and ignore all /// transformations (position, scale, rotation). /// The default origin of a sprite Sprite object is (0, 0). /// /// \param sprite Sprite object /// \param origin New origin /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfSprite_setOrigin(sfSprite* sprite, sfVector2f origin); //////////////////////////////////////////////////////////// /// \brief Get the position of a sprite /// /// \param sprite Sprite object /// /// \return Current position /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfSprite_getPosition(const sfSprite* sprite); //////////////////////////////////////////////////////////// /// \brief Get the orientation of a sprite /// /// The rotation is always in the range [0, 360]. /// /// \param sprite Sprite object /// /// \return Current rotation, in degrees /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API float sfSprite_getRotation(const sfSprite* sprite); //////////////////////////////////////////////////////////// /// \brief Get the current scale of a sprite /// /// \param sprite Sprite object /// /// \return Current scale factors /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfSprite_getScale(const sfSprite* sprite); //////////////////////////////////////////////////////////// /// \brief Get the local origin of a sprite /// /// \param sprite Sprite object /// /// \return Current origin /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfSprite_getOrigin(const sfSprite* sprite); //////////////////////////////////////////////////////////// /// \brief Move a sprite by a given offset /// /// This function adds to the current position of the object, /// unlike sfSprite_setPosition which overwrites it. /// /// \param sprite Sprite object /// \param offset Offset /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfSprite_move(sfSprite* sprite, sfVector2f offset); //////////////////////////////////////////////////////////// /// \brief Rotate a sprite /// /// This function adds to the current rotation of the object, /// unlike sfSprite_setRotation which overwrites it. /// /// \param sprite Sprite object /// \param angle Angle of rotation, in degrees /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfSprite_rotate(sfSprite* sprite, float angle); //////////////////////////////////////////////////////////// /// \brief Scale a sprite /// /// This function multiplies the current scale of the object, /// unlike sfSprite_setScale which overwrites it. /// /// \param sprite Sprite object /// \param factors Scale factors /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfSprite_scale(sfSprite* sprite, sfVector2f factors); //////////////////////////////////////////////////////////// /// \brief Get the combined transform of a sprite /// /// \param sprite Sprite object /// /// \return Transform combining the position/rotation/scale/origin of the object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfTransform sfSprite_getTransform(const sfSprite* sprite); //////////////////////////////////////////////////////////// /// \brief Get the inverse of the combined transform of a sprite /// /// \param sprite Sprite object /// /// \return Inverse of the combined transformations applied to the object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfTransform sfSprite_getInverseTransform(const sfSprite* sprite); //////////////////////////////////////////////////////////// /// \brief Change the source texture of a sprite /// /// The \a texture argument refers to a texture that must /// exist as long as the sprite uses it. Indeed, the sprite /// doesn't store its own copy of the texture, but rather keeps /// a pointer to the one that you passed to this function. /// If the source texture is destroyed and the sprite tries to /// use it, the behaviour is undefined. /// If \a resetRect is true, the TextureRect property of /// the sprite is automatically adjusted to the size of the new /// texture. If it is false, the texture rect is left unchanged. /// /// \param sprite Sprite object /// \param texture New texture /// \param resetRect Should the texture rect be reset to the size of the new texture? /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfSprite_setTexture(sfSprite* sprite, const sfTexture* texture, sfBool resetRect); //////////////////////////////////////////////////////////// /// \brief Set the sub-rectangle of the texture that a sprite will display /// /// The texture rect is useful when you don't want to display /// the whole texture, but rather a part of it. /// By default, the texture rect covers the entire texture. /// /// \param sprite Sprite object /// \param rectangle Rectangle defining the region of the texture to display /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfSprite_setTextureRect(sfSprite* sprite, sfIntRect rectangle); //////////////////////////////////////////////////////////// /// \brief Set the global color of a sprite /// /// This color is modulated (multiplied) with the sprite's /// texture. It can be used to colorize the sprite, or change /// its global opacity. /// By default, the sprite's color is opaque white. /// /// \param sprite Sprite object /// \param color New color of the sprite /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfSprite_setColor(sfSprite* sprite, sfColor color); //////////////////////////////////////////////////////////// /// \brief Get the source texture of a sprite /// /// If the sprite has no source texture, a NULL pointer is returned. /// The returned pointer is const, which means that you can't /// modify the texture when you retrieve it with this function. /// /// \param sprite Sprite object /// /// \return Pointer to the sprite's texture /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API const sfTexture* sfSprite_getTexture(const sfSprite* sprite); //////////////////////////////////////////////////////////// /// \brief Get the sub-rectangle of the texture displayed by a sprite /// /// \param sprite Sprite object /// /// \return Texture rectangle of the sprite /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfIntRect sfSprite_getTextureRect(const sfSprite* sprite); //////////////////////////////////////////////////////////// /// \brief Get the global color of a sprite /// /// \param sprite Sprite object /// /// \return Global color of the sprite /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfColor sfSprite_getColor(const sfSprite* sprite); //////////////////////////////////////////////////////////// /// \brief Get the local bounding rectangle of a sprite /// /// The returned rectangle is in local coordinates, which means /// that it ignores the transformations (translation, rotation, /// scale, ...) that are applied to the entity. /// In other words, this function returns the bounds of the /// entity in the entity's coordinate system. /// /// \param sprite Sprite object /// /// \return Local bounding rectangle of the entity /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfFloatRect sfSprite_getLocalBounds(const sfSprite* sprite); //////////////////////////////////////////////////////////// /// \brief Get the global bounding rectangle of a sprite /// /// The returned rectangle is in global coordinates, which means /// that it takes in account the transformations (translation, /// rotation, scale, ...) that are applied to the entity. /// In other words, this function returns the bounds of the /// sprite in the global 2D world's coordinate system. /// /// \param sprite Sprite object /// /// \return Global bounding rectangle of the entity /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfFloatRect sfSprite_getGlobalBounds(const sfSprite* sprite); #endif // SFML_SPRITE_H CSFML-2.4/include/SFML/Graphics/Text.h000066400000000000000000000422321301071240500172400ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_TEXT_H #define SFML_TEXT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include #include //////////////////////////////////////////////////////////// /// sfText styles //////////////////////////////////////////////////////////// typedef enum { sfTextRegular = 0, ///< Regular characters, no style sfTextBold = 1 << 0, ///< Bold characters sfTextItalic = 1 << 1, ///< Italic characters sfTextUnderlined = 1 << 2, ///< Underlined characters sfTextStrikeThrough = 1 << 3 ///< Strike through characters } sfTextStyle; //////////////////////////////////////////////////////////// /// \brief Create a new text /// /// \return A new sfText object, or NULL if it failed /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfText* sfText_create(void); //////////////////////////////////////////////////////////// /// \brief Copy an existing text /// /// \param text Text to copy /// /// \return Copied object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfText* sfText_copy(const sfText* text); //////////////////////////////////////////////////////////// /// \brief Destroy an existing text /// /// \param text Text to delete /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfText_destroy(sfText* text); //////////////////////////////////////////////////////////// /// \brief Set the position of a text /// /// This function completely overwrites the previous position. /// See sfText_move to apply an offset based on the previous position instead. /// The default position of a text Text object is (0, 0). /// /// \param text Text object /// \param position New position /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfText_setPosition(sfText* text, sfVector2f position); //////////////////////////////////////////////////////////// /// \brief Set the orientation of a text /// /// This function completely overwrites the previous rotation. /// See sfText_rotate to add an angle based on the previous rotation instead. /// The default rotation of a text Text object is 0. /// /// \param text Text object /// \param angle New rotation, in degrees /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfText_setRotation(sfText* text, float angle); //////////////////////////////////////////////////////////// /// \brief Set the scale factors of a text /// /// This function completely overwrites the previous scale. /// See sfText_scale to add a factor based on the previous scale instead. /// The default scale of a text Text object is (1, 1). /// /// \param text Text object /// \param scale New scale factors /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfText_setScale(sfText* text, sfVector2f scale); //////////////////////////////////////////////////////////// /// \brief Set the local origin of a text /// /// The origin of an object defines the center point for /// all transformations (position, scale, rotation). /// The coordinates of this point must be relative to the /// top-left corner of the object, and ignore all /// transformations (position, scale, rotation). /// The default origin of a text object is (0, 0). /// /// \param text Text object /// \param origin New origin /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfText_setOrigin(sfText* text, sfVector2f origin); //////////////////////////////////////////////////////////// /// \brief Get the position of a text /// /// \param text Text object /// /// \return Current position /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfText_getPosition(const sfText* text); //////////////////////////////////////////////////////////// /// \brief Get the orientation of a text /// /// The rotation is always in the range [0, 360]. /// /// \param text Text object /// /// \return Current rotation, in degrees /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API float sfText_getRotation(const sfText* text); //////////////////////////////////////////////////////////// /// \brief Get the current scale of a text /// /// \param text Text object /// /// \return Current scale factors /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfText_getScale(const sfText* text); //////////////////////////////////////////////////////////// /// \brief Get the local origin of a text /// /// \param text Text object /// /// \return Current origin /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfText_getOrigin(const sfText* text); //////////////////////////////////////////////////////////// /// \brief Move a text by a given offset /// /// This function adds to the current position of the object, /// unlike sfText_setPosition which overwrites it. /// /// \param text Text object /// \param offset Offset /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfText_move(sfText* text, sfVector2f offset); //////////////////////////////////////////////////////////// /// \brief Rotate a text /// /// This function adds to the current rotation of the object, /// unlike sfText_setRotation which overwrites it. /// /// \param text Text object /// \param angle Angle of rotation, in degrees /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfText_rotate(sfText* text, float angle); //////////////////////////////////////////////////////////// /// \brief Scale a text /// /// This function multiplies the current scale of the object, /// unlike sfText_setScale which overwrites it. /// /// \param text Text object /// \param factors Scale factors /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfText_scale(sfText* text, sfVector2f factors); //////////////////////////////////////////////////////////// /// \brief Get the combined transform of a text /// /// \param text Text object /// /// \return Transform combining the position/rotation/scale/origin of the object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfTransform sfText_getTransform(const sfText* text); //////////////////////////////////////////////////////////// /// \brief Get the inverse of the combined transform of a text /// /// \param text Text object /// /// \return Inverse of the combined transformations applied to the object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfTransform sfText_getInverseTransform(const sfText* text); //////////////////////////////////////////////////////////// /// \brief Set the string of a text (from an ANSI string) /// /// A text's string is empty by default. /// /// \param text Text object /// \param string New string /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfText_setString(sfText* text, const char* string); //////////////////////////////////////////////////////////// /// \brief Set the string of a text (from a unicode string) /// /// \param text Text object /// \param string New string /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfText_setUnicodeString(sfText* text, const sfUint32* string); //////////////////////////////////////////////////////////// /// \brief Set the font of a text /// /// The \a font argument refers to a texture that must /// exist as long as the text uses it. Indeed, the text /// doesn't store its own copy of the font, but rather keeps /// a pointer to the one that you passed to this function. /// If the font is destroyed and the text tries to /// use it, the behaviour is undefined. /// /// \param text Text object /// \param font New font /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfText_setFont(sfText* text, const sfFont* font); //////////////////////////////////////////////////////////// /// \brief Set the character size of a text /// /// The default size is 30. /// /// \param text Text object /// \param size New character size, in pixels /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfText_setCharacterSize(sfText* text, unsigned int size); //////////////////////////////////////////////////////////// /// \brief Set the style of a text /// /// You can pass a combination of one or more styles, for /// example sfTextBold | sfTextItalic. /// The default style is sfTextRegular. /// /// \param text Text object /// \param style New style /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfText_setStyle(sfText* text, sfUint32 style); //////////////////////////////////////////////////////////// /// \brief Set the fill color of a text /// /// By default, the text's fill color is opaque white. /// Setting the fill color to a transparent color with an outline /// will cause the outline to be displayed in the fill area of the text. /// /// \param text Text object /// \param color New fill color of the text /// /// \deprecated This function is deprecated and may be removed in future releases. /// Use sfText_setFillColor instead. /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfText_setColor(sfText* text, sfColor color); //////////////////////////////////////////////////////////// /// \brief Set the fill color of a text /// /// By default, the text's fill color is opaque white. /// Setting the fill color to a transparent color with an outline /// will cause the outline to be displayed in the fill area of the text. /// /// \param text Text object /// \param color New fill color of the text /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfText_setFillColor(sfText* text, sfColor color); //////////////////////////////////////////////////////////// /// \brief Set the outline color of the text /// /// By default, the text's outline color is opaque black. /// /// \param text Text object /// \param color New outline color of the text /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfText_setOutlineColor(sfText* text, sfColor color); //////////////////////////////////////////////////////////// /// \brief Set the thickness of the text's outline /// /// By default, the outline thickness is 0. /// /// Be aware that using a negative value for the outline /// thickness will cause distorted rendering. /// /// \param thickness New outline thickness, in pixels /// /// \see getOutlineThickness /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfText_setOutlineThickness(sfText* text, float thickness); //////////////////////////////////////////////////////////// /// \brief Get the string of a text (returns an ANSI string) /// /// \param text Text object /// /// \return String as a locale-dependant ANSI string /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API const char* sfText_getString(const sfText* text); //////////////////////////////////////////////////////////// /// \brief Get the string of a text (returns a unicode string) /// /// \param text Text object /// /// \return String as UTF-32 /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API const sfUint32* sfText_getUnicodeString(const sfText* text); //////////////////////////////////////////////////////////// /// \brief Get the font used by a text /// /// If the text has no font attached, a NULL pointer is returned. /// The returned pointer is const, which means that you can't /// modify the font when you retrieve it with this function. /// /// \param text Text object /// /// \return Pointer to the font /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API const sfFont* sfText_getFont(const sfText* text); //////////////////////////////////////////////////////////// /// \brief Get the size of the characters of a text /// /// \param text Text object /// /// \return Size of the characters /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API unsigned int sfText_getCharacterSize(const sfText* text); //////////////////////////////////////////////////////////// /// \brief Get the style of a text /// /// \param text Text object /// /// \return Current string style (see sfTextStyle enum) /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfUint32 sfText_getStyle(const sfText* text); //////////////////////////////////////////////////////////// /// \brief Get the fill color of a text /// /// \param text Text object /// /// \return Fill color of the text /// /// \deprecated This function is deprecated and may be removed in future releases. /// Use sfText_getFillColor instead. /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfColor sfText_getColor(const sfText* text); //////////////////////////////////////////////////////////// /// \brief Get the fill color of a text /// /// \param text Text object /// /// \return Fill color of the text /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfColor sfText_getFillColor(const sfText* text); //////////////////////////////////////////////////////////// /// \brief Get the outline color of a text /// /// \param text Text object /// /// \return Outline color of the text /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfColor sfText_getOutlineColor(const sfText* text); //////////////////////////////////////////////////////////// /// \brief Get the outline thickness of a text /// /// \param text Text object /// /// \return Outline thickness of a text, in pixels /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API float sfText_getOutlineThickness(const sfText* text); //////////////////////////////////////////////////////////// /// \brief Return the position of the \a index-th character in a text /// /// This function computes the visual position of a character /// from its index in the string. The returned position is /// in global coordinates (translation, rotation, scale and /// origin are applied). /// If \a index is out of range, the position of the end of /// the string is returned. /// /// \param text Text object /// \param index Index of the character /// /// \return Position of the character /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfText_findCharacterPos(const sfText* text, size_t index); //////////////////////////////////////////////////////////// /// \brief Get the local bounding rectangle of a text /// /// The returned rectangle is in local coordinates, which means /// that it ignores the transformations (translation, rotation, /// scale, ...) that are applied to the entity. /// In other words, this function returns the bounds of the /// entity in the entity's coordinate system. /// /// \param text Text object /// /// \return Local bounding rectangle of the entity /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfFloatRect sfText_getLocalBounds(const sfText* text); //////////////////////////////////////////////////////////// /// \brief Get the global bounding rectangle of a text /// /// The returned rectangle is in global coordinates, which means /// that it takes in account the transformations (translation, /// rotation, scale, ...) that are applied to the entity. /// In other words, this function returns the bounds of the /// text in the global 2D world's coordinate system. /// /// \param text Text object /// /// \return Global bounding rectangle of the entity /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfFloatRect sfText_getGlobalBounds(const sfText* text); #endif // SFML_TEXT_H CSFML-2.4/include/SFML/Graphics/Texture.h000066400000000000000000000337551301071240500177660ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_TEXTURE_H #define SFML_TEXTURE_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include #include //////////////////////////////////////////////////////////// /// \brief Create a new texture /// /// \param width Texture width /// \param height Texture height /// /// \return A new sfTexture object, or NULL if it failed /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfTexture* sfTexture_create(unsigned int width, unsigned int height); //////////////////////////////////////////////////////////// /// \brief Create a new texture from a file /// /// \param filename Path of the image file to load /// \param area Area of the source image to load (NULL to load the entire image) /// /// \return A new sfTexture object, or NULL if it failed /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfTexture* sfTexture_createFromFile(const char* filename, const sfIntRect* area); //////////////////////////////////////////////////////////// /// \brief Create a new texture from a file in memory /// /// \param data Pointer to the file data in memory /// \param sizeInBytes Size of the data to load, in bytes /// \param area Area of the source image to load (NULL to load the entire image) /// /// \return A new sfTexture object, or NULL if it failed /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfTexture* sfTexture_createFromMemory(const void* data, size_t sizeInBytes, const sfIntRect* area); //////////////////////////////////////////////////////////// /// \brief Create a new texture from a custom stream /// /// \param stream Source stream to read from /// \param area Area of the source image to load (NULL to load the entire image) /// /// \return A new sfTexture object, or NULL if it failed /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfTexture* sfTexture_createFromStream(sfInputStream* stream, const sfIntRect* area); //////////////////////////////////////////////////////////// /// \brief Create a new texture from an image /// /// \param image Image to upload to the texture /// \param area Area of the source image to load (NULL to load the entire image) /// /// \return A new sfTexture object, or NULL if it failed /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfTexture* sfTexture_createFromImage(const sfImage* image, const sfIntRect* area); //////////////////////////////////////////////////////////// /// \brief Copy an existing texture /// /// \param texture Texture to copy /// /// \return Copied object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfTexture* sfTexture_copy(const sfTexture* texture); //////////////////////////////////////////////////////////// /// \brief Destroy an existing texture /// /// \param texture Texture to delete /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfTexture_destroy(sfTexture* texture); //////////////////////////////////////////////////////////// /// \brief Return the size of the texture /// /// \param texture Texture to read /// /// \return Size in pixels /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2u sfTexture_getSize(const sfTexture* texture); //////////////////////////////////////////////////////////// /// \brief Copy a texture's pixels to an image /// /// \param texture Texture to copy /// /// \return Image containing the texture's pixels /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfImage* sfTexture_copyToImage(const sfTexture* texture); //////////////////////////////////////////////////////////// /// \brief Update a texture from an array of pixels /// /// \param texture Texture to update /// \param pixels Array of pixels to copy to the texture /// \param width Width of the pixel region contained in \a pixels /// \param height Height of the pixel region contained in \a pixels /// \param x X offset in the texture where to copy the source pixels /// \param y Y offset in the texture where to copy the source pixels /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfTexture_updateFromPixels(sfTexture* texture, const sfUint8* pixels, unsigned int width, unsigned int height, unsigned int x, unsigned int y); //////////////////////////////////////////////////////////// /// \brief Update a texture from an image /// /// \param texture Texture to update /// \param image Image to copy to the texture /// \param x X offset in the texture where to copy the source pixels /// \param y Y offset in the texture where to copy the source pixels /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfTexture_updateFromImage(sfTexture* texture, const sfImage* image, unsigned int x, unsigned int y); //////////////////////////////////////////////////////////// /// \brief Update a texture from the contents of a window /// /// \param texture Texture to update /// \param window Window to copy to the texture /// \param x X offset in the texture where to copy the source pixels /// \param y Y offset in the texture where to copy the source pixels /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfTexture_updateFromWindow(sfTexture* texture, const sfWindow* window, unsigned int x, unsigned int y); //////////////////////////////////////////////////////////// /// \brief Update a texture from the contents of a render-window /// /// \param texture Texture to update /// \param renderWindow Render-window to copy to the texture /// \param x X offset in the texture where to copy the source pixels /// \param y Y offset in the texture where to copy the source pixels /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfTexture_updateFromRenderWindow(sfTexture* texture, const sfRenderWindow* renderWindow, unsigned int x, unsigned int y); //////////////////////////////////////////////////////////// /// \brief Enable or disable the smooth filter on a texture /// /// \param texture The texture object /// \param smooth sfTrue to enable smoothing, sfFalse to disable it /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfTexture_setSmooth(sfTexture* texture, sfBool smooth); //////////////////////////////////////////////////////////// /// \brief Tell whether the smooth filter is enabled or not for a texture /// /// \param texture The texture object /// /// \return sfTrue if smoothing is enabled, sfFalse if it is disabled /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfBool sfTexture_isSmooth(const sfTexture* texture); //////////////////////////////////////////////////////////// /// \brief Enable or disable conversion from sRGB /// /// When providing texture data from an image file or memory, it can /// either be stored in a linear color space or an sRGB color space. /// Most digital images account for gamma correction already, so they /// would need to be "uncorrected" back to linear color space before /// being processed by the hardware. The hardware can automatically /// convert it from the sRGB color space to a linear color space when /// it gets sampled. When the rendered image gets output to the final /// framebuffer, it gets converted back to sRGB. /// /// After enabling or disabling sRGB conversion, make sure to reload /// the texture data in order for the setting to take effect. /// /// This option is only useful in conjunction with an sRGB capable /// framebuffer. This can be requested during window creation. /// /// \param sRgb True to enable sRGB conversion, false to disable it /// /// \see sfTexture_isSrgb /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfTexture_setSrgb(sfTexture* texture, sfBool sRgb); //////////////////////////////////////////////////////////// /// \brief Tell whether the texture source is converted from sRGB or not /// /// \return True if the texture source is converted from sRGB, false if not /// /// \see sfTexture_setSrgb /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfBool sfTexture_isSrgb(const sfTexture* texture); //////////////////////////////////////////////////////////// /// \brief Enable or disable repeating for a texture /// /// Repeating is involved when using texture coordinates /// outside the texture rectangle [0, 0, width, height]. /// In this case, if repeat mode is enabled, the whole texture /// will be repeated as many times as needed to reach the /// coordinate (for example, if the X texture coordinate is /// 3 * width, the texture will be repeated 3 times). /// If repeat mode is disabled, the "extra space" will instead /// be filled with border pixels. /// Warning: on very old graphics cards, white pixels may appear /// when the texture is repeated. With such cards, repeat mode /// can be used reliably only if the texture has power-of-two /// dimensions (such as 256x128). /// Repeating is disabled by default. /// /// \param texture The texture object /// \param repeated True to repeat the texture, false to disable repeating /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfTexture_setRepeated(sfTexture* texture, sfBool repeated); //////////////////////////////////////////////////////////// /// \brief Tell whether a texture is repeated or not /// /// \param texture The texture object /// /// \return sfTrue if repeat mode is enabled, sfFalse if it is disabled /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfBool sfTexture_isRepeated(const sfTexture* texture); //////////////////////////////////////////////////////////// /// \brief Generate a mipmap using the current texture data /// /// Mipmaps are pre-computed chains of optimized textures. Each /// level of texture in a mipmap is generated by halving each of /// the previous level's dimensions. This is done until the final /// level has the size of 1x1. The textures generated in this process may /// make use of more advanced filters which might improve the visual quality /// of textures when they are applied to objects much smaller than they are. /// This is known as minification. Because fewer texels (texture elements) /// have to be sampled from when heavily minified, usage of mipmaps /// can also improve rendering performance in certain scenarios. /// /// Mipmap generation relies on the necessary OpenGL extension being /// available. If it is unavailable or generation fails due to another /// reason, this function will return false. Mipmap data is only valid from /// the time it is generated until the next time the base level image is /// modified, at which point this function will have to be called again to /// regenerate it. /// /// \return sfTrue if mipmap generation was successful, sfFalse if unsuccessful /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfBool sfTexture_generateMipmap(sfTexture* texture); //////////////////////////////////////////////////////////// /// \brief Get the underlying OpenGL handle of the texture. /// /// You shouldn't need to use this function, unless you have /// very specific stuff to implement that SFML doesn't support, /// or implement a temporary workaround until a bug is fixed. /// /// \param texture The texture object /// /// \return OpenGL handle of the texture or 0 if not yet created /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API unsigned int sfTexture_getNativeHandle(const sfTexture* texture); //////////////////////////////////////////////////////////// /// \brief Bind a texture for rendering /// /// This function is not part of the graphics API, it mustn't be /// used when drawing SFML entities. It must be used only if you /// mix sfTexture with OpenGL code. /// /// \code /// sfTexture *t1, *t2; /// ... /// sfTexture_bind(t1); /// // draw OpenGL stuff that use t1... /// sfTexture_bind(t2); /// // draw OpenGL stuff that use t2... /// sfTexture_bind(NULL); /// // draw OpenGL stuff that use no texture... /// \endcode /// /// \param texture Pointer to the texture to bind, can be null to use no texture /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfTexture_bind(const sfTexture* texture); //////////////////////////////////////////////////////////// /// \brief Get the maximum texture size allowed /// /// \return Maximum size allowed for textures, in pixels /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API unsigned int sfTexture_getMaximumSize(); #endif // SFML_TEXTURE_H CSFML-2.4/include/SFML/Graphics/Transform.h000066400000000000000000000200711301071240500202640ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_TRANSFORM_H #define SFML_TRANSFORM_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include //////////////////////////////////////////////////////////// /// \brief Encapsulate a 3x3 transform matrix /// //////////////////////////////////////////////////////////// typedef struct { float matrix[9]; } sfTransform; //////////////////////////////////////////////////////////// /// \brief Identity transform (does nothing) /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API const sfTransform sfTransform_Identity; //////////////////////////////////////////////////////////// /// \brief Create a new transform from a matrix /// /// \param a00 Element (0, 0) of the matrix /// \param a01 Element (0, 1) of the matrix /// \param a02 Element (0, 2) of the matrix /// \param a10 Element (1, 0) of the matrix /// \param a11 Element (1, 1) of the matrix /// \param a12 Element (1, 2) of the matrix /// \param a20 Element (2, 0) of the matrix /// \param a21 Element (2, 1) of the matrix /// \param a22 Element (2, 2) of the matrix /// /// \return A new sfTransform object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfTransform sfTransform_fromMatrix(float a00, float a01, float a02, float a10, float a11, float a12, float a20, float a21, float a22); //////////////////////////////////////////////////////////// /// \brief Return the 4x4 matrix of a transform /// /// This function fills an array of 16 floats with the transform /// converted as a 4x4 matrix, which is directly compatible with /// OpenGL functions. /// /// \code /// sfTransform transform = ...; /// float matrix[16]; /// sfTransform_getMatrix(&transform, matrix) /// glLoadMatrixf(matrix); /// \endcode /// /// \param transform Transform object /// \param matrix Pointer to the 16-element array to fill with the matrix /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfTransform_getMatrix(const sfTransform* transform, float* matrix); //////////////////////////////////////////////////////////// /// \brief Return the inverse of a transform /// /// If the inverse cannot be computed, a new identity transform /// is returned. /// /// \param transform Transform object /// \return The inverse matrix /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfTransform sfTransform_getInverse(const sfTransform* transform); //////////////////////////////////////////////////////////// /// \brief Apply a transform to a 2D point /// /// \param transform Transform object /// \param point Point to transform /// /// \return Transformed point /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfTransform_transformPoint(const sfTransform* transform, sfVector2f point); //////////////////////////////////////////////////////////// /// \brief Apply a transform to a rectangle /// /// Since SFML doesn't provide support for oriented rectangles, /// the result of this function is always an axis-aligned /// rectangle. Which means that if the transform contains a /// rotation, the bounding rectangle of the transformed rectangle /// is returned. /// /// \param transform Transform object /// \param rectangle Rectangle to transform /// /// \return Transformed rectangle /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfFloatRect sfTransform_transformRect(const sfTransform* transform, sfFloatRect rectangle); //////////////////////////////////////////////////////////// /// \brief Combine two transforms /// /// The result is a transform that is equivalent to applying /// \a transform followed by \a other. Mathematically, it is /// equivalent to a matrix multiplication. /// /// \param transform Transform object /// \param other Transform to combine to \a transform /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfTransform_combine(sfTransform* transform, const sfTransform* other); //////////////////////////////////////////////////////////// /// \brief Combine a transform with a translation /// /// \param transform Transform object /// \param x Offset to apply on X axis /// \param y Offset to apply on Y axis /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfTransform_translate(sfTransform* transform, float x, float y); //////////////////////////////////////////////////////////// /// \brief Combine the current transform with a rotation /// /// \param transform Transform object /// \param angle Rotation angle, in degrees /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfTransform_rotate(sfTransform* transform, float angle); //////////////////////////////////////////////////////////// /// \brief Combine the current transform with a rotation /// /// The center of rotation is provided for convenience as a second /// argument, so that you can build rotations around arbitrary points /// more easily (and efficiently) than the usual /// [translate(-center), rotate(angle), translate(center)]. /// /// \param transform Transform object /// \param angle Rotation angle, in degrees /// \param centerX X coordinate of the center of rotation /// \param centerY Y coordinate of the center of rotation /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfTransform_rotateWithCenter(sfTransform* transform, float angle, float centerX, float centerY); //////////////////////////////////////////////////////////// /// \brief Combine the current transform with a scaling /// /// \param transform Transform object /// \param scaleX Scaling factor on the X axis /// \param scaleY Scaling factor on the Y axis /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfTransform_scale(sfTransform* transform, float scaleX, float scaleY); //////////////////////////////////////////////////////////// /// \brief Combine the current transform with a scaling /// /// The center of scaling is provided for convenience as a second /// argument, so that you can build scaling around arbitrary points /// more easily (and efficiently) than the usual /// [translate(-center), scale(factors), translate(center)] /// /// \param transform Transform object /// \param scaleX Scaling factor on X axis /// \param scaleY Scaling factor on Y axis /// \param centerX X coordinate of the center of scaling /// \param centerY Y coordinate of the center of scaling /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfTransform_scaleWithCenter(sfTransform* transform, float scaleX, float scaleY, float centerX, float centerY); #endif // SFML_TRANSFORM_H CSFML-2.4/include/SFML/Graphics/Transformable.h000066400000000000000000000207431301071240500211160ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_TRANSFORMABLE_H #define SFML_TRANSFORMABLE_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include //////////////////////////////////////////////////////////// /// \brief Create a new transformable /// /// \return A new sfTransformable object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfTransformable* sfTransformable_create(void); //////////////////////////////////////////////////////////// /// \brief Copy an existing transformable /// /// \param transformable Transformable to copy /// /// \return Copied object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfTransformable* sfTransformable_copy(const sfTransformable* transformable); //////////////////////////////////////////////////////////// /// \brief Destroy an existing transformable /// /// \param transformable Transformable to delete /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfTransformable_destroy(sfTransformable* transformable); //////////////////////////////////////////////////////////// /// \brief Set the position of a transformable /// /// This function completely overwrites the previous position. /// See sfTransformable_move to apply an offset based on the previous position instead. /// The default position of a transformable Transformable object is (0, 0). /// /// \param transformable Transformable object /// \param position New position /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfTransformable_setPosition(sfTransformable* transformable, sfVector2f position); //////////////////////////////////////////////////////////// /// \brief Set the orientation of a transformable /// /// This function completely overwrites the previous rotation. /// See sfTransformable_rotate to add an angle based on the previous rotation instead. /// The default rotation of a transformable Transformable object is 0. /// /// \param transformable Transformable object /// \param angle New rotation, in degrees /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfTransformable_setRotation(sfTransformable* transformable, float angle); //////////////////////////////////////////////////////////// /// \brief Set the scale factors of a transformable /// /// This function completely overwrites the previous scale. /// See sfTransformable_scale to add a factor based on the previous scale instead. /// The default scale of a transformable Transformable object is (1, 1). /// /// \param transformable Transformable object /// \param scale New scale factors /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfTransformable_setScale(sfTransformable* transformable, sfVector2f scale); //////////////////////////////////////////////////////////// /// \brief Set the local origin of a transformable /// /// The origin of an object defines the center point for /// all transformations (position, scale, rotation). /// The coordinates of this point must be relative to the /// top-left corner of the object, and ignore all /// transformations (position, scale, rotation). /// The default origin of a transformable Transformable object is (0, 0). /// /// \param transformable Transformable object /// \param origin New origin /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfTransformable_setOrigin(sfTransformable* transformable, sfVector2f origin); //////////////////////////////////////////////////////////// /// \brief Get the position of a transformable /// /// \param transformable Transformable object /// /// \return Current position /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfTransformable_getPosition(const sfTransformable* transformable); //////////////////////////////////////////////////////////// /// \brief Get the orientation of a transformable /// /// The rotation is always in the range [0, 360]. /// /// \param transformable Transformable object /// /// \return Current rotation, in degrees /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API float sfTransformable_getRotation(const sfTransformable* transformable); //////////////////////////////////////////////////////////// /// \brief Get the current scale of a transformable /// /// \param transformable Transformable object /// /// \return Current scale factors /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfTransformable_getScale(const sfTransformable* transformable); //////////////////////////////////////////////////////////// /// \brief Get the local origin of a transformable /// /// \param transformable Transformable object /// /// \return Current origin /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfTransformable_getOrigin(const sfTransformable* transformable); //////////////////////////////////////////////////////////// /// \brief Move a transformable by a given offset /// /// This function adds to the current position of the object, /// unlike sfTransformable_setPosition which overwrites it. /// /// \param transformable Transformable object /// \param offset Offset /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfTransformable_move(sfTransformable* transformable, sfVector2f offset); //////////////////////////////////////////////////////////// /// \brief Rotate a transformable /// /// This function adds to the current rotation of the object, /// unlike sfTransformable_setRotation which overwrites it. /// /// \param transformable Transformable object /// \param angle Angle of rotation, in degrees /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfTransformable_rotate(sfTransformable* transformable, float angle); //////////////////////////////////////////////////////////// /// \brief Scale a transformable /// /// This function multiplies the current scale of the object, /// unlike sfTransformable_setScale which overwrites it. /// /// \param transformable Transformable object /// \param factors Scale factors /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfTransformable_scale(sfTransformable* transformable, sfVector2f factors); //////////////////////////////////////////////////////////// /// \brief Get the combined transform of a transformable /// /// \param transformable Transformable object /// /// \return Transform combining the position/rotation/scale/origin of the object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfTransform sfTransformable_getTransform(const sfTransformable* transformable); //////////////////////////////////////////////////////////// /// \brief Get the inverse of the combined transform of a transformable /// /// \param transformable Transformable object /// /// \return Inverse of the combined transformations applied to the object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfTransform sfTransformable_getInverseTransform(const sfTransformable* transformable); #endif // SFML_TRANSFORMABLE_H CSFML-2.4/include/SFML/Graphics/Types.h000066400000000000000000000033701301071240500174200ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_GRAPHICS_TYPES_H #define SFML_GRAPHICS_TYPES_H typedef struct sfCircleShape sfCircleShape; typedef struct sfConvexShape sfConvexShape; typedef struct sfFont sfFont; typedef struct sfImage sfImage; typedef struct sfShader sfShader; typedef struct sfRectangleShape sfRectangleShape; typedef struct sfRenderTexture sfRenderTexture; typedef struct sfRenderWindow sfRenderWindow; typedef struct sfShape sfShape; typedef struct sfSprite sfSprite; typedef struct sfText sfText; typedef struct sfTexture sfTexture; typedef struct sfTransformable sfTransformable; typedef struct sfVertexArray sfVertexArray; typedef struct sfView sfView; #endif // SFML_GRAPHICS_TYPES_H CSFML-2.4/include/SFML/Graphics/Vertex.h000066400000000000000000000034211301071240500175660ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_VERTEX_H #define SFML_VERTEX_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// /// Define a point with color and texture coordinates //////////////////////////////////////////////////////////// typedef struct { sfVector2f position; ///< Position of the vertex sfColor color; ///< Color of the vertex sfVector2f texCoords; ///< Coordinates of the texture's pixel to map to the vertex } sfVertex; #endif // SFML_VERTEX_H CSFML-2.4/include/SFML/Graphics/VertexArray.h000066400000000000000000000141201301071240500205630ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_VERTEXARRAY_H #define SFML_VERTEXARRAY_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include //////////////////////////////////////////////////////////// /// \brief Create a new vertex array /// /// \return A new sfVertexArray object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVertexArray* sfVertexArray_create(void); //////////////////////////////////////////////////////////// /// \brief Copy an existing vertex array /// /// \param vertexArray Vertex array to copy /// /// \return Copied object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVertexArray* sfVertexArray_copy(const sfVertexArray* vertexArray); //////////////////////////////////////////////////////////// /// \brief Destroy an existing vertex array /// /// \param vertexArray Vertex array to delete /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfVertexArray_destroy(sfVertexArray* vertexArray); //////////////////////////////////////////////////////////// /// \brief Return the vertex count of a vertex array /// /// \param vertexArray Vertex array object /// /// \return Number of vertices in the array /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API size_t sfVertexArray_getVertexCount(const sfVertexArray* vertexArray); //////////////////////////////////////////////////////////// /// \brief Get access to a vertex by its index /// /// This function doesn't check \a index, it must be in range /// [0, vertex count - 1]. The behaviour is undefined /// otherwise. /// /// \param vertexArray Vertex array object /// \param index Index of the vertex to get /// /// \return Pointer to the index-th vertex /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVertex* sfVertexArray_getVertex(sfVertexArray* vertexArray, size_t index); //////////////////////////////////////////////////////////// /// \brief Clear a vertex array /// /// This function removes all the vertices from the array. /// It doesn't deallocate the corresponding memory, so that /// adding new vertices after clearing doesn't involve /// reallocating all the memory. /// /// \param vertexArray Vertex array object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfVertexArray_clear(sfVertexArray* vertexArray); //////////////////////////////////////////////////////////// /// \brief Resize the vertex array /// /// If \a vertexCount is greater than the current size, the previous /// vertices are kept and new (default-constructed) vertices are /// added. /// If \a vertexCount is less than the current size, existing vertices /// are removed from the array. /// /// \param vertexArray Vertex array objet /// \param vertexCount New size of the array (number of vertices) /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfVertexArray_resize(sfVertexArray* vertexArray, size_t vertexCount); //////////////////////////////////////////////////////////// /// \brief Add a vertex to a vertex array array /// /// \param vertexArray Vertex array objet /// \param vertex Vertex to add /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfVertexArray_append(sfVertexArray* vertexArray, sfVertex vertex); //////////////////////////////////////////////////////////// /// \brief Set the type of primitives of a vertex array /// /// This function defines how the vertices must be interpreted /// when it's time to draw them: /// \li As points /// \li As lines /// \li As triangles /// \li As quads /// The default primitive type is sfPoints. /// /// \param vertexArray Vertex array objet /// \param type Type of primitive /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfVertexArray_setPrimitiveType(sfVertexArray* vertexArray, sfPrimitiveType type); //////////////////////////////////////////////////////////// /// \brief Get the type of primitives drawn by a vertex array /// /// \param vertexArray Vertex array objet /// /// \return Primitive type /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfPrimitiveType sfVertexArray_getPrimitiveType(sfVertexArray* vertexArray); //////////////////////////////////////////////////////////// /// \brief Compute the bounding rectangle of a vertex array /// /// This function returns the axis-aligned rectangle that /// contains all the vertices of the array. /// /// \param vertexArray Vertex array objet /// /// \return Bounding rectangle of the vertex array /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfFloatRect sfVertexArray_getBounds(sfVertexArray* vertexArray); #endif // SFML_VERTEXARRAY_H CSFML-2.4/include/SFML/Graphics/View.h000066400000000000000000000161341301071240500172300ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_VIEW_H #define SFML_VIEW_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include //////////////////////////////////////////////////////////// /// \brief Create a default view /// /// This function creates a default view of (0, 0, 1000, 1000) /// /// \return A new sfView object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfView* sfView_create(void); //////////////////////////////////////////////////////////// /// \brief Construct a view from a rectangle /// /// \param rectangle Rectangle defining the zone to display /// /// \return A new sfView object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfView* sfView_createFromRect(sfFloatRect rectangle); //////////////////////////////////////////////////////////// /// \brief Copy an existing view /// /// \param view View to copy /// /// \return Copied object /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfView* sfView_copy(const sfView* view); //////////////////////////////////////////////////////////// /// \brief Destroy an existing view /// /// \param view View to destroy /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfView_destroy(sfView* view); //////////////////////////////////////////////////////////// /// \brief Set the center of a view /// /// \param view View object /// \param center New center /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfView_setCenter(sfView* view, sfVector2f center); //////////////////////////////////////////////////////////// /// \brief Set the size of a view /// /// \param view View object /// \param size New size of the view /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfView_setSize(sfView* view, sfVector2f size); //////////////////////////////////////////////////////////// /// \brief Set the orientation of a view /// /// The default rotation of a view is 0 degree. /// /// \param view View object /// \param angle New angle, in degrees /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfView_setRotation(sfView* view, float angle); //////////////////////////////////////////////////////////// /// \brief Set the target viewport of a view /// /// The viewport is the rectangle into which the contents of the /// view are displayed, expressed as a factor (between 0 and 1) /// of the size of the render target to which the view is applied. /// For example, a view which takes the left side of the target would /// be defined by a rect of (0, 0, 0.5, 1). /// By default, a view has a viewport which covers the entire target. /// /// \param view View object /// \param viewport New viewport rectangle /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfView_setViewport(sfView* view, sfFloatRect viewport); //////////////////////////////////////////////////////////// /// \brief Reset a view to the given rectangle /// /// Note that this function resets the rotation angle to 0. /// /// \param view View object /// \param rectangle Rectangle defining the zone to display /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfView_reset(sfView* view, sfFloatRect rectangle); //////////////////////////////////////////////////////////// /// \brief Get the center of a view /// /// \param view View object /// /// \return Center of the view /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfView_getCenter(const sfView* view); //////////////////////////////////////////////////////////// /// \brief Get the size of a view /// /// \param view View object /// /// \return Size of the view /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfVector2f sfView_getSize(const sfView* view); //////////////////////////////////////////////////////////// /// \brief Get the current orientation of a view /// /// \param view View object /// /// \return Rotation angle of the view, in degrees /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API float sfView_getRotation(const sfView* view); //////////////////////////////////////////////////////////// /// \brief Get the target viewport rectangle of a view /// /// \param view View object /// /// \return Viewport rectangle, expressed as a factor of the target size /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API sfFloatRect sfView_getViewport(const sfView* view); //////////////////////////////////////////////////////////// /// \brief Move a view relatively to its current position /// /// \param view View object /// \param offset Offset /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfView_move(sfView* view, sfVector2f offset); //////////////////////////////////////////////////////////// /// \brief Rotate a view relatively to its current orientation /// /// \param view View object /// \param angle Angle to rotate, in degrees /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfView_rotate(sfView* view, float angle); //////////////////////////////////////////////////////////// /// \brief Resize a view rectangle relatively to its current size /// /// Resizing the view simulates a zoom, as the zone displayed on /// screen grows or shrinks. /// \a factor is a multiplier: /// \li 1 keeps the size unchanged /// \li > 1 makes the view bigger (objects appear smaller) /// \li < 1 makes the view smaller (objects appear bigger) /// /// \param view View object /// \param factor Zoom factor to apply /// //////////////////////////////////////////////////////////// CSFML_GRAPHICS_API void sfView_zoom(sfView* view, float factor); #endif // SFML_VIEW_H CSFML-2.4/include/SFML/Network.h000066400000000000000000000031731301071240500162060ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_NETWORK_H #define SFML_NETWORK_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include #include #include #include #include #endif // SFML_NETWORK_H CSFML-2.4/include/SFML/Network/000077500000000000000000000000001301071240500160315ustar00rootroot00000000000000CSFML-2.4/include/SFML/Network/Export.h000066400000000000000000000032071301071240500174650ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_NETWORK_EXPORT_H #define SFML_NETWORK_EXPORT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// // Define portable import / export macros //////////////////////////////////////////////////////////// #if defined(CSFML_NETWORK_EXPORTS) #define CSFML_NETWORK_API CSFML_API_EXPORT #else #define CSFML_NETWORK_API CSFML_API_IMPORT #endif #endif // SFML_NETWORK_EXPORT_H CSFML-2.4/include/SFML/Network/Ftp.h000066400000000000000000000521621301071240500167410ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_FTP_H #define SFML_FTP_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include //////////////////////////////////////////////////////////// /// \brief Enumeration of transfer modes /// //////////////////////////////////////////////////////////// typedef enum { sfFtpBinary, ///< Binary mode (file is transfered as a sequence of bytes) sfFtpAscii, ///< Text mode using ASCII encoding sfFtpEbcdic ///< Text mode using EBCDIC encoding } sfFtpTransferMode; //////////////////////////////////////////////////////////// /// \brief Status codes possibly returned by a FTP response /// //////////////////////////////////////////////////////////// typedef enum { // 1xx: the requested action is being initiated, // expect another reply before proceeding with a new command sfFtpRestartMarkerReply = 110, ///< Restart marker reply sfFtpServiceReadySoon = 120, ///< Service ready in N minutes sfFtpDataConnectionAlreadyOpened = 125, ///< Data connection already opened, transfer starting sfFtpOpeningDataConnection = 150, ///< File status ok, about to open data connection // 2xx: the requested action has been successfully completed sfFtpOk = 200, ///< Command ok sfFtpPointlessCommand = 202, ///< Command not implemented sfFtpSystemStatus = 211, ///< System status, or system help reply sfFtpDirectoryStatus = 212, ///< Directory status sfFtpFileStatus = 213, ///< File status sfFtpHelpMessage = 214, ///< Help message sfFtpSystemType = 215, ///< NAME system type, where NAME is an official system name from the list in the Assigned Numbers document sfFtpServiceReady = 220, ///< Service ready for new user sfFtpClosingConnection = 221, ///< Service closing control connection sfFtpDataConnectionOpened = 225, ///< Data connection open, no transfer in progress sfFtpClosingDataConnection = 226, ///< Closing data connection, requested file action successful sfFtpEnteringPassiveMode = 227, ///< Entering passive mode sfFtpLoggedIn = 230, ///< User logged in, proceed. Logged out if appropriate sfFtpFileActionOk = 250, ///< Requested file action ok sfFtpDirectoryOk = 257, ///< PATHNAME created // 3xx: the command has been accepted, but the requested action // is dormant, pending receipt of further information sfFtpNeedPassword = 331, ///< User name ok, need password sfFtpNeedAccountToLogIn = 332, ///< Need account for login sfFtpNeedInformation = 350, ///< Requested file action pending further information // 4xx: the command was not accepted and the requested action did not take place, // but the error condition is temporary and the action may be requested again sfFtpServiceUnavailable = 421, ///< Service not available, closing control connection sfFtpDataConnectionUnavailable = 425, ///< Can't open data connection sfFtpTransferAborted = 426, ///< Connection closed, transfer aborted sfFtpFileActionAborted = 450, ///< Requested file action not taken sfFtpLocalError = 451, ///< Requested action aborted, local error in processing sfFtpInsufficientStorageSpace = 452, ///< Requested action not taken; insufficient storage space in system, file unavailable // 5xx: the command was not accepted and // the requested action did not take place sfFtpCommandUnknown = 500, ///< Syntax error, command unrecognized sfFtpParametersUnknown = 501, ///< Syntax error in parameters or arguments sfFtpCommandNotImplemented = 502, ///< Command not implemented sfFtpBadCommandSequence = 503, ///< Bad sequence of commands sfFtpParameterNotImplemented = 504, ///< Command not implemented for that parameter sfFtpNotLoggedIn = 530, ///< Not logged in sfFtpNeedAccountToStore = 532, ///< Need account for storing files sfFtpFileUnavailable = 550, ///< Requested action not taken, file unavailable sfFtpPageTypeUnknown = 551, ///< Requested action aborted, page type unknown sfFtpNotEnoughMemory = 552, ///< Requested file action aborted, exceeded storage allocation sfFtpFilenameNotAllowed = 553, ///< Requested action not taken, file name not allowed // 10xx: SFML custom codes sfFtpInvalidResponse = 1000, ///< Response is not a valid FTP one sfFtpConnectionFailed = 1001, ///< Connection with server failed sfFtpConnectionClosed = 1002, ///< Connection with server closed sfFtpInvalidFile = 1003 ///< Invalid file to upload / download } sfFtpStatus; //////////////////////////////////////////////////////////// /// \brief Destroy a FTP listing response /// /// \param ftpListingResponse Ftp listing response to destroy /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfFtpListingResponse_destroy(sfFtpListingResponse* ftpListingResponse); //////////////////////////////////////////////////////////// /// \brief Check if a FTP listing response status code means a success /// /// This function is defined for convenience, it is /// equivalent to testing if the status code is < 400. /// /// \param ftpListingResponse Ftp listing response /// /// \return sfTrue if the status is a success, sfFalse if it is a failure /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfBool sfFtpListingResponse_isOk(const sfFtpListingResponse* ftpListingResponse); //////////////////////////////////////////////////////////// /// \brief Get the status code of a FTP listing response /// /// \param ftpListingResponse Ftp listing response /// /// \return Status code /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfFtpStatus sfFtpListingResponse_getStatus(const sfFtpListingResponse* ftpListingResponse); //////////////////////////////////////////////////////////// /// \brief Get the full message contained in a FTP listing response /// /// \param ftpListingResponse Ftp listing response /// /// \return The response message /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API const char* sfFtpListingResponse_getMessage(const sfFtpListingResponse* ftpListingResponse); //////////////////////////////////////////////////////////// /// \brief Return the number of directory/file names contained in a FTP listing response /// /// \param ftpListingResponse Ftp listing response /// /// \return Total number of names available /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API size_t sfFtpListingResponse_getCount(const sfFtpListingResponse* ftpListingResponse); //////////////////////////////////////////////////////////// /// \brief Return a directory/file name contained in a FTP listing response /// /// \param ftpListingResponse Ftp listing response /// \param index Index of the name to get (in range [0 .. getCount]) /// /// \return The requested name /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API const char* sfFtpListingResponse_getName(const sfFtpListingResponse* ftpListingResponse, size_t index); //////////////////////////////////////////////////////////// /// \brief Destroy a FTP directory response /// /// \param ftpDirectoryResponse Ftp directory response to destroy /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfFtpDirectoryResponse_destroy(sfFtpDirectoryResponse* ftpDirectoryResponse); //////////////////////////////////////////////////////////// /// \brief Check if a FTP directory response status code means a success /// /// This function is defined for convenience, it is /// equivalent to testing if the status code is < 400. /// /// \param ftpDirectoryResponse Ftp directory response /// /// \return sfTrue if the status is a success, sfFalse if it is a failure /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfBool sfFtpDirectoryResponse_isOk(const sfFtpDirectoryResponse* ftpDirectoryResponse); //////////////////////////////////////////////////////////// /// \brief Get the status code of a FTP directory response /// /// \param ftpDirectoryResponse Ftp directory response /// /// \return Status code /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfFtpStatus sfFtpDirectoryResponse_getStatus(const sfFtpDirectoryResponse* ftpDirectoryResponse); //////////////////////////////////////////////////////////// /// \brief Get the full message contained in a FTP directory response /// /// \param ftpDirectoryResponse Ftp directory response /// /// \return The response message /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API const char* sfFtpDirectoryResponse_getMessage(const sfFtpDirectoryResponse* ftpDirectoryResponse); //////////////////////////////////////////////////////////// /// \brief Get the directory returned in a FTP directory response /// /// \param ftpDirectoryResponse Ftp directory response /// /// \return Directory name /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API const char* sfFtpDirectoryResponse_getDirectory(const sfFtpDirectoryResponse* ftpDirectoryResponse); //////////////////////////////////////////////////////////// /// \brief Destroy a FTP response /// /// \param ftpResponse Ftp response to destroy /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfFtpResponse_destroy(sfFtpResponse* ftpResponse); //////////////////////////////////////////////////////////// /// \brief Check if a FTP response status code means a success /// /// This function is defined for convenience, it is /// equivalent to testing if the status code is < 400. /// /// \param ftpResponse Ftp response object /// /// \return sfTrue if the status is a success, sfFalse if it is a failure /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfBool sfFtpResponse_isOk(const sfFtpResponse* ftpResponse); //////////////////////////////////////////////////////////// /// \brief Get the status code of a FTP response /// /// \param ftpResponse Ftp response object /// /// \return Status code /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfFtpStatus sfFtpResponse_getStatus(const sfFtpResponse* ftpResponse); //////////////////////////////////////////////////////////// /// \brief Get the full message contained in a FTP response /// /// \param ftpResponse Ftp response object /// /// \return The response message /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API const char* sfFtpResponse_getMessage(const sfFtpResponse* ftpResponse); //////////////////////////////////////////////////////////// /// \brief Create a new Ftp object /// /// \return A new sfFtp object /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfFtp* sfFtp_create(void); //////////////////////////////////////////////////////////// /// \brief Destroy a Ftp object /// /// \param ftp Ftp object to destroy /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfFtp_destroy(sfFtp* ftp); //////////////////////////////////////////////////////////// /// \brief Connect to the specified FTP server /// /// The port should be 21, which is the standard /// port used by the FTP protocol. You shouldn't use a different /// value, unless you really know what you do. /// This function tries to connect to the server so it may take /// a while to complete, especially if the server is not /// reachable. To avoid blocking your application for too long, /// you can use a timeout. Using 0 means that the /// system timeout will be used (which is usually pretty long). /// /// \param ftp Ftp object /// \param server Name or address of the FTP server to connect to /// \param port Port used for the connection /// \param timeout Maximum time to wait /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfFtpResponse* sfFtp_connect(sfFtp* ftp, sfIpAddress server, unsigned short port, sfTime timeout); //////////////////////////////////////////////////////////// /// \brief Log in using an anonymous account /// /// Logging in is mandatory after connecting to the server. /// Users that are not logged in cannot perform any operation. /// /// \param ftp Ftp object /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfFtpResponse* sfFtp_loginAnonymous(sfFtp* ftp); //////////////////////////////////////////////////////////// /// \brief Log in using a username and a password /// /// Logging in is mandatory after connecting to the server. /// Users that are not logged in cannot perform any operation. /// /// \param ftp Ftp object /// \param name User name /// \param password Password /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfFtpResponse* sfFtp_login(sfFtp* ftp, const char* name, const char* password); //////////////////////////////////////////////////////////// /// \brief Close the connection with the server /// /// \param ftp Ftp object /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfFtpResponse* sfFtp_disconnect(sfFtp* ftp); //////////////////////////////////////////////////////////// /// \brief Send a null command to keep the connection alive /// /// This command is useful because the server may close the /// connection automatically if no command is sent. /// /// \param ftp Ftp object /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfFtpResponse* sfFtp_keepAlive(sfFtp* ftp); //////////////////////////////////////////////////////////// /// \brief Get the current working directory /// /// The working directory is the root path for subsequent /// operations involving directories and/or filenames. /// /// \param ftp Ftp object /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfFtpDirectoryResponse* sfFtp_getWorkingDirectory(sfFtp* ftp); //////////////////////////////////////////////////////////// /// \brief Get the contents of the given directory /// /// This function retrieves the sub-directories and files /// contained in the given directory. It is not recursive. /// The \a directory parameter is relative to the current /// working directory. /// /// \param ftp Ftp object /// \param directory Directory to list /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfFtpListingResponse* sfFtp_getDirectoryListing(sfFtp* ftp, const char* directory); //////////////////////////////////////////////////////////// /// \brief Change the current working directory /// /// The new directory must be relative to the current one. /// /// \param ftp Ftp object /// \param directory New working directory /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfFtpResponse* sfFtp_changeDirectory(sfFtp* ftp, const char* directory); //////////////////////////////////////////////////////////// /// \brief Go to the parent directory of the current one /// /// \param ftp Ftp object /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfFtpResponse* sfFtp_parentDirectory(sfFtp* ftp); //////////////////////////////////////////////////////////// /// \brief Create a new directory /// /// The new directory is created as a child of the current /// working directory. /// /// \param ftp Ftp object /// \param name Name of the directory to create /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfFtpResponse* sfFtp_createDirectory(sfFtp* ftp, const char* name); //////////////////////////////////////////////////////////// /// \brief Remove an existing directory /// /// The directory to remove must be relative to the /// current working directory. /// Use this function with caution, the directory will /// be removed permanently! /// /// \param ftp Ftp object /// \param name Name of the directory to remove /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfFtpResponse* sfFtp_deleteDirectory(sfFtp* ftp, const char* name); //////////////////////////////////////////////////////////// /// \brief Rename an existing file /// /// The filenames must be relative to the current working /// directory. /// /// \param ftp Ftp object /// \param file File to rename /// \param newName New name of the file /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfFtpResponse* sfFtp_renameFile(sfFtp* ftp, const char* file, const char* newName); //////////////////////////////////////////////////////////// /// \brief Remove an existing file /// /// The file name must be relative to the current working /// directory. /// Use this function with caution, the file will be /// removed permanently! /// /// \param ftp Ftp object /// \param name File to remove /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfFtpResponse* sfFtp_deleteFile(sfFtp* ftp, const char* name); //////////////////////////////////////////////////////////// /// \brief Download a file from a FTP server /// /// The filename of the distant file is relative to the /// current working directory of the server, and the local /// destination path is relative to the current directory /// of your application. /// /// \param ftp Ftp object /// \param remoteFile Filename of the distant file to download /// \param localPath Where to put to file on the local computer /// \param mode Transfer mode /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfFtpResponse* sfFtp_download(sfFtp* ftp, const char* remoteFile, const char* localPath, sfFtpTransferMode mode); //////////////////////////////////////////////////////////// /// \brief Upload a file to a FTP server /// /// The name of the local file is relative to the current /// working directory of your application, and the /// remote path is relative to the current directory of the /// FTP server. /// /// \param ftp Ftp object /// \param localFile Path of the local file to upload /// \param remotePath Where to put to file on the server /// \param mode Transfer mode /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfFtpResponse* sfFtp_upload(sfFtp* ftp, const char* localFile, const char* remotePath, sfFtpTransferMode mode); //////////////////////////////////////////////////////////// /// \brief Send a command to the FTP server /// /// While the most often used commands are provided as /// specific functions, this function can be used to send /// any FTP command to the server. If the command requires /// one or more parameters, they can be specified in /// \a parameter. Otherwise you should pass NULL. /// If the server returns information, you can extract it /// from the response using sfResponse_getMessage(). /// /// \param ftp Ftp object /// \param command Command to send /// \param parameter Command parameter /// /// \return Server response to the request /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfFtpResponse* sfFtp_sendCommand(sfFtp* ftp, const char* command, const char* parameter); #endif // SFML_FTP_H CSFML-2.4/include/SFML/Network/Http.h000066400000000000000000000310061301071240500171210ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_HTTP_H #define SFML_HTTP_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// /// \brief Enumerate the available HTTP methods for a request /// //////////////////////////////////////////////////////////// typedef enum { sfHttpGet, ///< Request in get mode, standard method to retrieve a page sfHttpPost, ///< Request in post mode, usually to send data to a page sfHttpHead, ///< Request a page's header only sfHttpPut, ///< Request in put mode, useful for a REST API sfHttpDelete ///< Request in delete mode, useful for a REST API } sfHttpMethod; //////////////////////////////////////////////////////////// /// \brief Enumerate all the valid status codes for a response /// //////////////////////////////////////////////////////////// typedef enum { // 2xx: success sfHttpOk = 200, ///< Most common code returned when operation was successful sfHttpCreated = 201, ///< The resource has successfully been created sfHttpAccepted = 202, ///< The request has been accepted, but will be processed later by the server sfHttpNoContent = 204, ///< Sent when the server didn't send any data in return sfHttpResetContent = 205, ///< The server informs the client that it should clear the view (form) that caused the request to be sent sfHttpPartialContent = 206, ///< The server has sent a part of the resource, as a response to a partial GET request // 3xx: redirection sfHttpMultipleChoices = 300, ///< The requested page can be accessed from several locations sfHttpMovedPermanently = 301, ///< The requested page has permanently moved to a new location sfHttpMovedTemporarily = 302, ///< The requested page has temporarily moved to a new location sfHttpNotModified = 304, ///< For conditional requests, means the requested page hasn't changed and doesn't need to be refreshed // 4xx: client error sfHttpBadRequest = 400, ///< The server couldn't understand the request (syntax error) sfHttpUnauthorized = 401, ///< The requested page needs an authentication to be accessed sfHttpForbidden = 403, ///< The requested page cannot be accessed at all, even with authentication sfHttpNotFound = 404, ///< The requested page doesn't exist sfHttpRangeNotSatisfiable = 407, ///< The server can't satisfy the partial GET request (with a "Range" header field) // 5xx: server error sfHttpInternalServerError = 500, ///< The server encountered an unexpected error sfHttpNotImplemented = 501, ///< The server doesn't implement a requested feature sfHttpBadGateway = 502, ///< The gateway server has received an error from the source server sfHttpServiceNotAvailable = 503, ///< The server is temporarily unavailable (overloaded, in maintenance, ...) sfHttpGatewayTimeout = 504, ///< The gateway server couldn't receive a response from the source server sfHttpVersionNotSupported = 505, ///< The server doesn't support the requested HTTP version // 10xx: SFML custom codes sfHttpInvalidResponse = 1000, ///< Response is not a valid HTTP one sfHttpConnectionFailed = 1001 ///< Connection with server failed } sfHttpStatus; //////////////////////////////////////////////////////////// /// \brief Create a new HTTP request /// /// \return A new sfHttpRequest object /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfHttpRequest* sfHttpRequest_create(void); //////////////////////////////////////////////////////////// /// \brief Destroy a HTTP request /// /// \param httpRequest HTTP request to destroy /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfHttpRequest_destroy(sfHttpRequest* httpRequest); //////////////////////////////////////////////////////////// /// \brief Set the value of a header field of a HTTP request /// /// The field is created if it doesn't exist. The name of /// the field is case insensitive. /// By default, a request doesn't contain any field (but the /// mandatory fields are added later by the HTTP client when /// sending the request). /// /// \param httpRequest HTTP request /// \param field Name of the field to set /// \param value Value of the field /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfHttpRequest_setField(sfHttpRequest* httpRequest, const char* field, const char* value); //////////////////////////////////////////////////////////// /// \brief Set a HTTP request method /// /// See the sfHttpMethod enumeration for a complete list of all /// the availale methods. /// The method is sfHttpGet by default. /// /// \param httpRequest HTTP request /// \param method Method to use for the request /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfHttpRequest_setMethod(sfHttpRequest* httpRequest, sfHttpMethod method); //////////////////////////////////////////////////////////// /// \brief Set a HTTP request URI /// /// The URI is the resource (usually a web page or a file) /// that you want to get or post. /// The URI is "/" (the root page) by default. /// /// \param httpRequest HTTP request /// \param uri URI to request, relative to the host /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfHttpRequest_setUri(sfHttpRequest* httpRequest, const char* uri); //////////////////////////////////////////////////////////// /// \brief Set the HTTP version of a HTTP request /// /// The HTTP version is 1.0 by default. /// /// \param httpRequest HTTP request /// \param major Major HTTP version number /// \param minor Minor HTTP version number /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfHttpRequest_setHttpVersion(sfHttpRequest* httpRequest, unsigned int major, unsigned int minor); //////////////////////////////////////////////////////////// /// \brief Set the body of a HTTP request /// /// The body of a request is optional and only makes sense /// for POST requests. It is ignored for all other methods. /// The body is empty by default. /// /// \param httpRequest HTTP request /// \param body Content of the body /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfHttpRequest_setBody(sfHttpRequest* httpRequest, const char* body); //////////////////////////////////////////////////////////// /// \brief Destroy a HTTP response /// /// \param httpResponse HTTP response to destroy /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfHttpResponse_destroy(sfHttpResponse* httpResponse); //////////////////////////////////////////////////////////// /// \brief Get the value of a field of a HTTP response /// /// If the field \a field is not found in the response header, /// the empty string is returned. This function uses /// case-insensitive comparisons. /// /// \param httpResponse HTTP response /// \param field Name of the field to get /// /// \return Value of the field, or empty string if not found /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API const char* sfHttpResponse_getField(const sfHttpResponse* httpResponse, const char* field); //////////////////////////////////////////////////////////// /// \brief Get the status code of a HTTP reponse /// /// The status code should be the first thing to be checked /// after receiving a response, it defines whether it is a /// success, a failure or anything else (see the sfHttpStatus /// enumeration). /// /// \param httpResponse HTTP response /// /// \return Status code of the response /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfHttpStatus sfHttpResponse_getStatus(const sfHttpResponse* httpResponse); //////////////////////////////////////////////////////////// /// \brief Get the major HTTP version number of a HTTP response /// /// \param httpResponse HTTP response /// /// \return Major HTTP version number /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API unsigned int sfHttpResponse_getMajorVersion(const sfHttpResponse* httpResponse); //////////////////////////////////////////////////////////// /// \brief Get the minor HTTP version number of a HTTP response /// /// \param httpResponse HTTP response /// /// \return Minor HTTP version number /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API unsigned int sfHttpResponse_getMinorVersion(const sfHttpResponse* httpResponse); //////////////////////////////////////////////////////////// /// \brief Get the body of a HTTP response /// /// The body of a response may contain: /// \li the requested page (for GET requests) /// \li a response from the server (for POST requests) /// \li nothing (for HEAD requests) /// \li an error message (in case of an error) /// /// \param httpResponse HTTP response /// /// \return The response body /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API const char* sfHttpResponse_getBody(const sfHttpResponse* httpResponse); //////////////////////////////////////////////////////////// /// \brief Create a new Http object /// /// \return A new sfHttp object /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfHttp* sfHttp_create(void); //////////////////////////////////////////////////////////// /// \brief Destroy a Http object /// /// \param http Http object to destroy /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfHttp_destroy(sfHttp* http); //////////////////////////////////////////////////////////// /// \brief Set the target host of a HTTP object /// /// This function just stores the host address and port, it /// doesn't actually connect to it until you send a request. /// If the port is 0, it means that the HTTP client will use /// the right port according to the protocol used /// (80 for HTTP, 443 for HTTPS). You should /// leave it like this unless you really need a port other /// than the standard one, or use an unknown protocol. /// /// \param http Http object /// \param host Web server to connect to /// \param port Port to use for connection /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfHttp_setHost(sfHttp* http, const char* host, unsigned short port); //////////////////////////////////////////////////////////// /// \brief Send a HTTP request and return the server's response. /// /// You must have a valid host before sending a request (see sfHttp_setHost). /// Any missing mandatory header field in the request will be added /// with an appropriate value. /// Warning: this function waits for the server's response and may /// not return instantly; use a thread if you don't want to block your /// application, or use a timeout to limit the time to wait. A value /// of 0 means that the client will use the system defaut timeout /// (which is usually pretty long). /// /// \param http Http object /// \param request Request to send /// \param timeout Maximum time to wait /// /// \return Server's response /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfHttpResponse* sfHttp_sendRequest(sfHttp* http, const sfHttpRequest* request, sfTime timeout); #endif // SFML_HTTP_H CSFML-2.4/include/SFML/Network/IpAddress.h000066400000000000000000000156131301071240500200660ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_IPADDRESS_H #define SFML_IPADDRESS_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include //////////////////////////////////////////////////////////// /// \brief Encapsulate an IPv4 network address /// //////////////////////////////////////////////////////////// typedef struct { char address[16]; } sfIpAddress; //////////////////////////////////////////////////////////// /// \brief Empty object that represents invalid addresses /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API const sfIpAddress sfIpAddress_None; //////////////////////////////////////////////////////////// /// \brief Value representing any address (0.0.0.0) /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API const sfIpAddress sfIpAddress_Any; //////////////////////////////////////////////////////////// /// \brief Local host IP address (127.0.0.1, or "localhost") /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API const sfIpAddress sfIpAddress_LocalHost; //////////////////////////////////////////////////////////// /// \brief UDP broadcast address (255.255.255.255) /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API const sfIpAddress sfIpAddress_Broadcast; //////////////////////////////////////////////////////////// /// \brief Create an address from a string /// /// Here \a address can be either a decimal address /// (ex: "192.168.1.56") or a network name (ex: "localhost"). /// /// \param address IP address or network name /// /// \return Resulting address /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfIpAddress sfIpAddress_fromString(const char* address); //////////////////////////////////////////////////////////// /// \brief Create an address from 4 bytes /// /// Calling sfIpAddress_fromBytes(a, b, c, d) is equivalent /// to calling sfIpAddress_fromString("a.b.c.d"), but safer /// as it doesn't have to parse a string to get the address /// components. /// /// \param byte0 First byte of the address /// \param byte1 Second byte of the address /// \param byte2 Third byte of the address /// \param byte3 Fourth byte of the address /// /// \return Resulting address /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfIpAddress sfIpAddress_fromBytes(sfUint8 byte0, sfUint8 byte1, sfUint8 byte2, sfUint8 byte3); //////////////////////////////////////////////////////////// /// \brief Construct an address from a 32-bits integer /// /// This function uses the internal representation of /// the address directly. It should be used for optimization /// purposes, and only if you got that representation from /// sfIpAddress_ToInteger. /// /// \param address 4 bytes of the address packed into a 32-bits integer /// /// \return Resulting address /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfIpAddress sfIpAddress_fromInteger(sfUint32 address); //////////////////////////////////////////////////////////// /// \brief Get a string representation of an address /// /// The returned string is the decimal representation of the /// IP address (like "192.168.1.56"), even if it was constructed /// from a host name. /// /// \param address Address object /// \param string String where the string representation will be stored /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfIpAddress_toString(sfIpAddress address, char* string); //////////////////////////////////////////////////////////// /// \brief Get an integer representation of the address /// /// The returned number is the internal representation of the /// address, and should be used for optimization purposes only /// (like sending the address through a socket). /// The integer produced by this function can then be converted /// back to a sfIpAddress with sfIpAddress_FromInteger. /// /// \param address Address object /// /// \return 32-bits unsigned integer representation of the address /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfUint32 sfIpAddress_toInteger(sfIpAddress address); //////////////////////////////////////////////////////////// /// \brief Get the computer's local address /// /// The local address is the address of the computer from the /// LAN point of view, i.e. something like 192.168.1.56. It is /// meaningful only for communications over the local network. /// Unlike sfIpAddress_getPublicAddress, this function is fast /// and may be used safely anywhere. /// /// \return Local IP address of the computer /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfIpAddress sfIpAddress_getLocalAddress(void); //////////////////////////////////////////////////////////// /// \brief Get the computer's public address /// /// The public address is the address of the computer from the /// internet point of view, i.e. something like 89.54.1.169. /// It is necessary for communications over the world wide web. /// The only way to get a public address is to ask it to a /// distant website; as a consequence, this function depends on /// both your network connection and the server, and may be /// very slow. You should use it as few as possible. Because /// this function depends on the network connection and on a distant /// server, you may use a time limit if you don't want your program /// to be possibly stuck waiting in case there is a problem; use /// 0 to deactivate this limit. /// /// \param timeout Maximum time to wait /// /// \return Public IP address of the computer /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfIpAddress sfIpAddress_getPublicAddress(sfTime timeout); #endif // SFML_IPADDRESS_H CSFML-2.4/include/SFML/Network/Packet.h000066400000000000000000000154421301071240500174170ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_PACKET_H #define SFML_PACKET_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// /// \brief Create a new packet /// /// \return A new sfPacket object /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfPacket* sfPacket_create(void); //////////////////////////////////////////////////////////// /// \brief Create a new packet by copying an existing one /// /// \param packet Packet to copy /// /// \return A new sfPacket object which is a copy of \a packet /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfPacket* sfPacket_copy(const sfPacket* packet); //////////////////////////////////////////////////////////// /// \brief Destroy a packet /// /// \param packet Packet to destroy /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfPacket_destroy(sfPacket* packet); //////////////////////////////////////////////////////////// /// \brief Append data to the end of a packet /// /// \param packet Packet object /// \param data Pointer to the sequence of bytes to append /// \param sizeInBytes Number of bytes to append /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfPacket_append(sfPacket* packet, const void* data, size_t sizeInBytes); //////////////////////////////////////////////////////////// /// \brief Clear a packet /// /// After calling Clear, the packet is empty. /// /// \param packet Packet object /// /////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfPacket_clear(sfPacket* packet); //////////////////////////////////////////////////////////// /// \brief Get a pointer to the data contained in a packet /// /// Warning: the returned pointer may become invalid after /// you append data to the packet, therefore it should never /// be stored. /// The return pointer is NULL if the packet is empty. /// /// \param packet Packet object /// /// \return Pointer to the data /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API const void* sfPacket_getData(const sfPacket* packet); //////////////////////////////////////////////////////////// /// \brief Get the size of the data contained in a packet /// /// This function returns the number of bytes pointed to by /// what sfPacket_getData returns. /// /// \param packet Packet object /// /// \return Data size, in bytes /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API size_t sfPacket_getDataSize(const sfPacket* packet); //////////////////////////////////////////////////////////// /// \brief Tell if the reading position has reached the /// end of a packet /// /// This function is useful to know if there is some data /// left to be read, without actually reading it. /// /// \param packet Packet object /// /// \return sfTrue if all data was read, sfFalse otherwise /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfBool sfPacket_endOfPacket(const sfPacket* packet); //////////////////////////////////////////////////////////// /// \brief Test the validity of a packet, for reading /// /// This function allows to test the packet, to check if /// a reading operation was successful. /// /// A packet will be in an invalid state if it has no more /// data to read. /// /// \param packet Packet object /// /// \return sfTrue if last data extraction from packet was successful /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfBool sfPacket_canRead(const sfPacket* packet); //////////////////////////////////////////////////////////// /// \brief Functions to extract data from a packet /// /// \param packet Packet object /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfBool sfPacket_readBool(sfPacket* packet); CSFML_NETWORK_API sfInt8 sfPacket_readInt8(sfPacket* packet); CSFML_NETWORK_API sfUint8 sfPacket_readUint8(sfPacket* packet); CSFML_NETWORK_API sfInt16 sfPacket_readInt16(sfPacket* packet); CSFML_NETWORK_API sfUint16 sfPacket_readUint16(sfPacket* packet); CSFML_NETWORK_API sfInt32 sfPacket_readInt32(sfPacket* packet); CSFML_NETWORK_API sfUint32 sfPacket_readUint32(sfPacket* packet); CSFML_NETWORK_API float sfPacket_readFloat(sfPacket* packet); CSFML_NETWORK_API double sfPacket_readDouble(sfPacket* packet); CSFML_NETWORK_API void sfPacket_readString(sfPacket* packet, char* string); CSFML_NETWORK_API void sfPacket_readWideString(sfPacket* packet, wchar_t* string); //////////////////////////////////////////////////////////// /// \brief Functions to insert data into a packet /// /// \param packet Packet object /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfPacket_writeBool(sfPacket* packet, sfBool); CSFML_NETWORK_API void sfPacket_writeInt8(sfPacket* packet, sfInt8); CSFML_NETWORK_API void sfPacket_writeUint8(sfPacket* packet, sfUint8); CSFML_NETWORK_API void sfPacket_writeInt16(sfPacket* packet, sfInt16); CSFML_NETWORK_API void sfPacket_writeUint16(sfPacket* packet, sfUint16); CSFML_NETWORK_API void sfPacket_writeInt32(sfPacket* packet, sfInt32); CSFML_NETWORK_API void sfPacket_writeUint32(sfPacket* packet, sfUint32); CSFML_NETWORK_API void sfPacket_writeFloat(sfPacket* packet, float); CSFML_NETWORK_API void sfPacket_writeDouble(sfPacket* packet, double); CSFML_NETWORK_API void sfPacket_writeString(sfPacket* packet, const char* string); CSFML_NETWORK_API void sfPacket_writeWideString(sfPacket* packet, const wchar_t* string); #endif // SFML_PACKET_H CSFML-2.4/include/SFML/Network/SocketSelector.h000066400000000000000000000137761301071240500211510ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SOCKETSELECTOR_H #define SFML_SOCKETSELECTOR_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// /// \brief Create a new selector /// /// \return A new sfSocketSelector object /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfSocketSelector* sfSocketSelector_create(void); //////////////////////////////////////////////////////////// /// \brief Create a new socket selector by copying an existing one /// /// \param selector Socket selector to copy /// /// \return A new sfSocketSelector object which is a copy of \a selector /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfSocketSelector* sfSocketSelector_copy(const sfSocketSelector* selector); //////////////////////////////////////////////////////////// /// \brief Destroy a socket selector /// /// \param selector Socket selector to destroy /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfSocketSelector_destroy(sfSocketSelector* selector); //////////////////////////////////////////////////////////// /// \brief Add a new socket to a socket selector /// /// This function keeps a weak pointer to the socket, /// so you have to make sure that the socket is not destroyed /// while it is stored in the selector. /// /// \param selector Socket selector object /// \param socket Pointer to the socket to add /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfSocketSelector_addTcpListener(sfSocketSelector* selector, sfTcpListener* socket); CSFML_NETWORK_API void sfSocketSelector_addTcpSocket(sfSocketSelector* selector, sfTcpSocket* socket); CSFML_NETWORK_API void sfSocketSelector_addUdpSocket(sfSocketSelector* selector, sfUdpSocket* socket); //////////////////////////////////////////////////////////// /// \brief Remove a socket from a socket selector /// /// This function doesn't destroy the socket, it simply /// removes the pointer that the selector has to it. /// /// \param selector Socket selector object /// \param socket POointer to the socket to remove /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfSocketSelector_removeTcpListener(sfSocketSelector* selector, sfTcpListener* socket); CSFML_NETWORK_API void sfSocketSelector_removeTcpSocket(sfSocketSelector* selector, sfTcpSocket* socket); CSFML_NETWORK_API void sfSocketSelector_removeUdpSocket(sfSocketSelector* selector, sfUdpSocket* socket); //////////////////////////////////////////////////////////// /// \brief Remove all the sockets stored in a selector /// /// This function doesn't destroy any instance, it simply /// removes all the pointers that the selector has to /// external sockets. /// /// \param selector Socket selector object /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfSocketSelector_clear(sfSocketSelector* selector); //////////////////////////////////////////////////////////// /// \brief Wait until one or more sockets are ready to receive /// /// This function returns as soon as at least one socket has /// some data available to be received. To know which sockets are /// ready, use the sfSocketSelector_isXxxReady functions. /// If you use a timeout and no socket is ready before the timeout /// is over, the function returns sfFalse. /// /// \param selector Socket selector object /// \param timeout Maximum time to wait (use sfTimeZero for infinity) /// /// \return sfTrue if there are sockets ready, sfFalse otherwise /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfBool sfSocketSelector_wait(sfSocketSelector* selector, sfTime timeout); //////////////////////////////////////////////////////////// /// \brief Test a socket to know if it is ready to receive data /// /// This function must be used after a call to /// sfSocketSelector_wait, to know which sockets are ready to /// receive data. If a socket is ready, a call to Receive will /// never block because we know that there is data available to read. /// Note that if this function returns sfTrue for a sfTcpListener, /// this means that it is ready to accept a new connection. /// /// \param selector Socket selector object /// \param socket Socket to test /// /// \return sfTrue if the socket is ready to read, sfFalse otherwise /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfBool sfSocketSelector_isTcpListenerReady(const sfSocketSelector* selector, sfTcpListener* socket); CSFML_NETWORK_API sfBool sfSocketSelector_isTcpSocketReady(const sfSocketSelector* selector, sfTcpSocket* socket); CSFML_NETWORK_API sfBool sfSocketSelector_isUdpSocketReady(const sfSocketSelector* selector, sfUdpSocket* socket); #endif // SFML_SOCKETSELECTOR_H CSFML-2.4/include/SFML/Network/SocketStatus.h000066400000000000000000000033611301071240500206410ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SOCKETSTATUS_H #define SFML_SOCKETSTATUS_H //////////////////////////////////////////////////////////// /// \brief Define the status that can be returned by the socket functions /// //////////////////////////////////////////////////////////// typedef enum { sfSocketDone, ///< The socket has sent / received the data sfSocketNotReady, ///< The socket is not ready to send / receive data yet sfSocketPartial, ///< The socket sent a part of the data sfSocketDisconnected, ///< The TCP socket has been disconnected sfSocketError ///< An unexpected error happened } sfSocketStatus; #endif // SFML_SOCKETSTATUS_H CSFML-2.4/include/SFML/Network/TcpListener.h000066400000000000000000000120261301071240500204370ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_TCPLISTENER_H #define SFML_TCPLISTENER_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include //////////////////////////////////////////////////////////// /// \brief Create a new TCP listener /// /// \return A new sfTcpListener object /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfTcpListener* sfTcpListener_create(void); //////////////////////////////////////////////////////////// /// \brief Destroy a TCP listener /// /// \param listener TCP listener to destroy /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfTcpListener_destroy(sfTcpListener* listener); //////////////////////////////////////////////////////////// /// \brief Set the blocking state of a TCP listener /// /// In blocking mode, calls will not return until they have /// completed their task. For example, a call to /// sfTcpListener_accept in blocking mode won't return until /// a new connection was actually received. /// In non-blocking mode, calls will always return immediately, /// using the return code to signal whether there was data /// available or not. /// By default, all sockets are blocking. /// /// \param listener TCP listener object /// \param blocking sfTrue to set the socket as blocking, sfFalse for non-blocking /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfTcpListener_setBlocking(sfTcpListener* listener, sfBool blocking); //////////////////////////////////////////////////////////// /// \brief Tell whether a TCP listener is in blocking or non-blocking mode /// /// \param listener TCP listener object /// /// \return sfTrue if the socket is blocking, sfFalse otherwise /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfBool sfTcpListener_isBlocking(const sfTcpListener* listener); //////////////////////////////////////////////////////////// /// \brief Get the port to which a TCP listener is bound locally /// /// If the socket is not listening to a port, this function /// returns 0. /// /// \param listener TCP listener object /// /// \return Port to which the TCP listener is bound /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API unsigned short sfTcpListener_getLocalPort(const sfTcpListener* listener); //////////////////////////////////////////////////////////// /// \brief Start listening for connections /// /// This functions makes the socket listen to the specified /// port, waiting for new connections. /// If the socket was previously listening to another port, /// it will be stopped first and bound to the new port. /// /// If there is no specific address to listen to, pass sfIpAddress_Any /// /// \param listener TCP listener object /// \param port Port to listen for new connections /// \param address Address of the interface to listen on /// /// \return Status code /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfSocketStatus sfTcpListener_listen(sfTcpListener* listener, unsigned short port, sfIpAddress address); //////////////////////////////////////////////////////////// /// \brief Accept a new connection /// /// If the socket is in blocking mode, this function will /// not return until a connection is actually received. /// /// The \a connected argument points to a valid sfTcpSocket pointer /// in case of success (the function returns sfSocketDone), it points /// to a NULL pointer otherwise. /// /// \param listener TCP listener object /// \param connected Socket that will hold the new connection /// /// \return Status code /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfSocketStatus sfTcpListener_accept(sfTcpListener* listener, sfTcpSocket** connected); #endif // SFML_TCPLISTENER_H CSFML-2.4/include/SFML/Network/TcpSocket.h000066400000000000000000000216031301071240500201030ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_TCPSOCKET_H #define SFML_TCPSOCKET_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include //////////////////////////////////////////////////////////// /// \brief Create a new TCP socket /// /// \return A new sfTcpSocket object /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfTcpSocket* sfTcpSocket_create(void); //////////////////////////////////////////////////////////// /// \brief Destroy a TCP socket /// /// \param socket TCP socket to destroy /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfTcpSocket_destroy(sfTcpSocket* socket); //////////////////////////////////////////////////////////// /// \brief Set the blocking state of a TCP listener /// /// In blocking mode, calls will not return until they have /// completed their task. For example, a call to /// sfTcpSocket_receive in blocking mode won't return until /// new data was actually received. /// In non-blocking mode, calls will always return immediately, /// using the return code to signal whether there was data /// available or not. /// By default, all sockets are blocking. /// /// \param socket TCP socket object /// \param blocking sfTrue to set the socket as blocking, sfFalse for non-blocking /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfTcpSocket_setBlocking(sfTcpSocket* socket, sfBool blocking); //////////////////////////////////////////////////////////// /// \brief Tell whether a TCP socket is in blocking or non-blocking mode /// /// \param socket TCP socket object /// /// \return sfTrue if the socket is blocking, sfFalse otherwise /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfBool sfTcpSocket_isBlocking(const sfTcpSocket* socket); //////////////////////////////////////////////////////////// /// \brief Get the port to which a TCP socket is bound locally /// /// If the socket is not connected, this function returns 0. /// /// \param socket TCP socket object /// /// \return Port to which the socket is bound /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API unsigned short sfTcpSocket_getLocalPort(const sfTcpSocket* socket); //////////////////////////////////////////////////////////// /// \brief Get the address of the connected peer of a TCP socket /// /// It the socket is not connected, this function returns /// sfIpAddress_None. /// /// \param socket TCP socket object /// /// \return Address of the remote peer /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfIpAddress sfTcpSocket_getRemoteAddress(const sfTcpSocket* socket); //////////////////////////////////////////////////////////// /// \brief Get the port of the connected peer to which /// a TCP socket is connected /// /// If the socket is not connected, this function returns 0. /// /// \param socket TCP socket object /// /// \return Remote port to which the socket is connected /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API unsigned short sfTcpSocket_getRemotePort(const sfTcpSocket* socket); //////////////////////////////////////////////////////////// /// \brief Connect a TCP socket to a remote peer /// /// In blocking mode, this function may take a while, especially /// if the remote peer is not reachable. The last parameter allows /// you to stop trying to connect after a given timeout. /// If the socket was previously connected, it is first disconnected. /// /// \param socket TCP socket object /// \param remoteAddress Address of the remote peer /// \param remotePort Port of the remote peer /// \param timeout Maximum time to wait /// /// \return Status code /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfSocketStatus sfTcpSocket_connect(sfTcpSocket* socket, sfIpAddress remoteAddress, unsigned short remotePort, sfTime timeout); //////////////////////////////////////////////////////////// /// \brief Disconnect a TCP socket from its remote peer /// /// This function gracefully closes the connection. If the /// socket is not connected, this function has no effect. /// /// \param socket TCP socket object /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfTcpSocket_disconnect(sfTcpSocket* socket); //////////////////////////////////////////////////////////// /// \brief Send raw data to the remote peer of a TCP socket /// /// To be able to handle partial sends over non-blocking /// sockets, use the sfTcpSocket_sendPartial(sfTcpSocket*, const void*, std::size_t, size_t*) /// overload instead. /// This function will fail if the socket is not connected. /// /// \param socket TCP socket object /// \param data Pointer to the sequence of bytes to send /// \param size Number of bytes to send /// /// \return Status code /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfSocketStatus sfTcpSocket_send(sfTcpSocket* socket, const void* data, size_t size); //////////////////////////////////////////////////////////// /// \brief Send raw data to the remote peer /// /// This function will fail if the socket is not connected. /// /// \param socket TCP socket object /// \param data Pointer to the sequence of bytes to send /// \param size Number of bytes to send /// \param sent The number of bytes sent will be written here /// /// \return Status code /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfSocketStatus sfTcpSocket_sendPartial(sfTcpSocket* socket, const void* data, size_t size, size_t* sent); //////////////////////////////////////////////////////////// /// \brief Receive raw data from the remote peer of a TCP socket /// /// In blocking mode, this function will wait until some /// bytes are actually received. /// This function will fail if the socket is not connected. /// /// \param socket TCP socket object /// \param data Pointer to the array to fill with the received bytes /// \param size Maximum number of bytes that can be received /// \param received This variable is filled with the actual number of bytes received /// /// \return Status code /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfSocketStatus sfTcpSocket_receive(sfTcpSocket* socket, void* data, size_t size, size_t* received); //////////////////////////////////////////////////////////// /// \brief Send a formatted packet of data to the remote peer of a TCP socket /// /// In non-blocking mode, if this function returns sfSocketPartial, /// you must retry sending the same unmodified packet before sending /// anything else in order to guarantee the packet arrives at the remote /// peer uncorrupted. /// This function will fail if the socket is not connected. /// /// \param socket TCP socket object /// \param packet Packet to send /// /// \return Status code /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfSocketStatus sfTcpSocket_sendPacket(sfTcpSocket* socket, sfPacket* packet); //////////////////////////////////////////////////////////// /// \brief Receive a formatted packet of data from the remote peer /// /// In blocking mode, this function will wait until the whole packet /// has been received. /// This function will fail if the socket is not connected. /// /// \param socket TCP socket object /// \param packet Packet to fill with the received data /// /// \return Status code /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfSocketStatus sfTcpSocket_receivePacket(sfTcpSocket* socket, sfPacket* packet); #endif // SFML_TCPSOCKET_H CSFML-2.4/include/SFML/Network/Types.h000066400000000000000000000032671301071240500173160ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_NETWORK_TYPES_H #define SFML_NETWORK_TYPES_H typedef struct sfFtpDirectoryResponse sfFtpDirectoryResponse; typedef struct sfFtpListingResponse sfFtpListingResponse; typedef struct sfFtpResponse sfFtpResponse; typedef struct sfFtp sfFtp; typedef struct sfHttpRequest sfHttpRequest; typedef struct sfHttpResponse sfHttpResponse; typedef struct sfHttp sfHttp; typedef struct sfPacket sfPacket; typedef struct sfSocketSelector sfSocketSelector; typedef struct sfTcpListener sfTcpListener; typedef struct sfTcpSocket sfTcpSocket; typedef struct sfUdpSocket sfUdpSocket; #endif // SFML_NETWORK_TYPES_H CSFML-2.4/include/SFML/Network/UdpSocket.h000066400000000000000000000205731301071240500201120ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_UDPSOCKET_H #define SFML_UDPSOCKET_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include //////////////////////////////////////////////////////////// /// \brief Create a new UDP socket /// /// \return A new sfUdpSocket object /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfUdpSocket* sfUdpSocket_create(void); //////////////////////////////////////////////////////////// /// \brief Destroy a UDP socket /// /// \param socket UDP socket to destroy /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfUdpSocket_destroy(sfUdpSocket* socket); //////////////////////////////////////////////////////////// /// \brief Set the blocking state of a UDP listener /// /// In blocking mode, calls will not return until they have /// completed their task. For example, a call to /// sfUDPSocket_receive in blocking mode won't return until /// new data was actually received. /// In non-blocking mode, calls will always return immediately, /// using the return code to signal whether there was data /// available or not. /// By default, all sockets are blocking. /// /// \param socket UDP socket object /// \param blocking sfTrue to set the socket as blocking, sfFalse for non-blocking /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfUdpSocket_setBlocking(sfUdpSocket* socket, sfBool blocking); //////////////////////////////////////////////////////////// /// \brief Tell whether a UDP socket is in blocking or non-blocking mode /// /// \param socket UDP socket object /// /// \return sfTrue if the socket is blocking, sfFalse otherwise /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfBool sfUdpSocket_isBlocking(const sfUdpSocket* socket); //////////////////////////////////////////////////////////// /// \brief Get the port to which a UDP socket is bound locally /// /// If the socket is not bound to a port, this function /// returns 0. /// /// \param socket UDP socket object /// /// \return Port to which the socket is bound /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API unsigned short sfUdpSocket_getLocalPort(const sfUdpSocket* socket); //////////////////////////////////////////////////////////// /// \brief Bind a UDP socket to a specific port /// /// Binding the socket to a port is necessary for being /// able to receive data on that port. /// You can use the special value 0 to tell the /// system to automatically pick an available port, and then /// call sfUdpSocket_getLocalPort to retrieve the chosen port. /// /// If there is no specific address to listen to, pass sfIpAddress_Any /// /// \param socket UDP socket object /// \param port Port to bind the socket to /// \param address Address of the interface to bind to /// /// \return Status code /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfSocketStatus sfUdpSocket_bind(sfUdpSocket* socket, unsigned short port, sfIpAddress address); //////////////////////////////////////////////////////////// /// \brief Unbind a UDP socket from the local port to which it is bound /// /// The port that the socket was previously using is immediately /// available after this function is called. If the /// socket is not bound to a port, this function has no effect. /// /// \param socket UDP socket object /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API void sfUdpSocket_unbind(sfUdpSocket* socket); //////////////////////////////////////////////////////////// /// \brief Send raw data to a remote peer with a UDP socket /// /// Make sure that \a size is not greater than /// sfUdpSocket_maxDatagramSize(), otherwise this function will /// fail and no data will be sent. /// /// \param socket UDP socket object /// \param data Pointer to the sequence of bytes to send /// \param size Number of bytes to send /// \param remoteAddress Address of the receiver /// \param remotePort Port of the receiver to send the data to /// /// \return Status code /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfSocketStatus sfUdpSocket_send(sfUdpSocket* socket, const void* data, size_t size, sfIpAddress remoteAddress, unsigned short remotePort); //////////////////////////////////////////////////////////// /// \brief Receive raw data from a remote peer with a UDP socket /// /// In blocking mode, this function will wait until some /// bytes are actually received. /// Be careful to use a buffer which is large enough for /// the data that you intend to receive, if it is too small /// then an error will be returned and *all* the data will /// be lost. /// /// \param socket UDP socket object /// \param data Pointer to the array to fill with the received bytes /// \param size Maximum number of bytes that can be received /// \param received This variable is filled with the actual number of bytes received /// \param remoteAddress Address of the peer that sent the data /// \param remotePort Port of the peer that sent the data /// /// \return Status code /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfSocketStatus sfUdpSocket_receive(sfUdpSocket* socket, void* data, size_t size, size_t* received, sfIpAddress* remoteAddress, unsigned short* remotePort); //////////////////////////////////////////////////////////// /// \brief Send a formatted packet of data to a remote peer with a UDP socket /// /// Make sure that the packet size is not greater than /// sfUdpSocket_maxDatagramSize(), otherwise this function will /// fail and no data will be sent. /// /// \param socket UDP socket object /// \param packet Packet to send /// \param remoteAddress Address of the receiver /// \param remotePort Port of the receiver to send the data to /// /// \return Status code /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfSocketStatus sfUdpSocket_sendPacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress remoteAddress, unsigned short remotePort); //////////////////////////////////////////////////////////// /// \brief Receive a formatted packet of data from a remote peer with a UDP socket /// /// In blocking mode, this function will wait until the whole packet /// has been received. /// /// \param packet Packet to fill with the received data /// \param remoteAddress Address of the peer that sent the data /// \param remotePort Port of the peer that sent the data /// /// \return Status code /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API sfSocketStatus sfUdpSocket_receivePacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress* remoteAddress, unsigned short* remotePort); //////////////////////////////////////////////////////////// /// \brief Return the maximum number of bytes that can be /// sent in a single UDP datagram /// /// \return The maximum size of a UDP datagram (message) /// //////////////////////////////////////////////////////////// CSFML_NETWORK_API unsigned int sfUdpSocket_maxDatagramSize(); #endif // SFML_UDPSOCKET_H CSFML-2.4/include/SFML/OpenGL.h000066400000000000000000000035531301071240500157030ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_OPENGL_H #define SFML_OPENGL_H //////////////////////////////////////////////////////////// /// Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// /// This file just includes the OpenGL (GL and GLU) headers, /// which have actually different paths on each system //////////////////////////////////////////////////////////// #if defined(CSFML_SYSTEM_WINDOWS) #include #include #include #elif defined(CSFML_SYSTEM_LINUX) || defined(CSFML_SYSTEM_FREEBSD) #include #include #elif defined(CSFML_SYSTEM_MACOS) #include #include #endif #endif // SFML_OPENGL_H CSFML-2.4/include/SFML/System.h000066400000000000000000000030721301071240500160370ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SYSTEM_H #define SFML_SYSTEM_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include #include #include #include #endif // SFML_SYSTEM_H CSFML-2.4/include/SFML/System/000077500000000000000000000000001301071240500156645ustar00rootroot00000000000000CSFML-2.4/include/SFML/System/Clock.h000066400000000000000000000060601301071240500170720ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_CLOCK_H #define SFML_CLOCK_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// /// \brief Create a new clock and start it /// /// \return A new sfClock object /// //////////////////////////////////////////////////////////// CSFML_SYSTEM_API sfClock* sfClock_create(void); //////////////////////////////////////////////////////////// /// \brief Create a new clock by copying an existing one /// /// \param clock Clock to copy /// /// \return A new sfClock object which is a copy of \a clock /// //////////////////////////////////////////////////////////// CSFML_SYSTEM_API sfClock* sfClock_copy(const sfClock* clock); //////////////////////////////////////////////////////////// /// \brief Destroy a clock /// /// \param clock Clock to destroy /// //////////////////////////////////////////////////////////// CSFML_SYSTEM_API void sfClock_destroy(sfClock* clock); //////////////////////////////////////////////////////////// /// \brief Get the time elapsed in a clock /// /// This function returns the time elapsed since the last call /// to sfClock_restart (or the construction of the object if /// sfClock_restart has not been called). /// /// \param clock Clock object /// /// \return Time elapsed /// //////////////////////////////////////////////////////////// CSFML_SYSTEM_API sfTime sfClock_getElapsedTime(const sfClock* clock); //////////////////////////////////////////////////////////// /// \brief Restart a clock /// /// This function puts the time counter back to zero. /// It also returns the time elapsed since the clock was started. /// /// \param clock Clock object /// /// \return Time elapsed /// //////////////////////////////////////////////////////////// CSFML_SYSTEM_API sfTime sfClock_restart(sfClock* clock); #endif // SFML_CLOCK_H CSFML-2.4/include/SFML/System/Export.h000066400000000000000000000032011301071240500173120ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SYSTEM_EXPORT_H #define SFML_SYSTEM_EXPORT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// // Define portable import / export macros //////////////////////////////////////////////////////////// #if defined(CSFML_SYSTEM_EXPORTS) #define CSFML_SYSTEM_API CSFML_API_EXPORT #else #define CSFML_SYSTEM_API CSFML_API_IMPORT #endif #endif // SFML_SYSTEM_EXPORT_H CSFML-2.4/include/SFML/System/InputStream.h000066400000000000000000000044361301071240500203170ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_INPUTSTREAM_H #define SFML_INPUTSTREAM_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include typedef sfInt64 (*sfInputStreamReadFunc)(void* data, sfInt64 size, void* userData); typedef sfInt64 (*sfInputStreamSeekFunc)(sfInt64 position, void* userData); typedef sfInt64 (*sfInputStreamTellFunc)(void* userData); typedef sfInt64 (*sfInputStreamGetSizeFunc)(void* userData); //////////////////////////////////////////////////////////// /// \brief Set of callbacks that allow users to define custom file streams /// //////////////////////////////////////////////////////////// typedef struct sfInputStream { sfInputStreamReadFunc read; ///< Function to read data from the stream sfInputStreamSeekFunc seek; ///< Function to set the current read position sfInputStreamTellFunc tell; ///< Function to get the current read position sfInputStreamGetSizeFunc getSize; ///< Function to get the total number of bytes in the stream void* userData; ///< User data that will be passed to the callbacks } sfInputStream; #endif // SFML_INPUTSTREAM_H CSFML-2.4/include/SFML/System/Mutex.h000066400000000000000000000044421301071240500171430ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_MUTEX_H #define SFML_MUTEX_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include //////////////////////////////////////////////////////////// /// \brief Create a new mutex /// /// \return A new sfMutex object /// //////////////////////////////////////////////////////////// CSFML_SYSTEM_API sfMutex* sfMutex_create(void); //////////////////////////////////////////////////////////// /// \brief Destroy a mutex /// /// \param mutex Mutex to destroy /// //////////////////////////////////////////////////////////// CSFML_SYSTEM_API void sfMutex_destroy(sfMutex* mutex); //////////////////////////////////////////////////////////// /// \brief Lock a mutex /// /// \param mutex Mutex object /// //////////////////////////////////////////////////////////// CSFML_SYSTEM_API void sfMutex_lock(sfMutex* mutex); //////////////////////////////////////////////////////////// /// \brief Unlock a mutex /// /// \param mutex Mutex object /// //////////////////////////////////////////////////////////// CSFML_SYSTEM_API void sfMutex_unlock(sfMutex* mutex); #endif // SFML_MUTEX_H CSFML-2.4/include/SFML/System/Sleep.h000066400000000000000000000033401301071240500171050ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SLEEP_H #define SFML_SLEEP_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include //////////////////////////////////////////////////////////// /// \brief Make the current thread sleep for a given duration /// /// sfSleep is the best way to block a program or one of its /// threads, as it doesn't consume any CPU power. /// /// \param duration Time to sleep /// //////////////////////////////////////////////////////////// CSFML_SYSTEM_API void sfSleep(sfTime duration); #endif // SFML_SLEEP_H CSFML-2.4/include/SFML/System/Thread.h000066400000000000000000000073261301071240500172540ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_THREAD_H #define SFML_THREAD_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include //////////////////////////////////////////////////////////// /// \brief Create a new thread from a function pointer /// /// Note: this does *not* run the thread, use sfThread_launch. /// /// \param function Entry point of the thread /// \param userData Custom data to pass to the thread function /// /// \return A new sfThread object /// //////////////////////////////////////////////////////////// CSFML_SYSTEM_API sfThread* sfThread_create(void (*function)(void*), void* userData); //////////////////////////////////////////////////////////// /// \brief Destroy a thread /// /// This function calls sfThread_wait, so that the internal thread /// cannot survive after the sfThread object is destroyed. /// /// \param thread Thread to destroy /// //////////////////////////////////////////////////////////// CSFML_SYSTEM_API void sfThread_destroy(sfThread* thread); //////////////////////////////////////////////////////////// /// \brief Run a thread /// /// This function starts the entry point passed to the /// thread's constructor, and returns immediately. /// After this function returns, the thread's function is /// running in parallel to the calling code. /// /// \param thread Thread object /// //////////////////////////////////////////////////////////// CSFML_SYSTEM_API void sfThread_launch(sfThread* thread); //////////////////////////////////////////////////////////// /// \brief Wait until a thread finishes /// /// This function will block the execution until the /// thread's function ends. /// Warning: if the thread function never ends, the calling /// thread will block forever. /// If this function is called from its owner thread, it /// returns without doing anything. /// /// \param thread Thread object /// //////////////////////////////////////////////////////////// CSFML_SYSTEM_API void sfThread_wait(sfThread* thread); //////////////////////////////////////////////////////////// /// \brief Terminate a thread /// /// This function immediately stops the thread, without waiting /// for its function to finish. /// Terminating a thread with this function is not safe, /// and can lead to local variables not being destroyed /// on some operating systems. You should rather try to make /// the thread function terminate by itself. /// /// \param thread Thread object /// //////////////////////////////////////////////////////////// CSFML_SYSTEM_API void sfThread_terminate(sfThread* thread); #endif // SFML_THREAD_H CSFML-2.4/include/SFML/System/Time.h000066400000000000000000000072501301071240500167370ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_TIME_H #define SFML_TIME_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// /// \brief Represents a time value /// //////////////////////////////////////////////////////////// typedef struct { sfInt64 microseconds; } sfTime; //////////////////////////////////////////////////////////// /// \brief Predefined "zero" time value /// //////////////////////////////////////////////////////////// CSFML_SYSTEM_API sfTime sfTime_Zero; //////////////////////////////////////////////////////////// /// \brief Return a time value as a number of seconds /// /// \param time Time value /// /// \return Time in seconds /// //////////////////////////////////////////////////////////// CSFML_SYSTEM_API float sfTime_asSeconds(sfTime time); //////////////////////////////////////////////////////////// /// \brief Return a time value as a number of milliseconds /// /// \param time Time value /// /// \return Time in milliseconds /// //////////////////////////////////////////////////////////// CSFML_SYSTEM_API sfInt32 sfTime_asMilliseconds(sfTime time); //////////////////////////////////////////////////////////// /// \brief Return a time value as a number of microseconds /// /// \param time Time value /// /// \return Time in microseconds /// //////////////////////////////////////////////////////////// CSFML_SYSTEM_API sfInt64 sfTime_asMicroseconds(sfTime time); //////////////////////////////////////////////////////////// /// \brief Construct a time value from a number of seconds /// /// \param amount Number of seconds /// /// \return Time value constructed from the amount of seconds /// //////////////////////////////////////////////////////////// CSFML_SYSTEM_API sfTime sfSeconds(float amount); //////////////////////////////////////////////////////////// /// \brief Construct a time value from a number of milliseconds /// /// \param amount Number of milliseconds /// /// \return Time value constructed from the amount of milliseconds /// //////////////////////////////////////////////////////////// CSFML_SYSTEM_API sfTime sfMilliseconds(sfInt32 amount); //////////////////////////////////////////////////////////// /// \brief Construct a time value from a number of microseconds /// /// \param amount Number of microseconds /// /// \return Time value constructed from the amount of microseconds /// //////////////////////////////////////////////////////////// CSFML_SYSTEM_API sfTime sfMicroseconds(sfInt64 amount); #endif // SFML_TIME_H CSFML-2.4/include/SFML/System/Types.h000066400000000000000000000024161301071240500171440ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SYSTEM_TYPES_H #define SFML_SYSTEM_TYPES_H typedef struct sfClock sfClock; typedef struct sfMutex sfMutex; typedef struct sfThread sfThread; #endif // SFML_SYSTEM_TYPES_H CSFML-2.4/include/SFML/System/Vector2.h000066400000000000000000000037731301071240500173730ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_VECTOR2_H #define SFML_VECTOR2_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// /// \brief 2-component vector of integers /// //////////////////////////////////////////////////////////// typedef struct { int x; int y; } sfVector2i; //////////////////////////////////////////////////////////// /// \brief 2-component vector of unsigned integers /// //////////////////////////////////////////////////////////// typedef struct { unsigned int x; unsigned int y; } sfVector2u; //////////////////////////////////////////////////////////// /// \brief 2-component vector of floats /// //////////////////////////////////////////////////////////// typedef struct { float x; float y; } sfVector2f; #endif // SFML_VECTOR2_H CSFML-2.4/include/SFML/System/Vector3.h000066400000000000000000000030571301071240500173670ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_VECTOR3_H #define SFML_VECTOR3_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// /// \brief 3-component vector of floats /// //////////////////////////////////////////////////////////// typedef struct { float x; float y; float z; } sfVector3f; #endif // SFML_VECTOR3_H CSFML-2.4/include/SFML/Window.h000066400000000000000000000032341301071240500160220ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SFML_WINDOW_H #define SFML_SFML_WINDOW_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include #include #include #include #include #include #endif // SFML_SFML_WINDOW_H CSFML-2.4/include/SFML/Window/000077500000000000000000000000001301071240500156475ustar00rootroot00000000000000CSFML-2.4/include/SFML/Window/Context.h000066400000000000000000000054731301071240500174550ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_CONTEXT_H #define SFML_CONTEXT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// /// \brief Create a new context /// /// This function activates the new context. /// /// \return New sfContext object /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfContext* sfContext_create(void); //////////////////////////////////////////////////////////// /// \brief Destroy a context /// /// \param context Context to destroy /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API void sfContext_destroy(sfContext* context); //////////////////////////////////////////////////////////// /// \brief Activate or deactivate explicitely a context /// /// \param context Context object /// \param active sfTrue to activate, sfFalse to deactivate /// /// \return sfTrue on success, sfFalse on failure /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfBool sfContext_setActive(sfContext* context, sfBool active); //////////////////////////////////////////////////////////// /// \brief Get the settings of the context. /// /// Note that these settings may be different than the ones passed to the /// constructor; they are indeed adjusted if the original settings are not /// directly supported by the system. /// /// \return Structure containing the settings /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfContextSettings sfContext_getSettings(const sfContext* context); #endif // SFML_CONTEXT_H CSFML-2.4/include/SFML/Window/Event.h000066400000000000000000000206431301071240500171060ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_EVENT_H #define SFML_EVENT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include //////////////////////////////////////////////////////////// /// \brief Definition of all the event types /// //////////////////////////////////////////////////////////// typedef enum { sfEvtClosed, ///< The window requested to be closed (no data) sfEvtResized, ///< The window was resized (data in event.size) sfEvtLostFocus, ///< The window lost the focus (no data) sfEvtGainedFocus, ///< The window gained the focus (no data) sfEvtTextEntered, ///< A character was entered (data in event.text) sfEvtKeyPressed, ///< A key was pressed (data in event.key) sfEvtKeyReleased, ///< A key was released (data in event.key) sfEvtMouseWheelMoved, ///< The mouse wheel was scrolled (data in event.mouseWheel) (deprecated) sfEvtMouseWheelScrolled, ///< The mouse wheel was scrolled (data in event.mouseWheelScroll) sfEvtMouseButtonPressed, ///< A mouse button was pressed (data in event.mouseButton) sfEvtMouseButtonReleased, ///< A mouse button was released (data in event.mouseButton) sfEvtMouseMoved, ///< The mouse cursor moved (data in event.mouseMove) sfEvtMouseEntered, ///< The mouse cursor entered the area of the window (no data) sfEvtMouseLeft, ///< The mouse cursor left the area of the window (no data) sfEvtJoystickButtonPressed, ///< A joystick button was pressed (data in event.joystickButton) sfEvtJoystickButtonReleased, ///< A joystick button was released (data in event.joystickButton) sfEvtJoystickMoved, ///< The joystick moved along an axis (data in event.joystickMove) sfEvtJoystickConnected, ///< A joystick was connected (data in event.joystickConnect) sfEvtJoystickDisconnected, ///< A joystick was disconnected (data in event.joystickConnect) sfEvtTouchBegan, ///< A touch event began (data in event.touch) sfEvtTouchMoved, ///< A touch moved (data in event.touch) sfEvtTouchEnded, ///< A touch event ended (data in event.touch) sfEvtSensorChanged, ///< A sensor value changed (data in event.sensor) sfEvtCount, ///< Keep last -- the total number of event types } sfEventType; //////////////////////////////////////////////////////////// /// \brief Keyboard event parameters /// //////////////////////////////////////////////////////////// typedef struct { sfEventType type; sfKeyCode code; sfBool alt; sfBool control; sfBool shift; sfBool system; } sfKeyEvent; //////////////////////////////////////////////////////////// /// \brief Text event parameters /// //////////////////////////////////////////////////////////// typedef struct { sfEventType type; sfUint32 unicode; } sfTextEvent; //////////////////////////////////////////////////////////// /// \brief Mouse move event parameters /// //////////////////////////////////////////////////////////// typedef struct { sfEventType type; int x; int y; } sfMouseMoveEvent; //////////////////////////////////////////////////////////// /// \brief Mouse buttons events parameters /// //////////////////////////////////////////////////////////// typedef struct { sfEventType type; sfMouseButton button; int x; int y; } sfMouseButtonEvent; //////////////////////////////////////////////////////////// /// \brief Mouse wheel events parameters /// /// \deprecated /// Use sfMouseWheelScrollEvent instead. /// //////////////////////////////////////////////////////////// typedef struct CSFML_DEPRECATED { sfEventType type; int delta; int x; int y; } sfMouseWheelEvent; //////////////////////////////////////////////////////////// /// \brief Mouse wheel events parameters /// //////////////////////////////////////////////////////////// typedef struct { sfEventType type; sfMouseWheel wheel; float delta; int x; int y; } sfMouseWheelScrollEvent; //////////////////////////////////////////////////////////// /// \brief Joystick axis move event parameters /// //////////////////////////////////////////////////////////// typedef struct { sfEventType type; unsigned int joystickId; sfJoystickAxis axis; float position; } sfJoystickMoveEvent; //////////////////////////////////////////////////////////// /// \brief Joystick buttons events parameters /// //////////////////////////////////////////////////////////// typedef struct { sfEventType type; unsigned int joystickId; unsigned int button; } sfJoystickButtonEvent; //////////////////////////////////////////////////////////// /// \brief Joystick connection/disconnection event parameters /// //////////////////////////////////////////////////////////// typedef struct { sfEventType type; unsigned int joystickId; } sfJoystickConnectEvent; //////////////////////////////////////////////////////////// /// \brief Size events parameters /// //////////////////////////////////////////////////////////// typedef struct { sfEventType type; unsigned int width; unsigned int height; } sfSizeEvent; //////////////////////////////////////////////////////////// /// \brief Touch events parameters /// //////////////////////////////////////////////////////////// typedef struct { sfEventType type; unsigned int finger; int x; int y; } sfTouchEvent; //////////////////////////////////////////////////////////// /// \brief Sensor event parameters /// //////////////////////////////////////////////////////////// typedef struct { sfEventType type; sfSensorType sensorType; float x; float y; float z; } sfSensorEvent; //////////////////////////////////////////////////////////// /// \brief sfEvent defines a system event and its parameters /// //////////////////////////////////////////////////////////// typedef union { sfEventType type; ///< Type of the event sfSizeEvent size; ///< Size event parameters sfKeyEvent key; ///< Key event parameters sfTextEvent text; ///< Text event parameters sfMouseMoveEvent mouseMove; ///< Mouse move event parameters sfMouseButtonEvent mouseButton; ///< Mouse button event parameters sfMouseWheelEvent mouseWheel; ///< Mouse wheel event parameters (deprecated) sfMouseWheelScrollEvent mouseWheelScroll; ///< Mouse wheel event parameters sfJoystickMoveEvent joystickMove; ///< Joystick move event parameters sfJoystickButtonEvent joystickButton; ///< Joystick button event parameters sfJoystickConnectEvent joystickConnect; ///< Joystick (dis)connect event parameters sfTouchEvent touch; ///< Touch events parameters sfSensorEvent sensor; ///< Sensor event parameters } sfEvent; #endif // SFML_EVENT_H CSFML-2.4/include/SFML/Window/Export.h000066400000000000000000000032011301071240500172750ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_WINDOW_EXPORT_H #define SFML_WINDOW_EXPORT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// // Define portable import / export macros //////////////////////////////////////////////////////////// #if defined(CSFML_WINDOW_EXPORTS) #define CSFML_WINDOW_API CSFML_API_EXPORT #else #define CSFML_WINDOW_API CSFML_API_IMPORT #endif #endif // SFML_WINDOW_EXPORT_H CSFML-2.4/include/SFML/Window/Joystick.h000066400000000000000000000127171301071240500176270ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_JOYSTICK_H #define SFML_JOYSTICK_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include //////////////////////////////////////////////////////////// /// \brief Global joysticks capabilities /// //////////////////////////////////////////////////////////// enum { sfJoystickCount = 8, ///< Maximum number of supported joysticks sfJoystickButtonCount = 32, ///< Maximum number of supported buttons sfJoystickAxisCount = 8 ///< Maximum number of supported axes }; //////////////////////////////////////////////////////////// /// \brief Axes supported by SFML joysticks /// //////////////////////////////////////////////////////////// typedef enum { sfJoystickX, ///< The X axis sfJoystickY, ///< The Y axis sfJoystickZ, ///< The Z axis sfJoystickR, ///< The R axis sfJoystickU, ///< The U axis sfJoystickV, ///< The V axis sfJoystickPovX, ///< The X axis of the point-of-view hat sfJoystickPovY ///< The Y axis of the point-of-view hat } sfJoystickAxis; //////////////////////////////////////////////////////////// /// \brief Check if a joystick is connected /// /// \param joystick Index of the joystick to check /// /// \return sfTrue if the joystick is connected, sfFalse otherwise /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfBool sfJoystick_isConnected(unsigned int joystick); //////////////////////////////////////////////////////////// /// \brief Return the number of buttons supported by a joystick /// /// If the joystick is not connected, this function returns 0. /// /// \param joystick Index of the joystick /// /// \return Number of buttons supported by the joystick /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API unsigned int sfJoystick_getButtonCount(unsigned int joystick); //////////////////////////////////////////////////////////// /// \brief Check if a joystick supports a given axis /// /// If the joystick is not connected, this function returns false. /// /// \param joystick Index of the joystick /// \param axis Axis to check /// /// \return sfTrue if the joystick supports the axis, sfFalse otherwise /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfBool sfJoystick_hasAxis(unsigned int joystick, sfJoystickAxis axis); //////////////////////////////////////////////////////////// /// \brief Check if a joystick button is pressed /// /// If the joystick is not connected, this function returns false. /// /// \param joystick Index of the joystick /// \param button Button to check /// /// \return sfTrue if the button is pressed, sfFalse otherwise /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfBool sfJoystick_isButtonPressed(unsigned int joystick, unsigned int button); //////////////////////////////////////////////////////////// /// \brief Get the current position of a joystick axis /// /// If the joystick is not connected, this function returns 0. /// /// \param joystick Index of the joystick /// \param axis Axis to check /// /// \return Current position of the axis, in range [-100 .. 100] /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API float sfJoystick_getAxisPosition(unsigned int joystick, sfJoystickAxis axis); //////////////////////////////////////////////////////////// /// \brief Get the joystick information /// /// The result of this function will only remain valid until /// the next time the function is called. /// /// \param joystick Index of the joystick /// /// \return Structure containing joystick information. /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfJoystickIdentification sfJoystick_getIdentification(unsigned int joystick); //////////////////////////////////////////////////////////// /// \brief Update the states of all joysticks /// /// This function is used internally by SFML, so you normally /// don't have to call it explicitely. However, you may need to /// call it if you have no window yet (or no window at all): /// in this case the joysticks states are not updated automatically. /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API void sfJoystick_update(void); #endif // SFML_JOYSTICK_H CSFML-2.4/include/SFML/Window/JoystickIdentification.h000066400000000000000000000032301301071240500224670ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_JOYSTICKIDENDIFICATION_H #define SFML_JOYSTICKIDENDIFICATION_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// /// sfJoystickIdentification holds a joystick's identification //////////////////////////////////////////////////////////// typedef struct { const char* name; unsigned int vendorId; unsigned int productId; } sfJoystickIdentification; #endif // SFML_JOYSTICKIDENDIFICATION_H CSFML-2.4/include/SFML/Window/Keyboard.h000066400000000000000000000150361301071240500175650ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_KEYBOARD_H #define SFML_KEYBOARD_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// /// \brief Key codes /// //////////////////////////////////////////////////////////// typedef enum { sfKeyUnknown = -1, ///< Unhandled key sfKeyA, ///< The A key sfKeyB, ///< The B key sfKeyC, ///< The C key sfKeyD, ///< The D key sfKeyE, ///< The E key sfKeyF, ///< The F key sfKeyG, ///< The G key sfKeyH, ///< The H key sfKeyI, ///< The I key sfKeyJ, ///< The J key sfKeyK, ///< The K key sfKeyL, ///< The L key sfKeyM, ///< The M key sfKeyN, ///< The N key sfKeyO, ///< The O key sfKeyP, ///< The P key sfKeyQ, ///< The Q key sfKeyR, ///< The R key sfKeyS, ///< The S key sfKeyT, ///< The T key sfKeyU, ///< The U key sfKeyV, ///< The V key sfKeyW, ///< The W key sfKeyX, ///< The X key sfKeyY, ///< The Y key sfKeyZ, ///< The Z key sfKeyNum0, ///< The 0 key sfKeyNum1, ///< The 1 key sfKeyNum2, ///< The 2 key sfKeyNum3, ///< The 3 key sfKeyNum4, ///< The 4 key sfKeyNum5, ///< The 5 key sfKeyNum6, ///< The 6 key sfKeyNum7, ///< The 7 key sfKeyNum8, ///< The 8 key sfKeyNum9, ///< The 9 key sfKeyEscape, ///< The Escape key sfKeyLControl, ///< The left Control key sfKeyLShift, ///< The left Shift key sfKeyLAlt, ///< The left Alt key sfKeyLSystem, ///< The left OS specific key: window (Windows and Linux), apple (MacOS X), ... sfKeyRControl, ///< The right Control key sfKeyRShift, ///< The right Shift key sfKeyRAlt, ///< The right Alt key sfKeyRSystem, ///< The right OS specific key: window (Windows and Linux), apple (MacOS X), ... sfKeyMenu, ///< The Menu key sfKeyLBracket, ///< The [ key sfKeyRBracket, ///< The ] key sfKeySemiColon, ///< The ; key sfKeyComma, ///< The , key sfKeyPeriod, ///< The . key sfKeyQuote, ///< The ' key sfKeySlash, ///< The / key sfKeyBackSlash, ///< The \ key sfKeyTilde, ///< The ~ key sfKeyEqual, ///< The = key sfKeyDash, ///< The - key sfKeySpace, ///< The Space key sfKeyReturn, ///< The Return key sfKeyBack, ///< The Backspace key sfKeyTab, ///< The Tabulation key sfKeyPageUp, ///< The Page up key sfKeyPageDown, ///< The Page down key sfKeyEnd, ///< The End key sfKeyHome, ///< The Home key sfKeyInsert, ///< The Insert key sfKeyDelete, ///< The Delete key sfKeyAdd, ///< + sfKeySubtract, ///< - sfKeyMultiply, ///< * sfKeyDivide, ///< / sfKeyLeft, ///< Left arrow sfKeyRight, ///< Right arrow sfKeyUp, ///< Up arrow sfKeyDown, ///< Down arrow sfKeyNumpad0, ///< The numpad 0 key sfKeyNumpad1, ///< The numpad 1 key sfKeyNumpad2, ///< The numpad 2 key sfKeyNumpad3, ///< The numpad 3 key sfKeyNumpad4, ///< The numpad 4 key sfKeyNumpad5, ///< The numpad 5 key sfKeyNumpad6, ///< The numpad 6 key sfKeyNumpad7, ///< The numpad 7 key sfKeyNumpad8, ///< The numpad 8 key sfKeyNumpad9, ///< The numpad 9 key sfKeyF1, ///< The F1 key sfKeyF2, ///< The F2 key sfKeyF3, ///< The F3 key sfKeyF4, ///< The F4 key sfKeyF5, ///< The F5 key sfKeyF6, ///< The F6 key sfKeyF7, ///< The F7 key sfKeyF8, ///< The F8 key sfKeyF9, ///< The F8 key sfKeyF10, ///< The F10 key sfKeyF11, ///< The F11 key sfKeyF12, ///< The F12 key sfKeyF13, ///< The F13 key sfKeyF14, ///< The F14 key sfKeyF15, ///< The F15 key sfKeyPause, ///< The Pause key sfKeyCount ///< Keep last -- the total number of keyboard keys } sfKeyCode; //////////////////////////////////////////////////////////// /// \brief Check if a key is pressed /// /// \param key Key to check /// /// \return sfTrue if the key is pressed, sfFalse otherwise /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfBool sfKeyboard_isKeyPressed(sfKeyCode key); //////////////////////////////////////////////////////////// /// \brief Show or hide the virtual keyboard. /// /// Warning: the virtual keyboard is not supported on all systems. /// It will typically be implemented on mobile OSes (Android, iOS) /// but not on desktop OSes (Windows, Linux, ...). /// /// If the virtual keyboard is not available, this function does nothing. /// /// \param visible True to show, false to hide /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API void sfKeyboard_setVirtualKeyboardVisible(sfBool visible); #endif // SFML_KEYBOARD_H CSFML-2.4/include/SFML/Window/Mouse.h000066400000000000000000000070011301071240500171060ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_MOUSE_H #define SFML_MOUSE_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// /// \brief Mouse buttons /// //////////////////////////////////////////////////////////// typedef enum { sfMouseLeft, ///< The left mouse button sfMouseRight, ///< The right mouse button sfMouseMiddle, ///< The middle (wheel) mouse button sfMouseXButton1, ///< The first extra mouse button sfMouseXButton2, ///< The second extra mouse button sfMouseButtonCount ///< Keep last -- the total number of mouse buttons } sfMouseButton; //////////////////////////////////////////////////////////// /// \brief Mouse wheels /// //////////////////////////////////////////////////////////// typedef enum { sfMouseVerticalWheel, ///< The vertical mouse wheel sfMouseHorizontalWheel ///< The horizontal mouse wheel } sfMouseWheel; //////////////////////////////////////////////////////////// /// \brief Check if a mouse button is pressed /// /// \param button Button to check /// /// \return sfTrue if the button is pressed, sfFalse otherwise /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfBool sfMouse_isButtonPressed(sfMouseButton button); //////////////////////////////////////////////////////////// /// \brief Get the current position of the mouse /// /// This function returns the current position of the mouse /// cursor relative to the given window, or desktop if NULL is passed. /// /// \param relativeTo Reference window /// /// \return Position of the mouse cursor, relative to the given window /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfVector2i sfMouse_getPosition(const sfWindow* relativeTo); //////////////////////////////////////////////////////////// /// \brief Set the current position of the mouse /// /// This function sets the current position of the mouse /// cursor relative to the given window, or desktop if NULL is passed. /// /// \param position New position of the mouse /// \param relativeTo Reference window /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API void sfMouse_setPosition(sfVector2i position, const sfWindow* relativeTo); #endif // SFML_MOUSE_H CSFML-2.4/include/SFML/Window/Sensor.h000066400000000000000000000066701301071240500173020ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SENSOR_H #define SFML_SENSOR_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// /// \brief Sensor Types /// //////////////////////////////////////////////////////////// typedef enum { sfSensorAccelerometer, ///< Measures the raw acceleration (m/s^2) sfSensorGyroscope, ///< Measures the raw rotation rates (degrees/s) sfSensorMagnetometer, ///< Measures the ambient magnetic field (micro-teslas) sfSensorGravity, ///< Measures the direction and intensity of gravity, independent of device acceleration (m/s^2) sfSensorUserAcceleration, ///< Measures the direction and intensity of device acceleration, independent of the gravity (m/s^2) sfSensorOrientation, ///< Measures the absolute 3D orientation (degrees) sfSensorCount ///< Keep last -- the total number of sensor types } sfSensorType; //////////////////////////////////////////////////////////// /// \brief Check if a sensor is available on the underlying platform /// /// \param sensor Sensor to check /// /// \return sfTrue if the sensor is available, sfFalse otherwise /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfBool sfSensor_isAvailable(sfSensorType sensor); //////////////////////////////////////////////////////////// /// \brief Enable or disable a sensor /// /// All sensors are disabled by default, to avoid consuming too /// much battery power. Once a sensor is enabled, it starts /// sending events of the corresponding type. /// /// This function does nothing if the sensor is unavailable. /// /// \param sensor Sensor to enable /// \param enabled sfTrue to enable, sfFalse to disable /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API void sfSensor_setEnabled(sfSensorType sensor, sfBool enabled); //////////////////////////////////////////////////////////// /// \brief Get the current sensor value /// /// \param sensor Sensor to read /// /// \return The current sensor value /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfVector3f sfSensor_getValue(sfSensorType sensor); #endif // SFML_SENSOR_H CSFML-2.4/include/SFML/Window/Touch.h000066400000000000000000000044351301071240500171100ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_TOUCH_H #define SFML_TOUCH_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// /// \brief Check if a touch event is currently down /// /// \param finger Finger index /// /// \return sfTrue if \a finger is currently touching the screen, sfFalse otherwise /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfBool sfTouch_isDown(unsigned int finger); //////////////////////////////////////////////////////////// /// \brief Get the current position of a touch in window coordinates /// /// This function returns the current touch position /// relative to the given window, or desktop if NULL is passed. /// /// \param finger Finger index /// \param relativeTo Reference window /// /// \return Current position of \a finger, or undefined if it's not down /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfVector2i sfTouch_getPosition(unsigned int finger, const sfWindow* relativeTo); #endif // SFML_TOUCH_H CSFML-2.4/include/SFML/Window/Types.h000066400000000000000000000023621301071240500171270ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_WINDOW_TYPES_H #define SFML_WINDOW_TYPES_H typedef struct sfContext sfContext; typedef struct sfWindow sfWindow; #endif // SFML_WINDOW_TYPES_H CSFML-2.4/include/SFML/Window/VideoMode.h000066400000000000000000000067431301071240500177050ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_VIDEOMODE_H #define SFML_VIDEOMODE_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include //////////////////////////////////////////////////////////// /// \brief sfVideoMode defines a video mode (width, height, bpp, frequency) /// and provides functions for getting modes supported /// by the display device /// //////////////////////////////////////////////////////////// typedef struct { unsigned int width; ///< Video mode width, in pixels unsigned int height; ///< Video mode height, in pixels unsigned int bitsPerPixel; ///< Video mode pixel depth, in bits per pixels } sfVideoMode; //////////////////////////////////////////////////////////// /// \brief Get the current desktop video mode /// /// \return Current desktop video mode /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfVideoMode sfVideoMode_getDesktopMode(void); //////////////////////////////////////////////////////////// /// \brief Retrieve all the video modes supported in fullscreen mode /// /// When creating a fullscreen window, the video mode is restricted /// to be compatible with what the graphics driver and monitor /// support. This function returns the complete list of all video /// modes that can be used in fullscreen mode. /// The returned array is sorted from best to worst, so that /// the first element will always give the best mode (higher /// width, height and bits-per-pixel). /// /// \param count Pointer to a variable that will be filled with the number of modes in the array /// /// \return Pointer to an array containing all the supported fullscreen modes /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API const sfVideoMode* sfVideoMode_getFullscreenModes(size_t* count); //////////////////////////////////////////////////////////// /// \brief Tell whether or not a video mode is valid /// /// The validity of video modes is only relevant when using /// fullscreen windows; otherwise any video mode can be used /// with no restriction. /// /// \param mode Video mode /// /// \return sfTrue if the video mode is valid for fullscreen mode /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfBool sfVideoMode_isValid(sfVideoMode mode); #endif // SFML_VIDEOMODE_H CSFML-2.4/include/SFML/Window/Window.h000066400000000000000000000453171301071240500173010ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_WINDOW_H #define SFML_WINDOW_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include //////////////////////////////////////////////////////////// /// \brief Enumeration of window creation styles /// //////////////////////////////////////////////////////////// typedef enum { sfNone = 0, ///< No border / title bar (this flag and all others are mutually exclusive) sfTitlebar = 1 << 0, ///< Title bar + fixed border sfResize = 1 << 1, ///< Titlebar + resizable border + maximize button sfClose = 1 << 2, ///< Titlebar + close button sfFullscreen = 1 << 3, ///< Fullscreen mode (this flag and all others are mutually exclusive) sfDefaultStyle = sfTitlebar | sfResize | sfClose ///< Default window style } sfWindowStyle; //////////////////////////////////////////////////////////// /// \brief Enumeration of the context attribute flags /// //////////////////////////////////////////////////////////// typedef enum { sfContextDefault = 0, ///< Non-debug, compatibility context (this and the core attribute are mutually exclusive) sfContextCore = 1 << 0, ///< Core attribute sfContextDebug = 1 << 2 ///< Debug attribute } sfContextAttribute; //////////////////////////////////////////////////////////// /// \brief Structure defining the window's creation settings /// //////////////////////////////////////////////////////////// typedef struct { unsigned int depthBits; ///< Bits of the depth buffer unsigned int stencilBits; ///< Bits of the stencil buffer unsigned int antialiasingLevel; ///< Level of antialiasing unsigned int majorVersion; ///< Major number of the context version to create unsigned int minorVersion; ///< Minor number of the context version to create sfUint32 attributeFlags; ///< The attribute flags to create the context with sfBool sRgbCapable; ///< Whether the context framebuffer is sRGB capable } sfContextSettings; //////////////////////////////////////////////////////////// /// \brief Construct a new window /// /// This function creates the window with the size and pixel /// depth defined in \a mode. An optional style can be passed to /// customize the look and behaviour of the window (borders, /// title bar, resizable, closable, ...). If \a style contains /// sfFullscreen, then \a mode must be a valid video mode. /// /// The fourth parameter is a pointer to a structure specifying /// advanced OpenGL context settings such as antialiasing, /// depth-buffer bits, etc. /// /// \param mode Video mode to use (defines the width, height and depth of the rendering area of the window) /// \param title Title of the window /// \param style Window style /// \param settings Additional settings for the underlying OpenGL context /// /// \return A new sfWindow object /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfWindow* sfWindow_create(sfVideoMode mode, const char* title, sfUint32 style, const sfContextSettings* settings); //////////////////////////////////////////////////////////// /// \brief Construct a new window (with a UTF-32 title) /// /// This function creates the window with the size and pixel /// depth defined in \a mode. An optional style can be passed to /// customize the look and behaviour of the window (borders, /// title bar, resizable, closable, ...). If \a style contains /// sfFullscreen, then \a mode must be a valid video mode. /// /// The fourth parameter is a pointer to a structure specifying /// advanced OpenGL context settings such as antialiasing, /// depth-buffer bits, etc. /// /// \param mode Video mode to use (defines the width, height and depth of the rendering area of the window) /// \param title Title of the window (UTF-32) /// \param style Window style /// \param settings Additional settings for the underlying OpenGL context /// /// \return A new sfWindow object /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfWindow* sfWindow_createUnicode(sfVideoMode mode, const sfUint32* title, sfUint32 style, const sfContextSettings* settings); //////////////////////////////////////////////////////////// /// \brief Construct a window from an existing control /// /// Use this constructor if you want to create an OpenGL /// rendering area into an already existing control. /// /// The second parameter is a pointer to a structure specifying /// advanced OpenGL context settings such as antialiasing, /// depth-buffer bits, etc. /// /// \param handle Platform-specific handle of the control /// \param settings Additional settings for the underlying OpenGL context /// /// \return A new sfWindow object /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfWindow* sfWindow_createFromHandle(sfWindowHandle handle, const sfContextSettings* settings); //////////////////////////////////////////////////////////// /// \brief Destroy a window /// /// \param window Window to destroy /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API void sfWindow_destroy(sfWindow* window); //////////////////////////////////////////////////////////// /// \brief Close a window and destroy all the attached resources /// /// After calling this function, the sfWindow object remains /// valid, you must call sfWindow_destroy to actually delete it. /// All other functions such as sfWindow_pollEvent or sfWindow_display /// will still work (i.e. you don't have to test sfWindow_isOpen /// every time), and will have no effect on closed windows. /// /// \param window Window object /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API void sfWindow_close(sfWindow* window); //////////////////////////////////////////////////////////// /// \brief Tell whether or not a window is opened /// /// This function returns whether or not the window exists. /// Note that a hidden window (sfWindow_setVisible(sfFalse)) will return /// sfTrue. /// /// \param window Window object /// /// \return sfTrue if the window is opened, sfFalse if it has been closed /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfBool sfWindow_isOpen(const sfWindow* window); //////////////////////////////////////////////////////////// /// \brief Get the settings of the OpenGL context of a window /// /// Note that these settings may be different from what was /// passed to the sfWindow_create function, /// if one or more settings were not supported. In this case, /// SFML chose the closest match. /// /// \param window Window object /// /// \return Structure containing the OpenGL context settings /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfContextSettings sfWindow_getSettings(const sfWindow* window); //////////////////////////////////////////////////////////// /// \brief Pop the event on top of event queue, if any, and return it /// /// This function is not blocking: if there's no pending event then /// it will return false and leave \a event unmodified. /// Note that more than one event may be present in the event queue, /// thus you should always call this function in a loop /// to make sure that you process every pending event. /// /// \param window Window object /// \param event Event to be returned /// /// \return sfTrue if an event was returned, or sfFalse if the event queue was empty /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfBool sfWindow_pollEvent(sfWindow* window, sfEvent* event); //////////////////////////////////////////////////////////// /// \brief Wait for an event and return it /// /// This function is blocking: if there's no pending event then /// it will wait until an event is received. /// After this function returns (and no error occured), /// the \a event object is always valid and filled properly. /// This function is typically used when you have a thread that /// is dedicated to events handling: you want to make this thread /// sleep as long as no new event is received. /// /// \param window Window object /// \param event Event to be returned /// /// \return sfFalse if any error occured /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfBool sfWindow_waitEvent(sfWindow* window, sfEvent* event); //////////////////////////////////////////////////////////// /// \brief Get the position of a window /// /// \param window Window object /// /// \return Position in pixels /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfVector2i sfWindow_getPosition(const sfWindow* window); //////////////////////////////////////////////////////////// /// \brief Change the position of a window on screen /// /// This function only works for top-level windows /// (i.e. it will be ignored for windows created from /// the handle of a child window/control). /// /// \param window Window object /// \param position New position of the window, in pixels /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API void sfWindow_setPosition(sfWindow* window, sfVector2i position); //////////////////////////////////////////////////////////// /// \brief Get the size of the rendering region of a window /// /// The size doesn't include the titlebar and borders /// of the window. /// /// \param window Window object /// /// \return Size in pixels /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfVector2u sfWindow_getSize(const sfWindow* window); //////////////////////////////////////////////////////////// /// \brief Change the size of the rendering region of a window /// /// \param window Window object /// \param size New size, in pixels /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API void sfWindow_setSize(sfWindow* window, sfVector2u size); //////////////////////////////////////////////////////////// /// \brief Change the title of a window /// /// \param window Window object /// \param title New title /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API void sfWindow_setTitle(sfWindow* window, const char* title); //////////////////////////////////////////////////////////// /// \brief Change the title of a window (with a UTF-32 string) /// /// \param window Window object /// \param title New title /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API void sfWindow_setUnicodeTitle(sfWindow* window, const sfUint32* title); //////////////////////////////////////////////////////////// /// \brief Change a window's icon /// /// \a pixels must be an array of \a width x \a height pixels /// in 32-bits RGBA format. /// /// \param window Window object /// \param width Icon's width, in pixels /// \param height Icon's height, in pixels /// \param pixels Pointer to the array of pixels in memory /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API void sfWindow_setIcon(sfWindow* window, unsigned int width, unsigned int height, const sfUint8* pixels); //////////////////////////////////////////////////////////// /// \brief Show or hide a window /// /// \param window Window object /// \param visible sfTrue to show the window, sfFalse to hide it /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API void sfWindow_setVisible(sfWindow* window, sfBool visible); //////////////////////////////////////////////////////////// /// \brief Enable or disable vertical synchronization /// /// Activating vertical synchronization will limit the number /// of frames displayed to the refresh rate of the monitor. /// This can avoid some visual artifacts, and limit the framerate /// to a good value (but not constant across different computers). /// /// \param window Window object /// \param enabled sfTrue to enable v-sync, sfFalse to deactivate /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API void sfWindow_setVerticalSyncEnabled(sfWindow* window, sfBool enabled); //////////////////////////////////////////////////////////// /// \brief Show or hide the mouse cursor /// /// \param window Window object /// \param visible sfTrue to show, sfFalse to hide /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API void sfWindow_setMouseCursorVisible(sfWindow* window, sfBool visible); //////////////////////////////////////////////////////////// /// \brief Grab or release the mouse cursor /// /// If set, grabs the mouse cursor inside this window's client /// area so it may no longer be moved outside its bounds. /// Note that grabbing is only active while the window has /// focus and calling this function for fullscreen windows /// won't have any effect (fullscreen windows always grab the /// cursor). /// /// \param grabbed sfTrue to enable, sfFalse to disable /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API void sfWindow_setMouseCursorGrabbed(sfWindow* window, sfBool grabbed); //////////////////////////////////////////////////////////// /// \brief Enable or disable automatic key-repeat /// /// If key repeat is enabled, you will receive repeated /// KeyPress events while keeping a key pressed. If it is disabled, /// you will only get a single event when the key is pressed. /// /// Key repeat is enabled by default. /// /// \param window Window object /// \param enabled sfTrue to enable, sfFalse to disable /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API void sfWindow_setKeyRepeatEnabled(sfWindow* window, sfBool enabled); //////////////////////////////////////////////////////////// /// \brief Limit the framerate to a maximum fixed frequency /// /// If a limit is set, the window will use a small delay after /// each call to sfWindow_display to ensure that the current frame /// lasted long enough to match the framerate limit. /// /// \param window Window object /// \param limit Framerate limit, in frames per seconds (use 0 to disable limit) /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API void sfWindow_setFramerateLimit(sfWindow* window, unsigned int limit); //////////////////////////////////////////////////////////// /// \brief Change the joystick threshold /// /// The joystick threshold is the value below which /// no JoyMoved event will be generated. /// /// \param window Window object /// \param threshold New threshold, in the range [0, 100] /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API void sfWindow_setJoystickThreshold(sfWindow* window, float threshold); //////////////////////////////////////////////////////////// /// \brief Activate or deactivate a window as the current target /// for OpenGL rendering /// /// A window is active only on the current thread, if you want to /// make it active on another thread you have to deactivate it /// on the previous thread first if it was active. /// Only one window can be active on a thread at a time, thus /// the window previously active (if any) automatically gets deactivated. /// This is not to be confused with sfWindow_requestFocus(). /// /// \param window Window object /// \param active sfTrue to activate, sfFalse to deactivate /// /// \return sfTrue if operation was successful, sfFalse otherwise /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfBool sfWindow_setActive(sfWindow* window, sfBool active); /////////////////////////////////////////////////////////// /// \brief Request the current window to be made the active /// foreground window /// /// At any given time, only one window may have the input focus /// to receive input events such as keystrokes or mouse events. /// If a window requests focus, it only hints to the operating /// system, that it would like to be focused. The operating system /// is free to deny the request. /// This is not to be confused with sfWindow_setActive(). /// /////////////////////////////////////////////////////////// CSFML_WINDOW_API void sfWindow_requestFocus(sfWindow* window); //////////////////////////////////////////////////////////// /// \brief Check whether the window has the input focus /// /// At any given time, only one window may have the input focus /// to receive input events such as keystrokes or most mouse /// events. /// /// \return True if window has focus, false otherwise /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfBool sfWindow_hasFocus(const sfWindow* window); //////////////////////////////////////////////////////////// /// \brief Display on screen what has been rendered to the /// window so far /// /// This function is typically called after all OpenGL rendering /// has been done for the current frame, in order to show /// it on screen. /// /// \param window Window object /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API void sfWindow_display(sfWindow* window); //////////////////////////////////////////////////////////// /// \brief Get the OS-specific handle of the window /// /// The type of the returned handle is sfWindowHandle, /// which is a typedef to the handle type defined by the OS. /// You shouldn't need to use this function, unless you have /// very specific stuff to implement that SFML doesn't support, /// or implement a temporary workaround until a bug is fixed. /// /// \param window Window object /// /// \return System handle of the window /// //////////////////////////////////////////////////////////// CSFML_WINDOW_API sfWindowHandle sfWindow_getSystemHandle(const sfWindow* window); #endif // SFML_WINDOW_H CSFML-2.4/include/SFML/Window/WindowHandle.h000066400000000000000000000037341301071240500204120ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_WINDOWHANDLE_H #define SFML_WINDOWHANDLE_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// /// Define a low-level window handle type, specific to /// each platform //////////////////////////////////////////////////////////// #if defined(CSFML_SYSTEM_WINDOWS) // Window handle is HWND (HWND__*) on Windows struct HWND__; typedef struct HWND__* sfWindowHandle; #elif defined(CSFML_SYSTEM_LINUX) || defined(CSFML_SYSTEM_FREEBSD) // Window handle is Window (unsigned long) on Unix - X11 typedef unsigned long sfWindowHandle; #elif defined(CSFML_SYSTEM_MACOS) // Window handle is NSWindow (void*) on Mac OS X - Cocoa typedef void* sfWindowHandle; #endif #endif // SFML_WINDOWHANDLE_H CSFML-2.4/license.txt000066400000000000000000000017711301071240500144050ustar00rootroot00000000000000CSFML ----- CSFML - Copyright (C) 2007-2015 Laurent Gomila - laurent@sfml-dev.org This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. External libraries used by CSFML -------------------------------- * SFML is under the zlib/png license CSFML-2.4/readme.txt000066400000000000000000000032741301071240500142200ustar00rootroot00000000000000CSFML - Simple and Fast Multimedia Library for C ================================================ SFML is a simple, fast, cross-platform and object-oriented multimedia API. It provides access to windowing, graphics, audio and network. It is originally written in C++, and this project is its official binding for the C language. Authors ------- Laurent Gomila - main developer (laurent@sfml-dev.org) Zachariah Brown - active maintainer (contact@zbrown.net) Download -------- You can get the latest official release on SFML website (http://www.sfml-dev.org/download/csfml). You can also get the current development version from the git repository (https://github.com/SFML/CSFML). Learn ----- There is no tutorial for CSFML, but since it's a binding you can use the C++ resources: * The official tutorials (http://www.sfml-dev.org/tutorials/) * The online API documentation (http://www.sfml-dev.org/documentation/) * The community wiki (https://github.com/SFML/SFML/wiki/) * The community forum (http://en.sfml-dev.org/forums/) (or http://fr.sfml-dev.org/forums/ for French people) Of course, you can also find the CSFML API documentation in the SDK. Building -------- The FindSFML.cmake script required by CMake to build CSFML, is located in SFML's cmake/Modules/ directory. Contribute ---------- SFML and CSFML are open-source projects, and they need your help to go on growing and improving. Don't hesitate to post suggestions or bug reports on the forum (http://en.sfml-dev.org/forums/), or post new bugs/features requests on the task tracker (https://github.com/SFML/CSFML/issues/). You can even fork the project on GitHub, maintain your own version and send us pull requests periodically to merge your work. CSFML-2.4/src/000077500000000000000000000000001301071240500130035ustar00rootroot00000000000000CSFML-2.4/src/SFML/000077500000000000000000000000001301071240500135445ustar00rootroot00000000000000CSFML-2.4/src/SFML/Audio/000077500000000000000000000000001301071240500146055ustar00rootroot00000000000000CSFML-2.4/src/SFML/Audio/CMakeLists.txt000066400000000000000000000020301301071240500173400ustar00rootroot00000000000000 set(INCROOT ${CMAKE_SOURCE_DIR}/include/SFML/Audio) set(SRCROOT ${CMAKE_SOURCE_DIR}/src/SFML/Audio) # all source files set(SRC ${INCROOT}/Export.h ${SRCROOT}/Listener.cpp ${INCROOT}/Listener.h ${SRCROOT}/Music.cpp ${SRCROOT}/MusicStruct.h ${INCROOT}/Music.h ${SRCROOT}/Sound.cpp ${SRCROOT}/SoundStruct.h ${INCROOT}/Sound.h ${SRCROOT}/SoundBuffer.cpp ${SRCROOT}/SoundBufferStruct.h ${INCROOT}/SoundBuffer.h ${SRCROOT}/SoundBufferRecorder.cpp ${SRCROOT}/SoundBufferRecorderStruct.h ${INCROOT}/SoundBufferRecorder.h ${SRCROOT}/SoundRecorder.cpp ${SRCROOT}/SoundRecorderStruct.h ${INCROOT}/SoundRecorder.h ${INCROOT}/SoundStatus.h ${SRCROOT}/SoundStream.cpp ${SRCROOT}/SoundStreamStruct.h ${INCROOT}/SoundStream.h ${INCROOT}/Types.h ) # define the csfml-audio target csfml_add_library(csfml-audio SOURCES ${SRC} DEPENDS ${SFML_AUDIO_LIBRARY} ${SFML_SYSTEM_LIBRARY} ${SFML_AUDIO_DEPENDENCIES} ${SFML_SYSTEM_DEPENDENCIES}) CSFML-2.4/src/SFML/Audio/Listener.cpp000066400000000000000000000055741301071240500171110ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include //////////////////////////////////////////////////////////// void sfListener_setGlobalVolume(float volume) { sf::Listener::setGlobalVolume(volume); } //////////////////////////////////////////////////////////// float sfListener_getGlobalVolume(void) { return sf::Listener::getGlobalVolume(); } //////////////////////////////////////////////////////////// void sfListener_setPosition(sfVector3f position) { sf::Listener::setPosition(position.x, position.y, position.z); } //////////////////////////////////////////////////////////// sfVector3f sfListener_getPosition() { sf::Vector3f sfmlPos = sf::Listener::getPosition(); sfVector3f position = {sfmlPos.x, sfmlPos.y, sfmlPos.z}; return position; } //////////////////////////////////////////////////////////// void sfListener_setDirection(sfVector3f direction) { sf::Listener::setDirection(direction.x, direction.y, direction.z); } //////////////////////////////////////////////////////////// sfVector3f sfListener_getDirection() { sf::Vector3f sfmlDirection = sf::Listener::getDirection(); sfVector3f direction = {sfmlDirection.x, sfmlDirection.y, sfmlDirection.z}; return direction; } //////////////////////////////////////////////////////////// void sfListener_setUpVector(sfVector3f upVector) { sf::Listener::setUpVector(upVector.x, upVector.y, upVector.z); } //////////////////////////////////////////////////////////// sfVector3f sfListener_getUpVector() { sf::Vector3f sfmlUpVector = sf::Listener::getUpVector(); sfVector3f upVector = {sfmlUpVector.x, sfmlUpVector.y, sfmlUpVector.z}; return upVector; } CSFML-2.4/src/SFML/Audio/Music.cpp000066400000000000000000000151421301071240500163740ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// sfMusic* sfMusic_createFromFile(const char* filename) { sfMusic* music = new sfMusic; if (!music->This.openFromFile(filename)) { delete music; music = NULL; } return music; } //////////////////////////////////////////////////////////// sfMusic* sfMusic_createFromMemory(const void* data, size_t sizeInBytes) { sfMusic* music = new sfMusic; if (!music->This.openFromMemory(data, sizeInBytes)) { delete music; music = NULL; } return music; } //////////////////////////////////////////////////////////// sfMusic* sfMusic_createFromStream(sfInputStream* stream) { CSFML_CHECK_RETURN(stream, NULL); sfMusic* music = new sfMusic; music->Stream = CallbackStream(stream); if (!music->This.openFromStream(music->Stream)) { delete music; music = NULL; } return music; } //////////////////////////////////////////////////////////// void sfMusic_destroy(sfMusic* music) { delete music; } //////////////////////////////////////////////////////////// void sfMusic_setLoop(sfMusic* music, sfBool loop) { CSFML_CALL(music, setLoop(loop != 0)); } //////////////////////////////////////////////////////////// sfBool sfMusic_getLoop(const sfMusic* music) { CSFML_CALL_RETURN(music, getLoop(), sfFalse); } //////////////////////////////////////////////////////////// sfTime sfMusic_getDuration(const sfMusic* music) { sfTime time = {0}; CSFML_CHECK_RETURN(music, time); time.microseconds = music->This.getDuration().asMicroseconds(); return time; } //////////////////////////////////////////////////////////// void sfMusic_play(sfMusic* music) { CSFML_CALL(music, play()); } //////////////////////////////////////////////////////////// void sfMusic_pause(sfMusic* music) { CSFML_CALL(music, pause()); } //////////////////////////////////////////////////////////// void sfMusic_stop(sfMusic* music) { CSFML_CALL(music, stop()); } //////////////////////////////////////////////////////////// unsigned int sfMusic_getChannelCount(const sfMusic* music) { CSFML_CALL_RETURN(music, getChannelCount(), 0); } //////////////////////////////////////////////////////////// unsigned int sfMusic_getSampleRate(const sfMusic* music) { CSFML_CALL_RETURN(music, getSampleRate(), 0); } //////////////////////////////////////////////////////////// sfSoundStatus sfMusic_getStatus(const sfMusic* music) { CSFML_CHECK_RETURN(music, sfStopped); return static_cast(music->This.getStatus()); } //////////////////////////////////////////////////////////// sfTime sfMusic_getPlayingOffset(const sfMusic* music) { sfTime time = {0}; CSFML_CHECK_RETURN(music, time); time.microseconds = music->This.getPlayingOffset().asMicroseconds(); return time; } //////////////////////////////////////////////////////////// void sfMusic_setPitch(sfMusic* music, float pitch) { CSFML_CALL(music, setPitch(pitch)); } //////////////////////////////////////////////////////////// void sfMusic_setVolume(sfMusic* music, float volume) { CSFML_CALL(music, setVolume(volume)); } //////////////////////////////////////////////////////////// void sfMusic_setPosition(sfMusic* music, sfVector3f position) { CSFML_CALL(music, setPosition(sf::Vector3f(position.x, position.y, position.z))); } //////////////////////////////////////////////////////////// void sfMusic_setRelativeToListener(sfMusic* music, sfBool relative) { CSFML_CALL(music, setRelativeToListener(relative == sfTrue)); } //////////////////////////////////////////////////////////// void sfMusic_setMinDistance(sfMusic* music, float distance) { CSFML_CALL(music, setMinDistance(distance)); } //////////////////////////////////////////////////////////// void sfMusic_setAttenuation(sfMusic* music, float attenuation) { CSFML_CALL(music, setAttenuation(attenuation)); } //////////////////////////////////////////////////////////// void sfMusic_setPlayingOffset(sfMusic* music, sfTime timeOffset) { CSFML_CALL(music, setPlayingOffset(sf::microseconds(timeOffset.microseconds))); } //////////////////////////////////////////////////////////// float sfMusic_getPitch(const sfMusic* music) { CSFML_CALL_RETURN(music, getPitch(), 0.f); } //////////////////////////////////////////////////////////// float sfMusic_getVolume(const sfMusic* music) { CSFML_CALL_RETURN(music, getVolume(), 0.f); } //////////////////////////////////////////////////////////// sfVector3f sfMusic_getPosition(const sfMusic* music) { sfVector3f position = {0, 0, 0}; CSFML_CHECK_RETURN(music, position); sf::Vector3f sfmlPos = music->This.getPosition(); position.x = sfmlPos.x; position.y = sfmlPos.y; position.z = sfmlPos.z; return position; } //////////////////////////////////////////////////////////// sfBool sfMusic_isRelativeToListener(const sfMusic* music) { CSFML_CALL_RETURN(music, isRelativeToListener(), sfFalse); } //////////////////////////////////////////////////////////// float sfMusic_getMinDistance(const sfMusic* music) { CSFML_CALL_RETURN(music, getMinDistance(), 0.f); } //////////////////////////////////////////////////////////// float sfMusic_getAttenuation(const sfMusic* music) { CSFML_CALL_RETURN(music, getAttenuation(), 0.f); } CSFML-2.4/src/SFML/Audio/MusicStruct.h000066400000000000000000000031161301071240500172440ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_MUSICSTRUCT_H #define SFML_MUSICSTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include //////////////////////////////////////////////////////////// // Internal structure of sfMusic //////////////////////////////////////////////////////////// struct sfMusic { sf::Music This; CallbackStream Stream; }; #endif // SFML_MUSICSTRUCT_H CSFML-2.4/src/SFML/Audio/Sound.cpp000066400000000000000000000134631301071240500164100ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// sfSound* sfSound_create(void) { return new sfSound; } //////////////////////////////////////////////////////////// sfSound* sfSound_copy(const sfSound* sound) { CSFML_CHECK_RETURN(sound, NULL); return new sfSound(*sound); } //////////////////////////////////////////////////////////// void sfSound_destroy(sfSound* sound) { delete sound; } //////////////////////////////////////////////////////////// void sfSound_play(sfSound* sound) { CSFML_CALL(sound, play()); } //////////////////////////////////////////////////////////// void sfSound_pause(sfSound* sound) { CSFML_CALL(sound, pause()); } //////////////////////////////////////////////////////////// void sfSound_stop(sfSound* sound) { CSFML_CALL(sound, stop()); } //////////////////////////////////////////////////////////// void sfSound_setBuffer(sfSound* sound, const sfSoundBuffer* buffer) { if (buffer) { CSFML_CALL(sound, setBuffer(buffer->This)); sound->Buffer = buffer; } } //////////////////////////////////////////////////////////// const sfSoundBuffer* sfSound_getBuffer(const sfSound* sound) { CSFML_CHECK_RETURN(sound, NULL); return sound->Buffer; } //////////////////////////////////////////////////////////// void sfSound_setLoop(sfSound* sound, sfBool loop) { CSFML_CALL(sound, setLoop(loop == sfTrue)); } //////////////////////////////////////////////////////////// sfBool sfSound_getLoop(const sfSound* sound) { CSFML_CALL_RETURN(sound, getLoop(), sfFalse); } //////////////////////////////////////////////////////////// sfSoundStatus sfSound_getStatus(const sfSound* sound) { CSFML_CHECK_RETURN(sound, sfStopped); return static_cast(sound->This.getStatus()); } //////////////////////////////////////////////////////////// void sfSound_setPitch(sfSound* sound, float pitch) { CSFML_CALL(sound, setPitch(pitch)); } //////////////////////////////////////////////////////////// void sfSound_setVolume(sfSound* sound, float volume) { CSFML_CALL(sound, setVolume(volume)); } //////////////////////////////////////////////////////////// void sfSound_setPosition(sfSound* sound, sfVector3f position) { CSFML_CALL(sound, setPosition(sf::Vector3f(position.x, position.y, position.z))); } //////////////////////////////////////////////////////////// void sfSound_setRelativeToListener(sfSound* sound, sfBool relative) { CSFML_CALL(sound, setRelativeToListener(relative == sfTrue)); } //////////////////////////////////////////////////////////// void sfSound_setMinDistance(sfSound* sound, float distance) { CSFML_CALL(sound, setMinDistance(distance)); } //////////////////////////////////////////////////////////// void sfSound_setAttenuation(sfSound* sound, float attenuation) { CSFML_CALL(sound, setAttenuation(attenuation)); } //////////////////////////////////////////////////////////// void sfSound_setPlayingOffset(sfSound* sound, sfTime timeOffset) { CSFML_CALL(sound, setPlayingOffset(sf::microseconds(timeOffset.microseconds))); } //////////////////////////////////////////////////////////// float sfSound_getPitch(const sfSound* sound) { CSFML_CALL_RETURN(sound, getPitch(), 0.f); } //////////////////////////////////////////////////////////// float sfSound_getVolume(const sfSound* sound) { CSFML_CALL_RETURN(sound, getVolume(), 0.f); } //////////////////////////////////////////////////////////// sfVector3f sfSound_getPosition(const sfSound* sound) { sfVector3f position = {0, 0, 0}; CSFML_CHECK_RETURN(sound, position); sf::Vector3f sfmlPos = sound->This.getPosition(); position.x = sfmlPos.x; position.y = sfmlPos.y; position.z = sfmlPos.z; return position; } //////////////////////////////////////////////////////////// sfBool sfSound_isRelativeToListener(const sfSound* sound) { CSFML_CALL_RETURN(sound, isRelativeToListener(), sfFalse); } //////////////////////////////////////////////////////////// float sfSound_getMinDistance(const sfSound* sound) { CSFML_CALL_RETURN(sound, getMinDistance(), 0.f); } //////////////////////////////////////////////////////////// float sfSound_getAttenuation(const sfSound* sound) { CSFML_CALL_RETURN(sound, getAttenuation(), 0.f); } //////////////////////////////////////////////////////////// sfTime sfSound_getPlayingOffset(const sfSound* sound) { sfTime time = {0}; CSFML_CHECK_RETURN(sound, time); time.microseconds = sound->This.getPlayingOffset().asMicroseconds(); return time; } CSFML-2.4/src/SFML/Audio/SoundBuffer.cpp000066400000000000000000000106331301071240500175360ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include //////////////////////////////////////////////////////////// sfSoundBuffer* sfSoundBuffer_createFromFile(const char* filename) { sfSoundBuffer* buffer = new sfSoundBuffer; if (!buffer->This.loadFromFile(filename)) { delete buffer; buffer = NULL; } return buffer; } //////////////////////////////////////////////////////////// sfSoundBuffer* sfSoundBuffer_createFromMemory(const void* data, size_t sizeInBytes) { sfSoundBuffer* buffer = new sfSoundBuffer; if (!buffer->This.loadFromMemory(data, sizeInBytes)) { delete buffer; buffer = NULL; } return buffer; } //////////////////////////////////////////////////////////// sfSoundBuffer* sfSoundBuffer_createFromStream(sfInputStream* stream) { CSFML_CHECK_RETURN(stream, NULL); sfSoundBuffer* buffer = new sfSoundBuffer; CallbackStream sfmlStream(stream); if (!buffer->This.loadFromStream(sfmlStream)) { delete buffer; buffer = NULL; } return buffer; } //////////////////////////////////////////////////////////// sfSoundBuffer* sfSoundBuffer_createFromSamples(const sfInt16* samples, sfUint64 sampleCount, unsigned int channelCount, unsigned int sampleRate) { sfSoundBuffer* buffer = new sfSoundBuffer; if (!buffer->This.loadFromSamples(samples, sampleCount, channelCount, sampleRate)) { delete buffer; buffer = NULL; } return buffer; } //////////////////////////////////////////////////////////// sfSoundBuffer* sfSoundBuffer_copy(const sfSoundBuffer* soundBuffer) { CSFML_CHECK_RETURN(soundBuffer, NULL); return new sfSoundBuffer(*soundBuffer); } //////////////////////////////////////////////////////////// void sfSoundBuffer_destroy(sfSoundBuffer* soundBuffer) { delete soundBuffer; } //////////////////////////////////////////////////////////// sfBool sfSoundBuffer_saveToFile(const sfSoundBuffer* soundBuffer, const char* filename) { CSFML_CALL_RETURN(soundBuffer, saveToFile(filename), sfFalse); } //////////////////////////////////////////////////////////// const sfInt16* sfSoundBuffer_getSamples(const sfSoundBuffer* soundBuffer) { CSFML_CALL_RETURN(soundBuffer, getSamples(), NULL); } //////////////////////////////////////////////////////////// sfUint64 sfSoundBuffer_getSampleCount(const sfSoundBuffer* soundBuffer) { CSFML_CALL_RETURN(soundBuffer, getSampleCount(), 0); } //////////////////////////////////////////////////////////// unsigned int sfSoundBuffer_getSampleRate(const sfSoundBuffer* soundBuffer) { CSFML_CALL_RETURN(soundBuffer, getSampleRate(), 0); } //////////////////////////////////////////////////////////// unsigned int sfSoundBuffer_getChannelCount(const sfSoundBuffer* soundBuffer) { CSFML_CALL_RETURN(soundBuffer, getChannelCount(), 0); } //////////////////////////////////////////////////////////// sfTime sfSoundBuffer_getDuration(const sfSoundBuffer* soundBuffer) { sfTime time = {0}; CSFML_CHECK_RETURN(soundBuffer, time); time.microseconds = soundBuffer->This.getDuration().asMicroseconds(); return time; } CSFML-2.4/src/SFML/Audio/SoundBufferRecorder.cpp000066400000000000000000000063271301071240500212310ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// sfSoundBufferRecorder* sfSoundBufferRecorder_create(void) { return new sfSoundBufferRecorder; } //////////////////////////////////////////////////////////// void sfSoundBufferRecorder_destroy(sfSoundBufferRecorder* soundBufferRecorder) { delete soundBufferRecorder; } //////////////////////////////////////////////////////////// sfBool sfSoundBufferRecorder_start(sfSoundBufferRecorder* soundBufferRecorder, unsigned int sampleRate) { CSFML_CALL_RETURN(soundBufferRecorder, start(sampleRate), sfFalse); } //////////////////////////////////////////////////////////// void sfSoundBufferRecorder_stop(sfSoundBufferRecorder* soundBufferRecorder) { CSFML_CALL(soundBufferRecorder, stop()); } //////////////////////////////////////////////////////////// unsigned int sfSoundBufferRecorder_getSampleRate(const sfSoundBufferRecorder* soundBufferRecorder) { CSFML_CALL_RETURN(soundBufferRecorder, getSampleRate(), 0); } //////////////////////////////////////////////////////////// const sfSoundBuffer* sfSoundBufferRecorder_getBuffer(const sfSoundBufferRecorder* soundBufferRecorder) { CSFML_CHECK_RETURN(soundBufferRecorder, NULL); soundBufferRecorder->SoundBuffer.This = soundBufferRecorder->This.getBuffer(); return &soundBufferRecorder->SoundBuffer; } //////////////////////////////////////////////////////////// sfBool sfSoundBufferRecorder_setDevice(sfSoundBufferRecorder* soundBufferRecorder, const char* name) { CSFML_CALL_RETURN(soundBufferRecorder, setDevice(name), sfFalse); } //////////////////////////////////////////////////////////// const char* sfSoundBufferRecorder_getDevice(sfSoundBufferRecorder* soundBufferRecorder) { CSFML_CHECK_RETURN(soundBufferRecorder, NULL); soundBufferRecorder->DeviceName = soundBufferRecorder->This.getDevice(); return soundBufferRecorder->DeviceName.c_str(); } CSFML-2.4/src/SFML/Audio/SoundBufferRecorderStruct.h000066400000000000000000000033571301071240500221030ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SOUNDBUFFERRECORDERSTRUCT_H #define SFML_SOUNDBUFFERRECORDERSTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include //////////////////////////////////////////////////////////// // Internal structure of sfSoundBufferRecorder //////////////////////////////////////////////////////////// struct sfSoundBufferRecorder { sf::SoundBufferRecorder This; mutable sfSoundBuffer SoundBuffer; std::string DeviceName; }; #endif // SFML_SOUNDBUFFERRECORDERSTRUCT_H CSFML-2.4/src/SFML/Audio/SoundBufferStruct.h000066400000000000000000000030741301071240500204110ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SOUNDBUFFERSTRUCT_H #define SFML_SOUNDBUFFERSTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// // Internal structure of sfSoundBuffer //////////////////////////////////////////////////////////// struct sfSoundBuffer { sf::SoundBuffer This; }; #endif // SFML_SOUNDBUFFERSTRUCT_H CSFML-2.4/src/SFML/Audio/SoundRecorder.cpp000066400000000000000000000112601301071240500200670ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// sfSoundRecorder* sfSoundRecorder_create(sfSoundRecorderStartCallback onStart, sfSoundRecorderProcessCallback onProcess, sfSoundRecorderStopCallback onStop, void* userData) { return new sfSoundRecorder(onStart, onProcess, onStop, userData); } //////////////////////////////////////////////////////////// void sfSoundRecorder_destroy(sfSoundRecorder* soundRecorder) { delete soundRecorder; } //////////////////////////////////////////////////////////// sfBool sfSoundRecorder_start(sfSoundRecorder* soundRecorder, unsigned int sampleRate) { CSFML_CALL_RETURN(soundRecorder, start(sampleRate), sfFalse); } //////////////////////////////////////////////////////////// void sfSoundRecorder_stop(sfSoundRecorder* soundRecorder) { CSFML_CALL(soundRecorder, stop()); } //////////////////////////////////////////////////////////// unsigned int sfSoundRecorder_getSampleRate(const sfSoundRecorder* soundRecorder) { CSFML_CALL_RETURN(soundRecorder, getSampleRate(), 0); } //////////////////////////////////////////////////////////// sfBool sfSoundRecorder_isAvailable(void) { return sf::SoundRecorder::isAvailable(); } //////////////////////////////////////////////////////////// void sfSoundRecorder_setProcessingInterval(sfSoundRecorder* soundRecorder, sfTime interval) { CSFML_CALL(soundRecorder, setProcessingInterval(interval)); } //////////////////////////////////////////////////////////// const char** sfSoundRecorder_getAvailableDevices(size_t* count) { static std::vector stringDevices = sf::SoundRecorder::getAvailableDevices(); static std::vector cstringDevices; if (cstringDevices.empty() && !stringDevices.empty()) { for (std::vector::const_iterator it = stringDevices.begin(); it != stringDevices.end(); ++it) { cstringDevices.push_back(it->c_str()); } } if (count) *count = cstringDevices.size(); return !cstringDevices.empty() ? &cstringDevices[0] : NULL; } //////////////////////////////////////////////////////////// const char* sfSoundRecorder_getDefaultDevice() { static std::string defaultDevice = sf::SoundRecorder::getDefaultDevice(); return !defaultDevice.empty() ? defaultDevice.c_str() : NULL; } //////////////////////////////////////////////////////////// sfBool sfSoundRecorder_setDevice(sfSoundRecorder* soundRecorder, const char* name) { CSFML_CALL_RETURN(soundRecorder, setDevice(name), sfFalse); } //////////////////////////////////////////////////////////// const char* sfSoundRecorder_getDevice(sfSoundRecorder* soundRecorder) { CSFML_CHECK_RETURN(soundRecorder, NULL); soundRecorder->DeviceName = soundRecorder->This.getDevice(); return soundRecorder->DeviceName.c_str(); } //////////////////////////////////////////////////////////// void sfSoundRecorder_setChannelCount(sfSoundRecorder* soundRecorder, unsigned int channelCount) { CSFML_CALL(soundRecorder, setChannelCount(channelCount)); } //////////////////////////////////////////////////////////// unsigned int sfSoundRecorder_getChannelCount(const sfSoundRecorder* soundRecorder) { CSFML_CALL_RETURN(soundRecorder, getChannelCount(), 0); } CSFML-2.4/src/SFML/Audio/SoundRecorderStruct.h000066400000000000000000000067411301071240500207510ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SOUNDRECORDERSTRUCT_H #define SFML_SOUNDRECORDERSTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include //////////////////////////////////////////////////////////// // Helper class implementing the callback forwarding from // C++ to C in sfSoundRecorder //////////////////////////////////////////////////////////// class sfSoundRecorderImpl : public sf::SoundRecorder { public : sfSoundRecorderImpl(sfSoundRecorderStartCallback onStart, sfSoundRecorderProcessCallback onProcess, sfSoundRecorderStopCallback onStop, void* userData) : myStartCallback (onStart), myProcessCallback(onProcess), myStopCallback (onStop), myUserData (userData) { } void setProcessingInterval(sfTime interval) { sf::SoundRecorder::setProcessingInterval(sf::microseconds(interval.microseconds)); } private : virtual bool onStart() { if (myStartCallback) return myStartCallback(myUserData) == sfTrue; else return true; } virtual bool onProcessSamples(const sf::Int16* samples, std::size_t sampleCount) { if (myProcessCallback) return myProcessCallback(samples, sampleCount, myUserData) == sfTrue; else return true; } virtual void onStop() { if (myStopCallback) myStopCallback(myUserData); } sfSoundRecorderStartCallback myStartCallback; sfSoundRecorderProcessCallback myProcessCallback; sfSoundRecorderStopCallback myStopCallback; void* myUserData; }; //////////////////////////////////////////////////////////// // Internal structure of sfSoundRecorder //////////////////////////////////////////////////////////// struct sfSoundRecorder { sfSoundRecorder(sfSoundRecorderStartCallback onStart, sfSoundRecorderProcessCallback onProcess, sfSoundRecorderStopCallback onStop, void* userData) : This(onStart, onProcess, onStop, userData) { } sfSoundRecorderImpl This; std::string DeviceName; }; #endif // SFML_SOUNDRECORDERSTRUCT_H CSFML-2.4/src/SFML/Audio/SoundStream.cpp000066400000000000000000000147721301071240500175700ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// sfSoundStream* sfSoundStream_create(sfSoundStreamGetDataCallback onGetData, sfSoundStreamSeekCallback onSeek, unsigned int channelCount, unsigned int sampleRate, void* userData) { return new sfSoundStream(onGetData, onSeek, channelCount, sampleRate, userData); } //////////////////////////////////////////////////////////// void sfSoundStream_destroy(sfSoundStream* soundStream) { delete soundStream; } //////////////////////////////////////////////////////////// void sfSoundStream_play(sfSoundStream* soundStream) { CSFML_CALL(soundStream, play()); } //////////////////////////////////////////////////////////// void sfSoundStream_pause(sfSoundStream* soundStream) { CSFML_CALL(soundStream, pause()); } //////////////////////////////////////////////////////////// void sfSoundStream_stop(sfSoundStream* soundStream) { CSFML_CALL(soundStream, stop()); } //////////////////////////////////////////////////////////// sfSoundStatus sfSoundStream_getStatus(const sfSoundStream* soundStream) { CSFML_CHECK_RETURN(soundStream, sfStopped); return static_cast(soundStream->This.getStatus()); } //////////////////////////////////////////////////////////// unsigned int sfSoundStream_getChannelCount(const sfSoundStream* soundStream) { CSFML_CALL_RETURN(soundStream, getChannelCount(), 0); } //////////////////////////////////////////////////////////// unsigned int sfSoundStream_getSampleRate(const sfSoundStream* soundStream) { CSFML_CALL_RETURN(soundStream, getSampleRate(), 0); } //////////////////////////////////////////////////////////// void sfSoundStream_setPitch(sfSoundStream* soundStream, float pitch) { CSFML_CALL(soundStream, setPitch(pitch)); } //////////////////////////////////////////////////////////// void sfSoundStream_setVolume(sfSoundStream* soundStream, float volume) { CSFML_CALL(soundStream, setVolume(volume)); } //////////////////////////////////////////////////////////// void sfSoundStream_setPosition(sfSoundStream* soundStream, sfVector3f position) { CSFML_CALL(soundStream, setPosition(position.x, position.y, position.z)); } //////////////////////////////////////////////////////////// void sfSoundStream_setRelativeToListener(sfSoundStream* soundStream, sfBool relative) { CSFML_CALL(soundStream, setRelativeToListener(relative == sfTrue)); } //////////////////////////////////////////////////////////// void sfSoundStream_setMinDistance(sfSoundStream* soundStream, float distance) { CSFML_CALL(soundStream, setMinDistance(distance)); } //////////////////////////////////////////////////////////// void sfSoundStream_setAttenuation(sfSoundStream* soundStream, float attenuation) { CSFML_CALL(soundStream, setAttenuation(attenuation)); } //////////////////////////////////////////////////////////// void sfSoundStream_setPlayingOffset(sfSoundStream* soundStream, sfTime timeOffset) { CSFML_CALL(soundStream, setPlayingOffset(sf::microseconds(timeOffset.microseconds))); } //////////////////////////////////////////////////////////// void sfSoundStream_setLoop(sfSoundStream* soundStream, sfBool loop) { CSFML_CALL(soundStream, setLoop(loop == sfTrue)); } //////////////////////////////////////////////////////////// float sfSoundStream_getPitch(const sfSoundStream* soundStream) { CSFML_CALL_RETURN(soundStream, getPitch(), 0.f); } //////////////////////////////////////////////////////////// float sfSoundStream_getVolume(const sfSoundStream* soundStream) { CSFML_CALL_RETURN(soundStream, getVolume(), 0.f); } //////////////////////////////////////////////////////////// sfVector3f sfSoundStream_getPosition(const sfSoundStream* soundStream) { sfVector3f position = {0, 0, 0}; CSFML_CHECK_RETURN(soundStream, position); sf::Vector3f sfmlPos = soundStream->This.getPosition(); position.x = sfmlPos.x; position.y = sfmlPos.y; position.z = sfmlPos.z; return position; } //////////////////////////////////////////////////////////// sfBool sfSoundStream_isRelativeToListener(const sfSoundStream* soundStream) { CSFML_CALL_RETURN(soundStream, isRelativeToListener(), sfFalse); } //////////////////////////////////////////////////////////// float sfSoundStream_getMinDistance(const sfSoundStream* soundStream) { CSFML_CALL_RETURN(soundStream, getMinDistance(), 0.f); } //////////////////////////////////////////////////////////// float sfSoundStream_getAttenuation(const sfSoundStream* soundStream) { CSFML_CALL_RETURN(soundStream, getAttenuation(), 0.f); } //////////////////////////////////////////////////////////// sfBool sfSoundStream_getLoop(const sfSoundStream* soundStream) { CSFML_CALL_RETURN(soundStream, getLoop(), sfFalse); } //////////////////////////////////////////////////////////// sfTime sfSoundStream_getPlayingOffset(const sfSoundStream* soundStream) { sfTime time = {0}; CSFML_CHECK_RETURN(soundStream, time); time.microseconds = soundStream->This.getPlayingOffset().asMicroseconds(); return time; } CSFML-2.4/src/SFML/Audio/SoundStreamStruct.h000066400000000000000000000064311301071240500204330ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SOUNDSTREAMSTRUCT_H #define SFML_SOUNDSTREAMSTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// // Helper class implementing the callback forwarding from // C++ to C in sfSoundStream //////////////////////////////////////////////////////////// class sfSoundStreamImpl : public sf::SoundStream { public : sfSoundStreamImpl(sfSoundStreamGetDataCallback onGetData, sfSoundStreamSeekCallback onSeek, unsigned int channelCount, unsigned int sampleRate, void* userData) : myGetDataCallback(onGetData), mySeekCallback (onSeek), myUserData (userData) { initialize(channelCount, sampleRate); } private : virtual bool onGetData(Chunk& data) { sfSoundStreamChunk chunk = {NULL, 0}; bool ok = (myGetDataCallback(&chunk, myUserData) == sfTrue); data.samples = chunk.samples; data.sampleCount = chunk.sampleCount; return ok; } virtual void onSeek(sf::Time timeOffset) { if (mySeekCallback) { sfTime time = {timeOffset.asMicroseconds()}; mySeekCallback(time, myUserData); } } sfSoundStreamGetDataCallback myGetDataCallback; sfSoundStreamSeekCallback mySeekCallback; void* myUserData; }; //////////////////////////////////////////////////////////// // Internal structure of sfSoundStream //////////////////////////////////////////////////////////// struct sfSoundStream { sfSoundStream(sfSoundStreamGetDataCallback onGetData, sfSoundStreamSeekCallback onSeek, unsigned int channelCount, unsigned int sampleRate, void* userData) : This(onGetData, onSeek, channelCount, sampleRate, userData) { } sfSoundStreamImpl This; }; #endif // SFML_SOUNDSTREAMSTRUCT_H CSFML-2.4/src/SFML/Audio/SoundStruct.h000066400000000000000000000031501301071240500172520ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SOUNDSTRUCT_H #define SFML_SOUNDSTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include //////////////////////////////////////////////////////////// // Internal structure of sfSound //////////////////////////////////////////////////////////// struct sfSound { sf::Sound This; const sfSoundBuffer* Buffer; }; #endif // SFML_SOUNDSTRUCT_H CSFML-2.4/src/SFML/CMakeLists.txt000066400000000000000000000016771301071240500163170ustar00rootroot00000000000000 # include the SFML specific macros include(${CMAKE_SOURCE_DIR}/cmake/Macros.cmake) # add the CSFML sources path include_directories(${CMAKE_SOURCE_DIR}/src) # set the output directory for CSFML libraries set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib") # define the export symbol add_definitions(-DCSFML_EXPORTS) # disable stupid warnings with Visual C++ if(SFML_COMPILER_MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS) endif() # find SFML libraries (C++) if(SFML_OS_WINDOWS) if (CSFML_LINK_SFML_STATICALLY) set(SFML_STATIC_LIBRARIES TRUE) add_definitions(-DSFML_STATIC) endif() endif() find_package(SFML 2 COMPONENTS system window network graphics audio REQUIRED) include_directories(${SFML_INCLUDE_DIR}) # add the modules subdirectories add_subdirectory(System) add_subdirectory(Window) add_subdirectory(Network) add_subdirectory(Graphics) add_subdirectory(Audio) if(SFML_OS_WINDOWS) add_subdirectory(Main) endif() CSFML-2.4/src/SFML/CallbackStream.h000066400000000000000000000100561301071240500165670ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_CALLBACKSTREAM_H #define SFML_CALLBACKSTREAM_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include //////////////////////////////////////////////////////////// /// \brief Adapts a CSFML input stream to a SFML input stream /// //////////////////////////////////////////////////////////// class CallbackStream : public sf::InputStream { public: //////////////////////////////////////////////////////////// /// \brief Default constructor /// //////////////////////////////////////////////////////////// CallbackStream() { } //////////////////////////////////////////////////////////// /// \brief Constructor /// /// \param stream CSFML input stream callbacks /// //////////////////////////////////////////////////////////// CallbackStream(sfInputStream* stream) : myStream(*stream) { } //////////////////////////////////////////////////////////// /// \brief Read data from the stream /// /// \param data Buffer where to copy the read data /// \param size Desired number of bytes to read /// /// \return The number of bytes actually read /// //////////////////////////////////////////////////////////// virtual sf::Int64 read(void* data, sf::Int64 size) { return myStream.read ? myStream.read(data, size, myStream.userData) : -1; } //////////////////////////////////////////////////////////// /// \brief Change the current reading position /// /// \param position The position to seek to, from the beginning /// /// \return The position actually seeked to, or -1 on error /// //////////////////////////////////////////////////////////// virtual sf::Int64 seek(sf::Int64 position) { return myStream.seek ? myStream.seek(position, myStream.userData) : -1; } //////////////////////////////////////////////////////////// /// \brief Return the current reading position in the stream /// /// \return The current position, or -1 on error. /// //////////////////////////////////////////////////////////// virtual sf::Int64 tell() { return myStream.tell ? myStream.tell(myStream.userData) : -1; } //////////////////////////////////////////////////////////// /// \brief Return the size of the stream /// /// \return The total number of bytes available in the stream, or -1 on error /// //////////////////////////////////////////////////////////// virtual sf::Int64 getSize() { return myStream.getSize ? myStream.getSize(myStream.userData) : -1; } private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// sfInputStream myStream; ///< The source CSFML input stream }; #endif // SFML_CALLBACKSTREAM_H CSFML-2.4/src/SFML/ConvertEvent.h000066400000000000000000000116231301071240500163420ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_CONVERTEVENT_H #define SFML_CONVERTEVENT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include //////////////////////////////////////////////////////////// // Define a function to convert a sf::Event to a sfEvent //////////////////////////////////////////////////////////// inline void convertEvent(const sf::Event& SFMLEvent, sfEvent* event) { // Convert its type event->type = static_cast(SFMLEvent.type); // Fill its fields switch (event->type) { case sfEvtResized : event->size.width = SFMLEvent.size.width; event->size.height = SFMLEvent.size.height; break; case sfEvtTextEntered : event->text.unicode = SFMLEvent.text.unicode; break; case sfEvtKeyReleased : case sfEvtKeyPressed : event->key.code = static_cast(SFMLEvent.key.code); event->key.alt = SFMLEvent.key.alt ? sfTrue : sfFalse; event->key.control = SFMLEvent.key.control ? sfTrue : sfFalse; event->key.shift = SFMLEvent.key.shift ? sfTrue : sfFalse; event->key.system = SFMLEvent.key.system ? sfTrue : sfFalse; break; case sfEvtMouseWheelMoved : event->mouseWheel.delta = SFMLEvent.mouseWheel.delta; event->mouseWheel.x = SFMLEvent.mouseWheel.x; event->mouseWheel.y = SFMLEvent.mouseWheel.y; break; case sfEvtMouseWheelScrolled : event->mouseWheelScroll.wheel = static_cast(SFMLEvent.mouseWheelScroll.wheel); event->mouseWheelScroll.delta = SFMLEvent.mouseWheelScroll.delta; event->mouseWheelScroll.x = SFMLEvent.mouseWheelScroll.x; event->mouseWheelScroll.y = SFMLEvent.mouseWheelScroll.y; break; case sfEvtMouseButtonPressed : case sfEvtMouseButtonReleased : event->mouseButton.button = static_cast(SFMLEvent.mouseButton.button); event->mouseButton.x = SFMLEvent.mouseButton.x; event->mouseButton.y = SFMLEvent.mouseButton.y; break; case sfEvtMouseMoved : event->mouseMove.x = SFMLEvent.mouseMove.x; event->mouseMove.y = SFMLEvent.mouseMove.y; break; case sfEvtJoystickButtonPressed : case sfEvtJoystickButtonReleased : event->joystickButton.joystickId = SFMLEvent.joystickButton.joystickId; event->joystickButton.button = SFMLEvent.joystickButton.button; break; case sfEvtJoystickMoved : event->joystickMove.joystickId = SFMLEvent.joystickMove.joystickId; event->joystickMove.axis = static_cast(SFMLEvent.joystickMove.axis); event->joystickMove.position = SFMLEvent.joystickMove.position; break; case sfEvtJoystickConnected : case sfEvtJoystickDisconnected : event->joystickConnect.joystickId = SFMLEvent.joystickConnect.joystickId; break; case sfEvtTouchBegan : case sfEvtTouchMoved : case sfEvtTouchEnded : event->touch.finger = SFMLEvent.touch.finger; event->touch.x = SFMLEvent.touch.x; event->touch.y = SFMLEvent.touch.y; break; case sfEvtSensorChanged : event->sensor.sensorType = static_cast(SFMLEvent.sensor.type); event->sensor.x = SFMLEvent.sensor.x; event->sensor.y = SFMLEvent.sensor.y; event->sensor.z = SFMLEvent.sensor.z; break; default : break; } } #endif // SFML_CONVERTEVENT_H CSFML-2.4/src/SFML/Graphics/000077500000000000000000000000001301071240500153045ustar00rootroot00000000000000CSFML-2.4/src/SFML/Graphics/BlendMode.cpp000066400000000000000000000044111301071240500176410ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// const sfBlendMode sfBlendAlpha = { sfBlendFactorSrcAlpha, sfBlendFactorOneMinusSrcAlpha, sfBlendEquationAdd, sfBlendFactorOne, sfBlendFactorOneMinusSrcAlpha, sfBlendEquationAdd }; //////////////////////////////////////////////////////////// const sfBlendMode sfBlendAdd = { sfBlendFactorSrcAlpha, sfBlendFactorOne, sfBlendEquationAdd, sfBlendFactorOne, sfBlendFactorOne, sfBlendEquationAdd }; //////////////////////////////////////////////////////////// const sfBlendMode sfBlendMultiply = { sfBlendFactorDstColor, sfBlendFactorZero, sfBlendEquationAdd, sfBlendFactorDstColor, sfBlendFactorZero, sfBlendEquationAdd }; //////////////////////////////////////////////////////////// const sfBlendMode sfBlendNone = { sfBlendFactorOne, sfBlendFactorZero, sfBlendEquationAdd, sfBlendFactorOne, sfBlendFactorZero, sfBlendEquationAdd }; CSFML-2.4/src/SFML/Graphics/CMakeLists.txt000066400000000000000000000041241301071240500200450ustar00rootroot00000000000000 set(INCROOT ${CMAKE_SOURCE_DIR}/include/SFML/Graphics) set(SRCROOT ${CMAKE_SOURCE_DIR}/src/SFML/Graphics) # all source files set(SRC ${INCROOT}/Export.h ${SRCROOT}/BlendMode.cpp ${INCROOT}/BlendMode.h ${SRCROOT}/CircleShape.cpp ${SRCROOT}/CircleShapeStruct.h ${INCROOT}/CircleShape.h ${SRCROOT}/Color.cpp ${INCROOT}/Color.h ${SRCROOT}/ConvertRenderStates.hpp ${SRCROOT}/ConvertTransform.hpp ${SRCROOT}/ConvexShape.cpp ${SRCROOT}/ConvexShapeStruct.h ${INCROOT}/ConvexShape.h ${SRCROOT}/Font.cpp ${SRCROOT}/FontStruct.h ${INCROOT}/Font.h ${INCROOT}/FontInfo.h ${INCROOT}/Glyph.h ${SRCROOT}/Image.cpp ${SRCROOT}/ImageStruct.h ${INCROOT}/Image.h ${SRCROOT}/Rect.cpp ${INCROOT}/Rect.h ${SRCROOT}/RectangleShape.cpp ${SRCROOT}/RectangleShapeStruct.h ${INCROOT}/RectangleShape.h ${SRCROOT}/RenderTexture.cpp ${SRCROOT}/RenderTextureStruct.h ${INCROOT}/RenderTexture.h ${SRCROOT}/RenderWindow.cpp ${SRCROOT}/RenderWindowStruct.h ${INCROOT}/RenderWindow.h ${SRCROOT}/Shader.cpp ${SRCROOT}/ShaderStruct.h ${INCROOT}/Shader.h ${SRCROOT}/Shape.cpp ${SRCROOT}/ShapeStruct.h ${INCROOT}/Shape.h ${SRCROOT}/Sprite.cpp ${SRCROOT}/SpriteStruct.h ${INCROOT}/Sprite.h ${SRCROOT}/Text.cpp ${SRCROOT}/TextStruct.h ${INCROOT}/Text.h ${SRCROOT}/Texture.cpp ${SRCROOT}/TextureStruct.h ${INCROOT}/Texture.h ${SRCROOT}/Transform.cpp ${INCROOT}/Transform.h ${SRCROOT}/Transformable.cpp ${SRCROOT}/TransformableStruct.h ${INCROOT}/Transformable.h ${INCROOT}/Types.h ${INCROOT}/Vertex.h ${SRCROOT}/VertexArray.cpp ${SRCROOT}/VertexArrayStruct.h ${INCROOT}/VertexArray.h ${SRCROOT}/View.cpp ${SRCROOT}/ViewStruct.h ${INCROOT}/View.h ) # define the csfml-graphics target csfml_add_library(csfml-graphics SOURCES ${SRC} DEPENDS ${SFML_GRAPHICS_LIBRARY} ${SFML_WINDOW_LIBRARY} ${SFML_SYSTEM_LIBRARY} ${SFML_GRAPHICS_DEPENDENCIES} ${SFML_WINDOW_DEPENDENCIES} ${SFML_SYSTEM_DEPENDENCIES}) CSFML-2.4/src/SFML/Graphics/CircleShape.cpp000066400000000000000000000227001301071240500201730ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include //////////////////////////////////////////////////////////// sfCircleShape* sfCircleShape_create(void) { sfCircleShape* shape = new sfCircleShape; shape->Texture = NULL; return shape; } //////////////////////////////////////////////////////////// sfCircleShape* sfCircleShape_copy(const sfCircleShape* shape) { CSFML_CHECK_RETURN(shape, NULL); return new sfCircleShape(*shape); } //////////////////////////////////////////////////////////// void sfCircleShape_destroy(sfCircleShape* shape) { delete shape; } //////////////////////////////////////////////////////////// void sfCircleShape_setPosition(sfCircleShape* shape, sfVector2f position) { CSFML_CALL(shape, setPosition(position.x, position.y)); } //////////////////////////////////////////////////////////// void sfCircleShape_setRotation(sfCircleShape* shape, float angle) { CSFML_CALL(shape, setRotation(angle)); } //////////////////////////////////////////////////////////// void sfCircleShape_setScale(sfCircleShape* shape, sfVector2f scale) { CSFML_CALL(shape, setScale(scale.x, scale.y)); } //////////////////////////////////////////////////////////// void sfCircleShape_setOrigin(sfCircleShape* shape, sfVector2f origin) { CSFML_CALL(shape, setOrigin(origin.x, origin.y)); } //////////////////////////////////////////////////////////// sfVector2f sfCircleShape_getPosition(const sfCircleShape* shape) { sfVector2f position = {0, 0}; CSFML_CHECK_RETURN(shape, position); sf::Vector2f sfmlPos = shape->This.getPosition(); position.x = sfmlPos.x; position.y = sfmlPos.y; return position; } //////////////////////////////////////////////////////////// float sfCircleShape_getRotation(const sfCircleShape* shape) { CSFML_CALL_RETURN(shape, getRotation(), 0.f); } //////////////////////////////////////////////////////////// sfVector2f sfCircleShape_getScale(const sfCircleShape* shape) { sfVector2f scale = {0, 0}; CSFML_CHECK_RETURN(shape, scale); sf::Vector2f sfmlScale = shape->This.getScale(); scale.x = sfmlScale.x; scale.y = sfmlScale.y; return scale; } //////////////////////////////////////////////////////////// sfVector2f sfCircleShape_getOrigin(const sfCircleShape* shape) { sfVector2f origin = {0, 0}; CSFML_CHECK_RETURN(shape, origin); sf::Vector2f sfmlOrigin = shape->This.getOrigin(); origin.x = sfmlOrigin.x; origin.y = sfmlOrigin.y; return origin; } //////////////////////////////////////////////////////////// void sfCircleShape_move(sfCircleShape* shape, sfVector2f offset) { CSFML_CALL(shape, move(offset.x, offset.y)); } //////////////////////////////////////////////////////////// void sfCircleShape_rotate(sfCircleShape* shape, float angle) { CSFML_CALL(shape, rotate(angle)); } //////////////////////////////////////////////////////////// void sfCircleShape_scale(sfCircleShape* shape, sfVector2f factors) { CSFML_CALL(shape, scale(factors.x, factors.y)); } //////////////////////////////////////////////////////////// sfTransform sfCircleShape_getTransform(const sfCircleShape* shape) { CSFML_CHECK_RETURN(shape, sfTransform_Identity); shape->Transform = convertTransform(shape->This.getTransform()); return shape->Transform; } //////////////////////////////////////////////////////////// sfTransform sfCircleShape_getInverseTransform(const sfCircleShape* shape) { CSFML_CHECK_RETURN(shape, sfTransform_Identity); shape->InverseTransform = convertTransform(shape->This.getInverseTransform()); return shape->InverseTransform; } //////////////////////////////////////////////////////////// void sfCircleShape_setTexture(sfCircleShape* shape, const sfTexture* texture, sfBool resetRect) { CSFML_CALL(shape, setTexture(texture ? texture->This : NULL, resetRect == sfTrue)); shape->Texture = texture; } //////////////////////////////////////////////////////////// void sfCircleShape_setTextureRect(sfCircleShape* shape, sfIntRect rect) { CSFML_CALL(shape, setTextureRect(sf::IntRect(rect.left, rect.top, rect.width, rect.height))); } //////////////////////////////////////////////////////////// void sfCircleShape_setFillColor(sfCircleShape* shape, sfColor color) { CSFML_CALL(shape, setFillColor(sf::Color(color.r, color.g, color.b, color.a))); } //////////////////////////////////////////////////////////// void sfCircleShape_setOutlineColor(sfCircleShape* shape, sfColor color) { CSFML_CALL(shape, setOutlineColor(sf::Color(color.r, color.g, color.b, color.a))); } //////////////////////////////////////////////////////////// void sfCircleShape_setOutlineThickness(sfCircleShape* shape, float thickness) { CSFML_CALL(shape, setOutlineThickness(thickness)); } //////////////////////////////////////////////////////////// const sfTexture* sfCircleShape_getTexture(const sfCircleShape* shape) { CSFML_CHECK_RETURN(shape, NULL); return shape->Texture; } //////////////////////////////////////////////////////////// sfIntRect sfCircleShape_getTextureRect(const sfCircleShape* shape) { sfIntRect rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(shape, rect); sf::IntRect sfmlRect = shape->This.getTextureRect(); rect.left = sfmlRect.left; rect.top = sfmlRect.top; rect.width = sfmlRect.width; rect.height = sfmlRect.height; return rect; } //////////////////////////////////////////////////////////// sfColor sfCircleShape_getFillColor(const sfCircleShape* shape) { sfColor color = {0, 0, 0, 0}; CSFML_CHECK_RETURN(shape, color); sf::Color sfmlColor = shape->This.getFillColor(); color.r = sfmlColor.r; color.g = sfmlColor.g; color.b = sfmlColor.b; color.a = sfmlColor.a; return color; } //////////////////////////////////////////////////////////// sfColor sfCircleShape_getOutlineColor(const sfCircleShape* shape) { sfColor color = {0, 0, 0, 0}; CSFML_CHECK_RETURN(shape, color); sf::Color sfmlColor = shape->This.getOutlineColor(); color.r = sfmlColor.r; color.g = sfmlColor.g; color.b = sfmlColor.b; color.a = sfmlColor.a; return color; } //////////////////////////////////////////////////////////// float sfCircleShape_getOutlineThickness(const sfCircleShape* shape) { CSFML_CALL_RETURN(shape, getOutlineThickness(), 0.f); } //////////////////////////////////////////////////////////// size_t sfCircleShape_getPointCount(const sfCircleShape* shape) { CSFML_CALL_RETURN(shape, getPointCount(), 0); } //////////////////////////////////////////////////////////// sfVector2f sfCircleShape_getPoint(const sfCircleShape* shape, size_t index) { sfVector2f point = {0, 0}; CSFML_CHECK_RETURN(shape, point); sf::Vector2f sfmlPoint = shape->This.getPoint(index); point.x = sfmlPoint.x; point.y = sfmlPoint.y; return point; } //////////////////////////////////////////////////////////// void sfCircleShape_setRadius(sfCircleShape* shape, float radius) { CSFML_CALL(shape, setRadius(radius)); } //////////////////////////////////////////////////////////// float sfCircleShape_getRadius(const sfCircleShape* shape) { CSFML_CALL_RETURN(shape, getRadius(), 0.f); } //////////////////////////////////////////////////////////// void sfCircleShape_setPointCount(sfCircleShape* shape, size_t count) { CSFML_CALL(shape, setPointCount(count)); } //////////////////////////////////////////////////////////// sfFloatRect sfCircleShape_getLocalBounds(const sfCircleShape* shape) { sfFloatRect rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(shape, rect); sf::FloatRect sfmlRect = shape->This.getLocalBounds(); rect.left = sfmlRect.left; rect.top = sfmlRect.top; rect.width = sfmlRect.width; rect.height = sfmlRect.height; return rect; } //////////////////////////////////////////////////////////// sfFloatRect sfCircleShape_getGlobalBounds(const sfCircleShape* shape) { sfFloatRect rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(shape, rect); sf::FloatRect sfmlRect = shape->This.getGlobalBounds(); rect.left = sfmlRect.left; rect.top = sfmlRect.top; rect.width = sfmlRect.width; rect.height = sfmlRect.height; return rect; } CSFML-2.4/src/SFML/Graphics/CircleShapeStruct.h000066400000000000000000000033771301071240500210560ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_CIRCLESHAPESTRUCT_H #define SFML_CIRCLESHAPESTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// // Internal structure of sfCircleShape //////////////////////////////////////////////////////////// struct sfCircleShape { sf::CircleShape This; const sfTexture* Texture; mutable sfTransform Transform; mutable sfTransform InverseTransform; }; #endif // SFML_CIRCLESHAPESTRUCT_H CSFML-2.4/src/SFML/Graphics/Color.cpp000066400000000000000000000106361301071240500170740ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// sfColor sfBlack = sfColor_fromRGB( 0, 0, 0); sfColor sfWhite = sfColor_fromRGB(255, 255, 255); sfColor sfRed = sfColor_fromRGB(255, 0, 0); sfColor sfGreen = sfColor_fromRGB( 0, 255, 0); sfColor sfBlue = sfColor_fromRGB( 0, 0, 255); sfColor sfYellow = sfColor_fromRGB(255, 255, 0); sfColor sfMagenta = sfColor_fromRGB(255, 0, 255); sfColor sfCyan = sfColor_fromRGB( 0, 255, 255); sfColor sfTransparent = sfColor_fromRGBA( 0, 0, 0, 0); //////////////////////////////////////////////////////////// sfColor sfColor_fromRGB(sfUint8 red, sfUint8 green, sfUint8 blue) { return sfColor_fromRGBA(red, green, blue, 255); } //////////////////////////////////////////////////////////// sfColor sfColor_fromRGBA(sfUint8 red, sfUint8 green, sfUint8 blue, sfUint8 alpha) { sfColor color; color.r = red; color.g = green; color.b = blue; color.a = alpha; return color; } //////////////////////////////////////////////////////////// sfColor sfColor_fromInteger(sfUint32 color) { sfUint8 red = (color & 0xff000000) >> 24; sfUint8 green = (color & 0x00ff0000) >> 16; sfUint8 blue = (color & 0x0000ff00) >> 8; sfUint8 alpha = (color & 0x000000ff) >> 0; return sfColor_fromRGBA(red, green, blue, alpha); } //////////////////////////////////////////////////////////// sfUint32 sfColor_toInteger(sfColor color) { return (color.r << 24) | (color.g << 16) | (color.b << 8) | color.a; } //////////////////////////////////////////////////////////// sfColor sfColor_add(sfColor color1, sfColor color2) { int red = std::min(color1.r + color2.r, 255); int green = std::min(color1.g + color2.g, 255); int blue = std::min(color1.b + color2.b, 255); int alpha = std::min(color1.a + color2.a, 255); return sfColor_fromRGBA(static_cast(red), static_cast(green), static_cast(blue), static_cast(alpha)); } //////////////////////////////////////////////////////////// sfColor sfColor_subtract(sfColor color1, sfColor color2) { int red = std::max(color1.r - color2.r, 0); int green = std::max(color1.g - color2.g, 0); int blue = std::max(color1.b - color2.b, 0); int alpha = std::max(color1.a - color2.a, 0); return sfColor_fromRGBA(static_cast(red), static_cast(green), static_cast(blue), static_cast(alpha)); } //////////////////////////////////////////////////////////// sfColor sfColor_modulate(sfColor color1, sfColor color2) { int red = color1.r * color2.r / 255; int green = color1.g * color2.g / 255; int blue = color1.b * color2.b / 255; int alpha = color1.a * color2.a / 255; return sfColor_fromRGBA(static_cast(red), static_cast(green), static_cast(blue), static_cast(alpha)); } CSFML-2.4/src/SFML/Graphics/ConvertRenderStates.hpp000066400000000000000000000053711301071240500217670ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_CONVERTRENDERSTATES_H #define SFML_CONVERTRENDERSTATES_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include //////////////////////////////////////////////////////////// // Convert sfRenderStates* to sf::RenderStates //////////////////////////////////////////////////////////// inline sf::RenderStates convertRenderStates(const sfRenderStates* states) { sf::RenderStates sfmlStates; if (states) { sfmlStates.blendMode.colorSrcFactor = static_cast(states->blendMode.colorSrcFactor); sfmlStates.blendMode.colorDstFactor = static_cast(states->blendMode.colorDstFactor); sfmlStates.blendMode.colorEquation = static_cast(states->blendMode.colorEquation); sfmlStates.blendMode.alphaSrcFactor = static_cast(states->blendMode.alphaSrcFactor); sfmlStates.blendMode.alphaDstFactor = static_cast(states->blendMode.alphaDstFactor); sfmlStates.blendMode.alphaEquation = static_cast(states->blendMode.alphaEquation); sfmlStates.transform = convertTransform(states->transform); sfmlStates.texture = states->texture ? states->texture->This : NULL; sfmlStates.shader = states->shader ? &states->shader->This : NULL; } return sfmlStates; } #endif // SFML_CONVERTRENDERSTATES_H CSFML-2.4/src/SFML/Graphics/ConvertTransform.hpp000066400000000000000000000042421301071240500213330ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_CONVERTTRANSFORM_H #define SFML_CONVERTTRANSFORM_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include //////////////////////////////////////////////////////////// // Convert sf::Transform to sfTransform //////////////////////////////////////////////////////////// inline sfTransform convertTransform(const sf::Transform& transform) { const float* m = transform.getMatrix(); sfTransform converted = {m[0], m[4], m[12], m[1], m[5], m[13], m[3], m[7], m[15]}; return converted; } //////////////////////////////////////////////////////////// // Convert sfTransform to sf::Transform //////////////////////////////////////////////////////////// inline sf::Transform convertTransform(const sfTransform& transform) { const float* m = transform.matrix; return sf::Transform(m[0], m[1], m[2], m[3], m[4], m[5], m[6], m[7], m[8]); } #endif // SFML_CONVERTTRANSFORM_H CSFML-2.4/src/SFML/Graphics/ConvexShape.cpp000066400000000000000000000224041301071240500202350ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include //////////////////////////////////////////////////////////// sfConvexShape* sfConvexShape_create(void) { return new sfConvexShape; } //////////////////////////////////////////////////////////// sfConvexShape* sfConvexShape_copy(const sfConvexShape* shape) { CSFML_CHECK_RETURN(shape, NULL); return new sfConvexShape(*shape); } //////////////////////////////////////////////////////////// void sfConvexShape_destroy(sfConvexShape* shape) { delete shape; } //////////////////////////////////////////////////////////// void sfConvexShape_setPosition(sfConvexShape* shape, sfVector2f position) { CSFML_CALL(shape, setPosition(position.x, position.y)); } //////////////////////////////////////////////////////////// void sfConvexShape_setRotation(sfConvexShape* shape, float angle) { CSFML_CALL(shape, setRotation(angle)); } //////////////////////////////////////////////////////////// void sfConvexShape_setScale(sfConvexShape* shape, sfVector2f scale) { CSFML_CALL(shape, setScale(scale.x, scale.y)); } //////////////////////////////////////////////////////////// void sfConvexShape_setOrigin(sfConvexShape* shape, sfVector2f origin) { CSFML_CALL(shape, setOrigin(origin.x, origin.y)); } //////////////////////////////////////////////////////////// sfVector2f sfConvexShape_getPosition(const sfConvexShape* shape) { sfVector2f position = {0, 0}; CSFML_CHECK_RETURN(shape, position); sf::Vector2f sfmlPos = shape->This.getPosition(); position.x = sfmlPos.x; position.y = sfmlPos.y; return position; } //////////////////////////////////////////////////////////// float sfConvexShape_getRotation(const sfConvexShape* shape) { CSFML_CALL_RETURN(shape, getRotation(), 0.f); } //////////////////////////////////////////////////////////// sfVector2f sfConvexShape_getScale(const sfConvexShape* shape) { sfVector2f scale = {0, 0}; CSFML_CHECK_RETURN(shape, scale); sf::Vector2f sfmlScale = shape->This.getScale(); scale.x = sfmlScale.x; scale.y = sfmlScale.y; return scale; } //////////////////////////////////////////////////////////// sfVector2f sfConvexShape_getOrigin(const sfConvexShape* shape) { sfVector2f origin = {0, 0}; CSFML_CHECK_RETURN(shape, origin); sf::Vector2f sfmlOrigin = shape->This.getOrigin(); origin.x = sfmlOrigin.x; origin.y = sfmlOrigin.y; return origin; } //////////////////////////////////////////////////////////// void sfConvexShape_move(sfConvexShape* shape, sfVector2f offset) { CSFML_CALL(shape, move(offset.x, offset.y)); } //////////////////////////////////////////////////////////// void sfConvexShape_rotate(sfConvexShape* shape, float angle) { CSFML_CALL(shape, rotate(angle)); } //////////////////////////////////////////////////////////// void sfConvexShape_scale(sfConvexShape* shape, sfVector2f factors) { CSFML_CALL(shape, scale(factors.x, factors.y)); } //////////////////////////////////////////////////////////// sfTransform sfConvexShape_getTransform(const sfConvexShape* shape) { CSFML_CHECK_RETURN(shape, sfTransform_Identity); shape->Transform = convertTransform(shape->This.getTransform()); return shape->Transform; } //////////////////////////////////////////////////////////// sfTransform sfConvexShape_getInverseTransform(const sfConvexShape* shape) { CSFML_CHECK_RETURN(shape, sfTransform_Identity); shape->InverseTransform = convertTransform(shape->This.getInverseTransform()); return shape->InverseTransform; } //////////////////////////////////////////////////////////// void sfConvexShape_setTexture(sfConvexShape* shape, const sfTexture* texture, sfBool resetRect) { CSFML_CALL(shape, setTexture(texture ? texture->This : NULL, resetRect == sfTrue)); shape->Texture = texture; } //////////////////////////////////////////////////////////// void sfConvexShape_setTextureRect(sfConvexShape* shape, sfIntRect rect) { CSFML_CALL(shape, setTextureRect(sf::IntRect(rect.left, rect.top, rect.width, rect.height))); } //////////////////////////////////////////////////////////// void sfConvexShape_setFillColor(sfConvexShape* shape, sfColor color) { CSFML_CALL(shape, setFillColor(sf::Color(color.r, color.g, color.b, color.a))); } //////////////////////////////////////////////////////////// void sfConvexShape_setOutlineColor(sfConvexShape* shape, sfColor color) { CSFML_CALL(shape, setOutlineColor(sf::Color(color.r, color.g, color.b, color.a))); } //////////////////////////////////////////////////////////// void sfConvexShape_setOutlineThickness(sfConvexShape* shape, float thickness) { CSFML_CALL(shape, setOutlineThickness(thickness)); } //////////////////////////////////////////////////////////// const sfTexture* sfConvexShape_getTexture(const sfConvexShape* shape) { CSFML_CHECK_RETURN(shape, NULL); return shape->Texture; } //////////////////////////////////////////////////////////// sfIntRect sfConvexShape_getTextureRect(const sfConvexShape* shape) { sfIntRect rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(shape, rect); sf::IntRect sfmlRect = shape->This.getTextureRect(); rect.left = sfmlRect.left; rect.top = sfmlRect.top; rect.width = sfmlRect.width; rect.height = sfmlRect.height; return rect; } //////////////////////////////////////////////////////////// sfColor sfConvexShape_getFillColor(const sfConvexShape* shape) { sfColor color = {0, 0, 0, 0}; CSFML_CHECK_RETURN(shape, color); sf::Color sfmlColor = shape->This.getFillColor(); color.r = sfmlColor.r; color.g = sfmlColor.g; color.b = sfmlColor.b; color.a = sfmlColor.a; return color; } //////////////////////////////////////////////////////////// sfColor sfConvexShape_getOutlineColor(const sfConvexShape* shape) { sfColor color = {0, 0, 0, 0}; CSFML_CHECK_RETURN(shape, color); sf::Color sfmlColor = shape->This.getOutlineColor(); color.r = sfmlColor.r; color.g = sfmlColor.g; color.b = sfmlColor.b; color.a = sfmlColor.a; return color; } //////////////////////////////////////////////////////////// float sfConvexShape_getOutlineThickness(const sfConvexShape* shape) { CSFML_CALL_RETURN(shape, getOutlineThickness(), 0.f); } //////////////////////////////////////////////////////////// size_t sfConvexShape_getPointCount(const sfConvexShape* shape) { CSFML_CALL_RETURN(shape, getPointCount(), 0); } //////////////////////////////////////////////////////////// sfVector2f sfConvexShape_getPoint(const sfConvexShape* shape, size_t index) { sfVector2f point = {0, 0}; CSFML_CHECK_RETURN(shape, point); sf::Vector2f sfmlPoint = shape->This.getPoint(index); point.x = sfmlPoint.x; point.y = sfmlPoint.y; return point; } //////////////////////////////////////////////////////////// void sfConvexShape_setPointCount(sfConvexShape* shape, size_t count) { CSFML_CALL(shape, setPointCount(count)); } //////////////////////////////////////////////////////////// void sfConvexShape_setPoint(sfConvexShape* shape, size_t index, sfVector2f point) { CSFML_CALL(shape, setPoint(index, sf::Vector2f(point.x, point.y))); } //////////////////////////////////////////////////////////// sfFloatRect sfConvexShape_getLocalBounds(const sfConvexShape* shape) { sfFloatRect rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(shape, rect); sf::FloatRect sfmlRect = shape->This.getLocalBounds(); rect.left = sfmlRect.left; rect.top = sfmlRect.top; rect.width = sfmlRect.width; rect.height = sfmlRect.height; return rect; } //////////////////////////////////////////////////////////// sfFloatRect sfConvexShape_getGlobalBounds(const sfConvexShape* shape) { sfFloatRect rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(shape, rect); sf::FloatRect sfmlRect = shape->This.getGlobalBounds(); rect.left = sfmlRect.left; rect.top = sfmlRect.top; rect.width = sfmlRect.width; rect.height = sfmlRect.height; return rect; } CSFML-2.4/src/SFML/Graphics/ConvexShapeStruct.h000066400000000000000000000033771301071240500211170ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_CONVEXSHAPESTRUCT_H #define SFML_CONVEXSHAPESTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// // Internal structure of sfConvexShape //////////////////////////////////////////////////////////// struct sfConvexShape { sf::ConvexShape This; const sfTexture* Texture; mutable sfTransform Transform; mutable sfTransform InverseTransform; }; #endif // SFML_CONVEXSHAPESTRUCT_H CSFML-2.4/src/SFML/Graphics/Font.cpp000066400000000000000000000114621301071240500167220ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include //////////////////////////////////////////////////////////// sfFont* sfFont_createFromFile(const char* filename) { sfFont* font = new sfFont; if (!font->This.loadFromFile(filename)) { delete font; font = NULL; } return font; } //////////////////////////////////////////////////////////// sfFont* sfFont_createFromMemory(const void* data, size_t sizeInBytes) { sfFont* font = new sfFont; if (!font->This.loadFromMemory(data, sizeInBytes)) { delete font; font = NULL; } return font; } //////////////////////////////////////////////////////////// sfFont* sfFont_createFromStream(sfInputStream* stream) { CSFML_CHECK_RETURN(stream, NULL); sfFont* font = new sfFont; font->Stream = CallbackStream(stream); if (!font->This.loadFromStream(font->Stream)) { delete font; font = NULL; } return font; } //////////////////////////////////////////////////////////// sfFont* sfFont_copy(const sfFont* font) { CSFML_CHECK_RETURN(font, NULL); return new sfFont(*font); } //////////////////////////////////////////////////////////// void sfFont_destroy(sfFont* font) { delete font; } //////////////////////////////////////////////////////////// sfGlyph sfFont_getGlyph(sfFont* font, sfUint32 codePoint, unsigned int characterSize, sfBool bold, float outlineThickness) { sfGlyph glyph = {0, {0, 0, 0, 0}, {0, 0, 0, 0}}; CSFML_CHECK_RETURN(font, glyph); sf::Glyph SFMLGlyph = font->This.getGlyph(codePoint, characterSize, bold == sfTrue, outlineThickness); glyph.advance = SFMLGlyph.advance; glyph.bounds.left = SFMLGlyph.bounds.left; glyph.bounds.top = SFMLGlyph.bounds.top; glyph.bounds.width = SFMLGlyph.bounds.width; glyph.bounds.height = SFMLGlyph.bounds.height; glyph.textureRect.left = SFMLGlyph.textureRect.left; glyph.textureRect.top = SFMLGlyph.textureRect.top; glyph.textureRect.width = SFMLGlyph.textureRect.width; glyph.textureRect.height = SFMLGlyph.textureRect.height; return glyph; } //////////////////////////////////////////////////////////// float sfFont_getKerning(sfFont* font, sfUint32 first, sfUint32 second, unsigned int characterSize) { CSFML_CALL_RETURN(font, getKerning(first, second, characterSize), 0); } //////////////////////////////////////////////////////////// float sfFont_getLineSpacing(sfFont* font, unsigned int characterSize) { CSFML_CALL_RETURN(font, getLineSpacing(characterSize), 0); } //////////////////////////////////////////////////////////// float sfFont_getUnderlinePosition(sfFont* font, unsigned int characterSize) { CSFML_CALL_RETURN(font, getUnderlinePosition(characterSize), 0) } //////////////////////////////////////////////////////////// float sfFont_getUnderlineThickness(sfFont* font, unsigned int characterSize) { CSFML_CALL_RETURN(font, getUnderlineThickness(characterSize), 0) } //////////////////////////////////////////////////////////// const sfTexture* sfFont_getTexture(sfFont* font, unsigned int characterSize) { CSFML_CHECK_RETURN(font, NULL); *font->Textures[characterSize].This = font->This.getTexture(characterSize); return &font->Textures[characterSize]; } //////////////////////////////////////////////////////////// sfFontInfo sfFont_getInfo(const sfFont* font) { sfFontInfo info = {NULL}; CSFML_CHECK_RETURN(font, info); info.family = font->This.getInfo().family.c_str(); return info; } CSFML-2.4/src/SFML/Graphics/FontStruct.h000066400000000000000000000032621301071240500175730ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_FONTSTRUCT_H #define SFML_FONTSTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include //////////////////////////////////////////////////////////// // Internal structure of sfFont //////////////////////////////////////////////////////////// struct sfFont { sf::Font This; std::map Textures; CallbackStream Stream; }; #endif // SFML_FONTSTRUCT_H CSFML-2.4/src/SFML/Graphics/Image.cpp000066400000000000000000000130261301071240500170340ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include //////////////////////////////////////////////////////////// sfImage* sfImage_create(unsigned int width, unsigned int height) { sfImage* image = new sfImage; image->This.create(width, height); return image; } //////////////////////////////////////////////////////////// sfImage* sfImage_createFromColor(unsigned int width, unsigned int height, sfColor color) { sfImage* image = new sfImage; image->This.create(width, height, sf::Color(color.r, color.g, color.b, color.a)); return image; } //////////////////////////////////////////////////////////// sfImage* sfImage_createFromPixels(unsigned int width, unsigned int height, const sfUint8* data) { sfImage* image = new sfImage; image->This.create(width, height, data); return image; } //////////////////////////////////////////////////////////// sfImage* sfImage_createFromFile(const char* filename) { sfImage* image = new sfImage; if (!image->This.loadFromFile(filename)) { delete image; image = NULL; } return image; } //////////////////////////////////////////////////////////// sfImage* sfImage_createFromMemory(const void* data, size_t sizeInBytes) { sfImage* image = new sfImage; if (!image->This.loadFromMemory(data, sizeInBytes)) { delete image; image = NULL; } return image; } //////////////////////////////////////////////////////////// sfImage* sfImage_createFromStream(sfInputStream* stream) { CSFML_CHECK_RETURN(stream, NULL); sfImage* image = new sfImage; CallbackStream sfmlStream(stream); if (!image->This.loadFromStream(sfmlStream)) { delete image; image = NULL; } return image; } //////////////////////////////////////////////////////////// sfImage* sfImage_copy(const sfImage* image) { CSFML_CHECK_RETURN(image, NULL); return new sfImage(*image); } //////////////////////////////////////////////////////////// void sfImage_destroy(sfImage* image) { delete image; } //////////////////////////////////////////////////////////// sfBool sfImage_saveToFile(const sfImage* image, const char* filename) { CSFML_CALL_RETURN(image, saveToFile(filename), sfFalse); } //////////////////////////////////////////////////////////// void sfImage_createMaskFromColor(sfImage* image, sfColor colorKey, sfUint8 alpha) { CSFML_CALL(image, createMaskFromColor(sf::Color(colorKey.r, colorKey.g, colorKey.b, colorKey.a), alpha)); } //////////////////////////////////////////////////////////// void sfImage_copyImage(sfImage* image, const sfImage* source, unsigned int destX, unsigned int destY, sfIntRect sourceRect, sfBool applyAlpha) { CSFML_CHECK(source); sf::IntRect sfmlRect(sourceRect.left, sourceRect.top, sourceRect.width, sourceRect.height); CSFML_CALL(image, copy(source->This, destX, destY, sfmlRect, applyAlpha == sfTrue)); } //////////////////////////////////////////////////////////// void sfImage_setPixel(sfImage* image, unsigned int x, unsigned int y, sfColor color) { CSFML_CALL(image, setPixel(x, y, sf::Color(color.r, color.g, color.b, color.a))); } //////////////////////////////////////////////////////////// sfColor sfImage_getPixel(const sfImage* image, unsigned int x, unsigned int y) { sfColor color = {0, 0, 0, 0}; CSFML_CHECK_RETURN(image, color); sf::Color sfmlColor = image->This.getPixel(x, y); return sfColor_fromRGBA(sfmlColor.r, sfmlColor.g, sfmlColor.b, sfmlColor.a); } //////////////////////////////////////////////////////////// const sfUint8* sfImage_getPixelsPtr(const sfImage* image) { CSFML_CALL_RETURN(image, getPixelsPtr(), NULL); } //////////////////////////////////////////////////////////// sfVector2u sfImage_getSize(const sfImage* image) { sfVector2u size = {0, 0}; CSFML_CHECK_RETURN(image, size); sf::Vector2u sfmlSize = image->This.getSize(); size.x = sfmlSize.x; size.y = sfmlSize.y; return size; } //////////////////////////////////////////////////////////// void sfImage_flipHorizontally(sfImage* image) { CSFML_CALL(image, flipHorizontally()); } //////////////////////////////////////////////////////////// void sfImage_flipVertically(sfImage* image) { CSFML_CALL(image, flipVertically()); } CSFML-2.4/src/SFML/Graphics/ImageStruct.h000066400000000000000000000030251301071240500177040ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_IMAGESTRUCT_H #define SFML_IMAGESTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// // Internal structure of sfImage //////////////////////////////////////////////////////////// struct sfImage { sf::Image This; }; #endif // SFML_IMAGESTRUCT_H CSFML-2.4/src/SFML/Graphics/Rect.cpp000066400000000000000000000070321301071240500167070ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// /// Check if a point is inside a rectangle's area //////////////////////////////////////////////////////////// sfBool sfFloatRect_contains(const sfFloatRect* rect, float x, float y) { CSFML_CHECK_RETURN(rect, sfFalse); return sf::FloatRect(rect->left, rect->top, rect->width, rect->height).contains(x, y); } sfBool sfIntRect_contains(const sfIntRect* rect, int x, int y) { CSFML_CHECK_RETURN(rect, sfFalse); return sf::IntRect(rect->left, rect->top, rect->width, rect->height).contains(x, y); } //////////////////////////////////////////////////////////// /// Check intersection between two rectangles //////////////////////////////////////////////////////////// sfBool sfFloatRect_intersects(const sfFloatRect* rect1, const sfFloatRect* rect2, sfFloatRect* intersection) { CSFML_CHECK_RETURN(rect1, sfFalse); CSFML_CHECK_RETURN(rect2, sfFalse); sf::FloatRect SFMLRect1(rect1->left, rect1->top, rect1->width, rect1->height); sf::FloatRect SFMLRect2(rect2->left, rect2->top, rect2->width, rect2->height); if (intersection) { sf::FloatRect overlap; bool intersects = SFMLRect1.intersects(SFMLRect2, overlap); intersection->left = overlap.left; intersection->top = overlap.top; intersection->width = overlap.width; intersection->height = overlap.height; return intersects; } else { return SFMLRect1.intersects(SFMLRect2); } } sfBool sfIntRect_intersects(const sfIntRect* rect1, const sfIntRect* rect2, sfIntRect* intersection) { CSFML_CHECK_RETURN(rect1, sfFalse); CSFML_CHECK_RETURN(rect2, sfFalse); sf::IntRect SFMLRect1(rect1->left, rect1->top, rect1->width, rect1->height); sf::IntRect SFMLRect2(rect2->left, rect2->top, rect2->width, rect2->height); if (intersection) { sf::IntRect overlap; bool intersects = SFMLRect1.intersects(SFMLRect2, overlap); intersection->left = overlap.left; intersection->top = overlap.top; intersection->width = overlap.width; intersection->height = overlap.height; return intersects; } else { return SFMLRect1.intersects(SFMLRect2); } } CSFML-2.4/src/SFML/Graphics/RectangleShape.cpp000066400000000000000000000230771301071240500207060ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include //////////////////////////////////////////////////////////// sfRectangleShape* sfRectangleShape_create(void) { return new sfRectangleShape; } //////////////////////////////////////////////////////////// sfRectangleShape* sfRectangleShape_copy(const sfRectangleShape* shape) { CSFML_CHECK_RETURN(shape, NULL); return new sfRectangleShape(*shape); } //////////////////////////////////////////////////////////// void sfRectangleShape_destroy(sfRectangleShape* shape) { delete shape; } //////////////////////////////////////////////////////////// void sfRectangleShape_setPosition(sfRectangleShape* shape, sfVector2f position) { CSFML_CALL(shape, setPosition(position.x, position.y)); } //////////////////////////////////////////////////////////// void sfRectangleShape_setRotation(sfRectangleShape* shape, float angle) { CSFML_CALL(shape, setRotation(angle)); } //////////////////////////////////////////////////////////// void sfRectangleShape_setScale(sfRectangleShape* shape, sfVector2f scale) { CSFML_CALL(shape, setScale(scale.x, scale.y)); } //////////////////////////////////////////////////////////// void sfRectangleShape_setOrigin(sfRectangleShape* shape, sfVector2f origin) { CSFML_CALL(shape, setOrigin(origin.x, origin.y)); } //////////////////////////////////////////////////////////// sfVector2f sfRectangleShape_getPosition(const sfRectangleShape* shape) { sfVector2f position = {0, 0}; CSFML_CHECK_RETURN(shape, position); sf::Vector2f sfmlPos = shape->This.getPosition(); position.x = sfmlPos.x; position.y = sfmlPos.y; return position; } //////////////////////////////////////////////////////////// float sfRectangleShape_getRotation(const sfRectangleShape* shape) { CSFML_CALL_RETURN(shape, getRotation(), 0.f); } //////////////////////////////////////////////////////////// sfVector2f sfRectangleShape_getScale(const sfRectangleShape* shape) { sfVector2f scale = {0, 0}; CSFML_CHECK_RETURN(shape, scale); sf::Vector2f sfmlScale = shape->This.getScale(); scale.x = sfmlScale.x; scale.y = sfmlScale.y; return scale; } //////////////////////////////////////////////////////////// sfVector2f sfRectangleShape_getOrigin(const sfRectangleShape* shape) { sfVector2f origin = {0, 0}; CSFML_CHECK_RETURN(shape, origin); sf::Vector2f sfmlOrigin = shape->This.getOrigin(); origin.x = sfmlOrigin.x; origin.y = sfmlOrigin.y; return origin; } //////////////////////////////////////////////////////////// void sfRectangleShape_move(sfRectangleShape* shape, sfVector2f offset) { CSFML_CALL(shape, move(offset.x, offset.y)); } //////////////////////////////////////////////////////////// void sfRectangleShape_rotate(sfRectangleShape* shape, float angle) { CSFML_CALL(shape, rotate(angle)); } //////////////////////////////////////////////////////////// void sfRectangleShape_scale(sfRectangleShape* shape, sfVector2f factors) { CSFML_CALL(shape, scale(factors.x, factors.y)); } //////////////////////////////////////////////////////////// sfTransform sfRectangleShape_getTransform(const sfRectangleShape* shape) { CSFML_CHECK_RETURN(shape, sfTransform_Identity); shape->Transform = convertTransform(shape->This.getTransform()); return shape->Transform; } //////////////////////////////////////////////////////////// sfTransform sfRectangleShape_getInverseTransform(const sfRectangleShape* shape) { CSFML_CHECK_RETURN(shape, sfTransform_Identity); shape->InverseTransform = convertTransform(shape->This.getInverseTransform()); return shape->InverseTransform; } //////////////////////////////////////////////////////////// void sfRectangleShape_setTexture(sfRectangleShape* shape, const sfTexture* texture, sfBool resetRect) { CSFML_CALL(shape, setTexture(texture ? texture->This : NULL, resetRect == sfTrue)); shape->Texture = texture; } //////////////////////////////////////////////////////////// void sfRectangleShape_setTextureRect(sfRectangleShape* shape, sfIntRect rect) { CSFML_CALL(shape, setTextureRect(sf::IntRect(rect.left, rect.top, rect.width, rect.height))); } //////////////////////////////////////////////////////////// void sfRectangleShape_setFillColor(sfRectangleShape* shape, sfColor color) { CSFML_CALL(shape, setFillColor(sf::Color(color.r, color.g, color.b, color.a))); } //////////////////////////////////////////////////////////// void sfRectangleShape_setOutlineColor(sfRectangleShape* shape, sfColor color) { CSFML_CALL(shape, setOutlineColor(sf::Color(color.r, color.g, color.b, color.a))); } //////////////////////////////////////////////////////////// void sfRectangleShape_setOutlineThickness(sfRectangleShape* shape, float thickness) { CSFML_CALL(shape, setOutlineThickness(thickness)); } //////////////////////////////////////////////////////////// const sfTexture* sfRectangleShape_getTexture(const sfRectangleShape* shape) { CSFML_CHECK_RETURN(shape, NULL); return shape->Texture; } //////////////////////////////////////////////////////////// sfIntRect sfRectangleShape_getTextureRect(const sfRectangleShape* shape) { sfIntRect rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(shape, rect); sf::IntRect sfmlRect = shape->This.getTextureRect(); rect.left = sfmlRect.left; rect.top = sfmlRect.top; rect.width = sfmlRect.width; rect.height = sfmlRect.height; return rect; } //////////////////////////////////////////////////////////// sfColor sfRectangleShape_getFillColor(const sfRectangleShape* shape) { sfColor color = {0, 0, 0, 0}; CSFML_CHECK_RETURN(shape, color); sf::Color sfmlColor = shape->This.getFillColor(); color.r = sfmlColor.r; color.g = sfmlColor.g; color.b = sfmlColor.b; color.a = sfmlColor.a; return color; } //////////////////////////////////////////////////////////// sfColor sfRectangleShape_getOutlineColor(const sfRectangleShape* shape) { sfColor color = {0, 0, 0, 0}; CSFML_CHECK_RETURN(shape, color); sf::Color sfmlColor = shape->This.getOutlineColor(); color.r = sfmlColor.r; color.g = sfmlColor.g; color.b = sfmlColor.b; color.a = sfmlColor.a; return color; } //////////////////////////////////////////////////////////// float sfRectangleShape_getOutlineThickness(const sfRectangleShape* shape) { CSFML_CALL_RETURN(shape, getOutlineThickness(), 0.f); } //////////////////////////////////////////////////////////// size_t sfRectangleShape_getPointCount(const sfRectangleShape* shape) { CSFML_CALL_RETURN(shape, getPointCount(), 0); } //////////////////////////////////////////////////////////// sfVector2f sfRectangleShape_getPoint(const sfRectangleShape* shape, size_t index) { sfVector2f point = {0, 0}; CSFML_CHECK_RETURN(shape, point); sf::Vector2f sfmlPoint = shape->This.getPoint(index); point.x = sfmlPoint.x; point.y = sfmlPoint.y; return point; } //////////////////////////////////////////////////////////// void sfRectangleShape_setSize(sfRectangleShape* shape, sfVector2f size) { CSFML_CALL(shape, setSize(sf::Vector2f(size.x, size.y))); } //////////////////////////////////////////////////////////// sfVector2f sfRectangleShape_getSize(const sfRectangleShape* shape) { sfVector2f size = {0, 0}; CSFML_CHECK_RETURN(shape, size); sf::Vector2f sfmlSize = shape->This.getSize(); size.x = sfmlSize.x; size.y = sfmlSize.y; return size; } //////////////////////////////////////////////////////////// sfFloatRect sfRectangleShape_getLocalBounds(const sfRectangleShape* shape) { sfFloatRect rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(shape, rect); sf::FloatRect sfmlRect = shape->This.getLocalBounds(); rect.left = sfmlRect.left; rect.top = sfmlRect.top; rect.width = sfmlRect.width; rect.height = sfmlRect.height; return rect; } //////////////////////////////////////////////////////////// sfFloatRect sfRectangleShape_getGlobalBounds(const sfRectangleShape* shape) { sfFloatRect rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(shape, rect); sf::FloatRect sfmlRect = shape->This.getGlobalBounds(); rect.left = sfmlRect.left; rect.top = sfmlRect.top; rect.width = sfmlRect.width; rect.height = sfmlRect.height; return rect; } CSFML-2.4/src/SFML/Graphics/RectangleShapeStruct.h000066400000000000000000000034211301071240500215470ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_RECTANGLESHAPESTRUCT_H #define SFML_RECTANGLESHAPESTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// // Internal structure of sfRectangleShape //////////////////////////////////////////////////////////// struct sfRectangleShape { sf::RectangleShape This; const sfTexture* Texture; mutable sfTransform Transform; mutable sfTransform InverseTransform; }; #endif // SFML_RECTANGLESHAPESTRUCT_H CSFML-2.4/src/SFML/Graphics/RenderTexture.cpp000066400000000000000000000232071301071240500206140ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include #include #include #include #include #include //////////////////////////////////////////////////////////// sfRenderTexture* sfRenderTexture_create(unsigned int width, unsigned int height, sfBool depthBuffer) { sfRenderTexture* renderTexture = new sfRenderTexture; renderTexture->This.create(width, height, depthBuffer == sfTrue); renderTexture->Target = new sfTexture(const_cast(&renderTexture->This.getTexture())); renderTexture->DefaultView.This = renderTexture->This.getDefaultView(); renderTexture->CurrentView.This = renderTexture->This.getView(); return renderTexture; } //////////////////////////////////////////////////////////// void sfRenderTexture_destroy(sfRenderTexture* renderTexture) { delete renderTexture->Target; delete renderTexture; } //////////////////////////////////////////////////////////// sfVector2u sfRenderTexture_getSize(const sfRenderTexture* renderTexture) { sfVector2u size = {0, 0}; CSFML_CHECK_RETURN(renderTexture, size); sf::Vector2u sfmlSize = renderTexture->This.getSize(); size.x = sfmlSize.x; size.y = sfmlSize.y; return size; } //////////////////////////////////////////////////////////// sfBool sfRenderTexture_setActive(sfRenderTexture* renderTexture, sfBool active) { CSFML_CALL_RETURN(renderTexture, setActive(active == sfTrue), sfFalse); } //////////////////////////////////////////////////////////// void sfRenderTexture_display(sfRenderTexture* renderTexture) { CSFML_CALL(renderTexture, display()); } //////////////////////////////////////////////////////////// void sfRenderTexture_clear(sfRenderTexture* renderTexture, sfColor color) { sf::Color SFMLColor(color.r, color.g, color.b, color.a); CSFML_CALL(renderTexture, clear(SFMLColor)); } //////////////////////////////////////////////////////////// void sfRenderTexture_setView(sfRenderTexture* renderTexture, const sfView* view) { CSFML_CHECK(view); CSFML_CALL(renderTexture, setView(view->This)); renderTexture->CurrentView.This = view->This; } //////////////////////////////////////////////////////////// const sfView* sfRenderTexture_getView(const sfRenderTexture* renderTexture) { CSFML_CHECK_RETURN(renderTexture, NULL); return &renderTexture->CurrentView; } //////////////////////////////////////////////////////////// const sfView* sfRenderTexture_getDefaultView(const sfRenderTexture* renderTexture) { CSFML_CHECK_RETURN(renderTexture, NULL); return &renderTexture->DefaultView; } //////////////////////////////////////////////////////////// sfIntRect sfRenderTexture_getViewport(const sfRenderTexture* renderTexture, const sfView* view) { sfIntRect rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(view, rect); CSFML_CHECK_RETURN(renderTexture, rect); sf::IntRect SFMLrect = renderTexture->This.getViewport(view->This); rect.left = SFMLrect.left; rect.top = SFMLrect.top; rect.width = SFMLrect.width; rect.height = SFMLrect.height; return rect; } //////////////////////////////////////////////////////////// sfVector2f sfRenderTexture_mapPixelToCoords(const sfRenderTexture* renderTexture, sfVector2i point, const sfView* targetView) { sfVector2f result = {0, 0}; CSFML_CHECK_RETURN(renderTexture, result); sf::Vector2f sfmlPoint; if (targetView) sfmlPoint = renderTexture->This.mapPixelToCoords(sf::Vector2i(point.x, point.y), targetView->This); else sfmlPoint = renderTexture->This.mapPixelToCoords(sf::Vector2i(point.x, point.y)); result.x = sfmlPoint.x; result.y = sfmlPoint.y; return result; } //////////////////////////////////////////////////////////// sfVector2i sfRenderTexture_mapCoordsToPixel(const sfRenderTexture* renderTexture, sfVector2f point, const sfView* targetView) { sfVector2i result = {0, 0}; CSFML_CHECK_RETURN(renderTexture, result); sf::Vector2i sfmlPoint; if (targetView) sfmlPoint = renderTexture->This.mapCoordsToPixel(sf::Vector2f(point.x, point.y), targetView->This); else sfmlPoint = renderTexture->This.mapCoordsToPixel(sf::Vector2f(point.x, point.y)); result.x = sfmlPoint.x; result.y = sfmlPoint.y; return result; } //////////////////////////////////////////////////////////// void sfRenderTexture_drawSprite(sfRenderTexture* renderTexture, const sfSprite* object, const sfRenderStates* states) { CSFML_CHECK(object); CSFML_CALL(renderTexture, draw(object->This, convertRenderStates(states))); } void sfRenderTexture_drawText(sfRenderTexture* renderTexture, const sfText* object, const sfRenderStates* states) { CSFML_CHECK(object); CSFML_CALL(renderTexture, draw(object->This, convertRenderStates(states))); } void sfRenderTexture_drawShape(sfRenderTexture* renderTexture, const sfShape* object, const sfRenderStates* states) { CSFML_CHECK(object); CSFML_CALL(renderTexture, draw(object->This, convertRenderStates(states))); } void sfRenderTexture_drawCircleShape(sfRenderTexture* renderTexture, const sfCircleShape* object, const sfRenderStates* states) { CSFML_CHECK(object); CSFML_CALL(renderTexture, draw(object->This, convertRenderStates(states))); } void sfRenderTexture_drawConvexShape(sfRenderTexture* renderTexture, const sfConvexShape* object, const sfRenderStates* states) { CSFML_CHECK(object); CSFML_CALL(renderTexture, draw(object->This, convertRenderStates(states))); } void sfRenderTexture_drawRectangleShape(sfRenderTexture* renderTexture, const sfRectangleShape* object, const sfRenderStates* states) { CSFML_CHECK(object); CSFML_CALL(renderTexture, draw(object->This, convertRenderStates(states))); } void sfRenderTexture_drawVertexArray(sfRenderTexture* renderTexture, const sfVertexArray* object, const sfRenderStates* states) { CSFML_CHECK(object); CSFML_CALL(renderTexture, draw(object->This, convertRenderStates(states))); } //////////////////////////////////////////////////////////// void sfRenderTexture_drawPrimitives(sfRenderTexture* renderTexture, const sfVertex* vertices, size_t vertexCount, sfPrimitiveType type, const sfRenderStates* states) { CSFML_CALL(renderTexture, draw(reinterpret_cast(vertices), vertexCount, static_cast(type), convertRenderStates(states))); } //////////////////////////////////////////////////////////// void sfRenderTexture_pushGLStates(sfRenderTexture* renderTexture) { CSFML_CALL(renderTexture, pushGLStates()); } //////////////////////////////////////////////////////////// void sfRenderTexture_popGLStates(sfRenderTexture* renderTexture) { CSFML_CALL(renderTexture, popGLStates()); } //////////////////////////////////////////////////////////// void sfRenderTexture_resetGLStates(sfRenderTexture* renderTexture) { CSFML_CALL(renderTexture, resetGLStates()); } //////////////////////////////////////////////////////////// const sfTexture* sfRenderTexture_getTexture(const sfRenderTexture* renderTexture) { CSFML_CHECK_RETURN(renderTexture, NULL); return renderTexture->Target; } //////////////////////////////////////////////////////////// void sfRenderTexture_setSmooth(sfRenderTexture* renderTexture, sfBool smooth) { CSFML_CALL(renderTexture, setSmooth(smooth == sfTrue)); } //////////////////////////////////////////////////////////// sfBool sfRenderTexture_isSmooth(const sfRenderTexture* renderTexture) { CSFML_CALL_RETURN(renderTexture, isSmooth(), sfFalse); } //////////////////////////////////////////////////////////// void sfRenderTexture_setRepeated(sfRenderTexture* renderTexture, sfBool repeated) { CSFML_CALL(renderTexture, setRepeated(repeated == sfTrue)); } //////////////////////////////////////////////////////////// sfBool sfRenderTexture_isRepeated(const sfRenderTexture* renderTexture) { CSFML_CALL_RETURN(renderTexture, isRepeated(), sfFalse); } //////////////////////////////////////////////////////////// sfBool sfRenderTexture_generateMipmap(sfRenderTexture* renderTexture) { CSFML_CALL_RETURN(renderTexture, generateMipmap(), sfFalse); } CSFML-2.4/src/SFML/Graphics/RenderTextureStruct.h000066400000000000000000000034001301071240500214570ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_RENDERTEXTURESTRUCT_H #define SFML_RENDERTEXTURESTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// // Internal structure of sfRenderTexture //////////////////////////////////////////////////////////// struct sfRenderTexture { sf::RenderTexture This; const sfTexture* Target; sfView DefaultView; sfView CurrentView; }; #endif // SFML_RENDERTEXTURESTRUCT_H CSFML-2.4/src/SFML/Graphics/RenderWindow.cpp000066400000000000000000000412511301071240500204220ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //////////////////////////////////////////////////////////// sfRenderWindow* sfRenderWindow_create(sfVideoMode mode, const char* title, sfUint32 style, const sfContextSettings* settings) { // Convert video mode sf::VideoMode videoMode(mode.width, mode.height, mode.bitsPerPixel); // Convert context settings sf::ContextSettings params; if (settings) { priv::sfContextSettings_writeToCpp(*settings, params); } // Create the window sfRenderWindow* renderWindow = new sfRenderWindow; renderWindow->This.create(videoMode, title, style, params); renderWindow->DefaultView.This = renderWindow->This.getDefaultView(); renderWindow->CurrentView.This = renderWindow->This.getView(); return renderWindow; } //////////////////////////////////////////////////////////// sfRenderWindow* sfRenderWindow_createUnicode(sfVideoMode mode, const sfUint32* title, sfUint32 style, const sfContextSettings* settings) { // Convert video mode sf::VideoMode videoMode(mode.width, mode.height, mode.bitsPerPixel); // Convert context settings sf::ContextSettings params; if (settings) { priv::sfContextSettings_writeToCpp(*settings, params); } // Create the window sfRenderWindow* renderWindow = new sfRenderWindow; renderWindow->This.create(videoMode, title, style, params); renderWindow->DefaultView.This = renderWindow->This.getDefaultView(); renderWindow->CurrentView.This = renderWindow->This.getView(); return renderWindow; } //////////////////////////////////////////////////////////// sfRenderWindow* sfRenderWindow_createFromHandle(sfWindowHandle handle, const sfContextSettings* settings) { // Convert context settings sf::ContextSettings params; if (settings) { priv::sfContextSettings_writeToCpp(*settings, params); } // Create the window sfRenderWindow* renderWindow = new sfRenderWindow; renderWindow->This.create(handle, params); renderWindow->DefaultView.This = renderWindow->This.getDefaultView(); renderWindow->CurrentView.This = renderWindow->This.getView(); return renderWindow; } //////////////////////////////////////////////////////////// void sfRenderWindow_destroy(sfRenderWindow* renderWindow) { delete renderWindow; } //////////////////////////////////////////////////////////// void sfRenderWindow_close(sfRenderWindow* renderWindow) { CSFML_CALL(renderWindow, close()); } //////////////////////////////////////////////////////////// sfBool sfRenderWindow_isOpen(const sfRenderWindow* renderWindow) { CSFML_CALL_RETURN(renderWindow, isOpen(), sfFalse); } //////////////////////////////////////////////////////////// sfContextSettings sfRenderWindow_getSettings(const sfRenderWindow* renderWindow) { sfContextSettings settings = priv::sfContextSettings_null(); CSFML_CHECK_RETURN(renderWindow, settings); const sf::ContextSettings& params = renderWindow->This.getSettings(); priv::sfContextSettings_readFromCpp(params, settings); return settings; } //////////////////////////////////////////////////////////// sfBool sfRenderWindow_pollEvent(sfRenderWindow* renderWindow, sfEvent* event) { CSFML_CHECK_RETURN(renderWindow, sfFalse); CSFML_CHECK_RETURN(event, sfFalse); // Get the event sf::Event SFMLEvent; sfBool ret = renderWindow->This.pollEvent(SFMLEvent); // No event, return if (!ret) return sfFalse; // Convert the sf::Event event to a sfEvent convertEvent(SFMLEvent, event); return sfTrue; } //////////////////////////////////////////////////////////// sfBool sfRenderWindow_waitEvent(sfRenderWindow* renderWindow, sfEvent* event) { CSFML_CHECK_RETURN(renderWindow, sfFalse); CSFML_CHECK_RETURN(event, sfFalse); // Get the event sf::Event SFMLEvent; sfBool ret = renderWindow->This.waitEvent(SFMLEvent); // Error, return if (!ret) return sfFalse; // Convert the sf::Event event to a sfEvent convertEvent(SFMLEvent, event); return sfTrue; } //////////////////////////////////////////////////////////// sfVector2i sfRenderWindow_getPosition(const sfRenderWindow* renderWindow) { sfVector2i position = {0, 0}; CSFML_CHECK_RETURN(renderWindow, position); sf::Vector2i sfmlPos = renderWindow->This.getPosition(); position.x = sfmlPos.x; position.y = sfmlPos.y; return position; } //////////////////////////////////////////////////////////// void sfRenderWindow_setPosition(sfRenderWindow* renderWindow, sfVector2i position) { CSFML_CALL(renderWindow, setPosition(sf::Vector2i(position.x, position.y))); } //////////////////////////////////////////////////////////// sfVector2u sfRenderWindow_getSize(const sfRenderWindow* renderWindow) { sfVector2u size = {0, 0}; CSFML_CHECK_RETURN(renderWindow, size); sf::Vector2u sfmlSize = renderWindow->This.getSize(); size.x = sfmlSize.x; size.y = sfmlSize.y; return size; } //////////////////////////////////////////////////////////// void sfRenderWindow_setSize(sfRenderWindow* renderWindow, sfVector2u size) { CSFML_CALL(renderWindow, setSize(sf::Vector2u(size.x, size.y))); } //////////////////////////////////////////////////////////// void sfRenderWindow_setTitle(sfRenderWindow* renderWindow, const char* title) { CSFML_CALL(renderWindow, setTitle(title)); } //////////////////////////////////////////////////////////// void sfRenderWindow_setUnicodeTitle(sfRenderWindow* renderWindow, const sfUint32* title) { CSFML_CALL(renderWindow, setTitle(title)); } //////////////////////////////////////////////////////////// void sfRenderWindow_setIcon(sfRenderWindow* renderWindow, unsigned int width, unsigned int height, const sfUint8* pixels) { CSFML_CALL(renderWindow, setIcon(width, height, pixels)); } //////////////////////////////////////////////////////////// void sfRenderWindow_setVisible(sfRenderWindow* renderWindow, sfBool visible) { CSFML_CALL(renderWindow, setVisible(visible == sfTrue)); } //////////////////////////////////////////////////////////// void sfRenderWindow_setVerticalSyncEnabled(sfRenderWindow* renderWindow, sfBool enabled) { CSFML_CALL(renderWindow, setVerticalSyncEnabled(enabled == sfTrue)); } //////////////////////////////////////////////////////////// void sfRenderWindow_setMouseCursorVisible(sfRenderWindow* renderWindow, sfBool visible) { CSFML_CALL(renderWindow, setMouseCursorVisible(visible == sfTrue)); } //////////////////////////////////////////////////////////// void sfRenderWindow_setMouseCursorGrabbed(sfRenderWindow* renderWindow, sfBool grabbed) { CSFML_CALL(renderWindow, setMouseCursorGrabbed(grabbed == sfTrue)); } //////////////////////////////////////////////////////////// void sfRenderWindow_setKeyRepeatEnabled(sfRenderWindow* renderWindow, sfBool enabled) { CSFML_CALL(renderWindow, setKeyRepeatEnabled(enabled == sfTrue)); } //////////////////////////////////////////////////////////// sfBool sfRenderWindow_setActive(sfRenderWindow* renderWindow, sfBool active) { CSFML_CALL_RETURN(renderWindow, setActive(active == sfTrue), sfFalse); } //////////////////////////////////////////////////////////// void sfRenderWindow_requestFocus(sfRenderWindow* renderWindow) { CSFML_CALL(renderWindow, requestFocus()); } //////////////////////////////////////////////////////////// sfBool sfRenderWindow_hasFocus(const sfRenderWindow* renderWindow) { CSFML_CALL_RETURN(renderWindow, hasFocus(), sfFalse); } //////////////////////////////////////////////////////////// void sfRenderWindow_display(sfRenderWindow* renderWindow) { CSFML_CALL(renderWindow, display()); } //////////////////////////////////////////////////////////// void sfRenderWindow_setFramerateLimit(sfRenderWindow* renderWindow, unsigned int limit) { CSFML_CALL(renderWindow, setFramerateLimit(limit)); } //////////////////////////////////////////////////////////// void sfRenderWindow_setJoystickThreshold(sfRenderWindow* renderWindow, float threshold) { CSFML_CALL(renderWindow, setJoystickThreshold(threshold)); } //////////////////////////////////////////////////////////// sfWindowHandle sfRenderWindow_getSystemHandle(const sfRenderWindow* renderWindow) { CSFML_CHECK_RETURN(renderWindow, 0); return (sfWindowHandle)renderWindow->This.getSystemHandle(); } //////////////////////////////////////////////////////////// void sfRenderWindow_clear(sfRenderWindow* renderWindow, sfColor color) { sf::Color SFMLColor(color.r, color.g, color.b, color.a); CSFML_CALL(renderWindow, clear(SFMLColor)); } //////////////////////////////////////////////////////////// void sfRenderWindow_setView(sfRenderWindow* renderWindow, const sfView* view) { CSFML_CHECK(view); CSFML_CALL(renderWindow, setView(view->This)); renderWindow->CurrentView.This = view->This; } //////////////////////////////////////////////////////////// const sfView* sfRenderWindow_getView(const sfRenderWindow* renderWindow) { CSFML_CHECK_RETURN(renderWindow, NULL); return &renderWindow->CurrentView; } //////////////////////////////////////////////////////////// const sfView* sfRenderWindow_getDefaultView(const sfRenderWindow* renderWindow) { CSFML_CHECK_RETURN(renderWindow, NULL); return &renderWindow->DefaultView; } //////////////////////////////////////////////////////////// sfIntRect sfRenderWindow_getViewport(const sfRenderWindow* renderWindow, const sfView* view) { sfIntRect rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(view, rect); CSFML_CHECK_RETURN(renderWindow, rect); sf::IntRect SFMLrect = renderWindow->This.getViewport(view->This); rect.left = SFMLrect.left; rect.top = SFMLrect.top; rect.width = SFMLrect.width; rect.height = SFMLrect.height; return rect; } //////////////////////////////////////////////////////////// sfVector2f sfRenderWindow_mapPixelToCoords(const sfRenderWindow* renderWindow, sfVector2i point, const sfView* targetView) { sfVector2f result = {0, 0}; CSFML_CHECK_RETURN(renderWindow, result); sf::Vector2f sfmlPoint; if (targetView) sfmlPoint = renderWindow->This.mapPixelToCoords(sf::Vector2i(point.x, point.y), targetView->This); else sfmlPoint = renderWindow->This.mapPixelToCoords(sf::Vector2i(point.x, point.y)); result.x = sfmlPoint.x; result.y = sfmlPoint.y; return result; } //////////////////////////////////////////////////////////// sfVector2i sfRenderWindow_mapCoordsToPixel(const sfRenderWindow* renderWindow, sfVector2f point, const sfView* targetView) { sfVector2i result = {0, 0}; CSFML_CHECK_RETURN(renderWindow, result); sf::Vector2i sfmlPoint; if (targetView) sfmlPoint = renderWindow->This.mapCoordsToPixel(sf::Vector2f(point.x, point.y), targetView->This); else sfmlPoint = renderWindow->This.mapCoordsToPixel(sf::Vector2f(point.x, point.y)); result.x = sfmlPoint.x; result.y = sfmlPoint.y; return result; } //////////////////////////////////////////////////////////// void sfRenderWindow_drawSprite(sfRenderWindow* renderWindow, const sfSprite* object, const sfRenderStates* states) { CSFML_CHECK(object); CSFML_CALL(renderWindow, draw(object->This, convertRenderStates(states))); } void sfRenderWindow_drawText(sfRenderWindow* renderWindow, const sfText* object, const sfRenderStates* states) { CSFML_CHECK(object); CSFML_CALL(renderWindow, draw(object->This, convertRenderStates(states))); } void sfRenderWindow_drawShape(sfRenderWindow* renderWindow, const sfShape* object, const sfRenderStates* states) { CSFML_CHECK(object); CSFML_CALL(renderWindow, draw(object->This, convertRenderStates(states))); } void sfRenderWindow_drawCircleShape(sfRenderWindow* renderWindow, const sfCircleShape* object, const sfRenderStates* states) { CSFML_CHECK(object); CSFML_CALL(renderWindow, draw(object->This, convertRenderStates(states))); } void sfRenderWindow_drawConvexShape(sfRenderWindow* renderWindow, const sfConvexShape* object, const sfRenderStates* states) { CSFML_CHECK(object); CSFML_CALL(renderWindow, draw(object->This, convertRenderStates(states))); } void sfRenderWindow_drawRectangleShape(sfRenderWindow* renderWindow, const sfRectangleShape* object, const sfRenderStates* states) { CSFML_CHECK(object); CSFML_CALL(renderWindow, draw(object->This, convertRenderStates(states))); } void sfRenderWindow_drawVertexArray(sfRenderWindow* renderWindow, const sfVertexArray* object, const sfRenderStates* states) { CSFML_CHECK(object); CSFML_CALL(renderWindow, draw(object->This, convertRenderStates(states))); } //////////////////////////////////////////////////////////// void sfRenderWindow_drawPrimitives(sfRenderWindow* renderWindow, const sfVertex* vertices, size_t vertexCount, sfPrimitiveType type, const sfRenderStates* states) { CSFML_CALL(renderWindow, draw(reinterpret_cast(vertices), vertexCount, static_cast(type), convertRenderStates(states))); } //////////////////////////////////////////////////////////// void sfRenderWindow_pushGLStates(sfRenderWindow* renderWindow) { CSFML_CALL(renderWindow, pushGLStates()); } //////////////////////////////////////////////////////////// void sfRenderWindow_popGLStates(sfRenderWindow* renderWindow) { CSFML_CALL(renderWindow, popGLStates()); } //////////////////////////////////////////////////////////// void sfRenderWindow_resetGLStates(sfRenderWindow* renderWindow) { CSFML_CALL(renderWindow, resetGLStates()); } //////////////////////////////////////////////////////////// sfImage* sfRenderWindow_capture(const sfRenderWindow* renderWindow) { CSFML_CHECK_RETURN(renderWindow, NULL); sfImage* image = new sfImage; image->This = renderWindow->This.capture(); return image; } //////////////////////////////////////////////////////////// sfVector2i sfMouse_getPositionRenderWindow(const sfRenderWindow* relativeTo) { sf::Vector2i sfmlPos; if (relativeTo) sfmlPos = sf::Mouse::getPosition(relativeTo->This); else sfmlPos = sf::Mouse::getPosition(); sfVector2i position = {sfmlPos.x, sfmlPos.y}; return position; } //////////////////////////////////////////////////////////// void sfMouse_setPositionRenderWindow(sfVector2i position, const sfRenderWindow* relativeTo) { if (relativeTo) sf::Mouse::setPosition(sf::Vector2i(position.x, position.y), relativeTo->This); else sf::Mouse::setPosition(sf::Vector2i(position.x, position.y)); } //////////////////////////////////////////////////////////// sfVector2i sfTouch_getPositionRenderWindow(unsigned int finger, const sfRenderWindow* relativeTo) { sf::Vector2i sfmlPosition; if (relativeTo) sfmlPosition = sf::Touch::getPosition(finger, relativeTo->This); else sfmlPosition = sf::Touch::getPosition(finger); sfVector2i position = { sfmlPosition.x, sfmlPosition.y }; return position; } CSFML-2.4/src/SFML/Graphics/RenderWindowStruct.h000066400000000000000000000032601301071240500212720ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_RENDERWINDOWSTRUCT_H #define SFML_RENDERWINDOWSTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include //////////////////////////////////////////////////////////// // Internal structure of sfRenderWindow //////////////////////////////////////////////////////////// struct sfRenderWindow { sf::RenderWindow This; sfView DefaultView; sfView CurrentView; }; #endif // SFML_RENDERWINDOWSTRUCT_H CSFML-2.4/src/SFML/Graphics/Shader.cpp000066400000000000000000000345721301071240500172310ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include //////////////////////////////////////////////////////////// sfShader* sfShader_createFromFile(const char* vertexShaderFilename, const char* geometryShaderFilename, const char* fragmentShaderFilename) { bool success = false; sfShader* shader = new sfShader; if (vertexShaderFilename || geometryShaderFilename || fragmentShaderFilename) { if (!geometryShaderFilename) { if (!vertexShaderFilename) { // fragment shader only success = shader->This.loadFromFile(fragmentShaderFilename, sf::Shader::Fragment); } else if (!fragmentShaderFilename) { // vertex shader only success = shader->This.loadFromFile(vertexShaderFilename, sf::Shader::Vertex); } else { // vertex + fragment shaders success = shader->This.loadFromFile(vertexShaderFilename, fragmentShaderFilename); } } else { // vertex + geometry + fragment shaders success = shader->This.loadFromFile(vertexShaderFilename, geometryShaderFilename, fragmentShaderFilename); } } if (!success) { delete shader; shader = NULL; } return shader; } //////////////////////////////////////////////////////////// sfShader* sfShader_createFromMemory(const char* vertexShader, const char* geometryShader, const char* fragmentShader) { bool success = false; sfShader* shader = new sfShader; if (vertexShader || geometryShader || fragmentShader) { if (!geometryShader) { if (!vertexShader) { // fragment shader only success = shader->This.loadFromMemory(fragmentShader, sf::Shader::Fragment); } else if (!fragmentShader) { // vertex shader only success = shader->This.loadFromMemory(vertexShader, sf::Shader::Vertex); } else { // vertex + fragment shaders success = shader->This.loadFromMemory(vertexShader, fragmentShader); } } else { // vertex + geometry + fragment shaders success = shader->This.loadFromMemory(vertexShader, geometryShader, fragmentShader); } } if (!success) { delete shader; shader = NULL; } return shader; } //////////////////////////////////////////////////////////// sfShader* sfShader_createFromStream(sfInputStream* vertexShaderStream, sfInputStream* geometryShaderStream, sfInputStream* fragmentShaderStream) { bool success = false; sfShader* shader = new sfShader; if (vertexShaderStream || geometryShaderStream || fragmentShaderStream) { if (!geometryShaderStream) { if (!vertexShaderStream) { // fragment shader only CallbackStream stream(fragmentShaderStream); success = shader->This.loadFromStream(stream, sf::Shader::Fragment); } else if (!fragmentShaderStream) { // vertex shader only CallbackStream stream(vertexShaderStream); success = shader->This.loadFromStream(stream, sf::Shader::Vertex); } else { // vertex + fragment shaders CallbackStream vertexStream(vertexShaderStream); CallbackStream fragmentStream(fragmentShaderStream); success = shader->This.loadFromStream(vertexStream, fragmentStream); } } else { // vertex + geometry + fragment shaders CallbackStream vertexStream(vertexShaderStream); CallbackStream geometryStream(geometryShaderStream); CallbackStream fragmentStream(fragmentShaderStream); success = shader->This.loadFromStream(vertexStream, geometryStream, fragmentStream); } } if (!success) { delete shader; shader = NULL; } return shader; } //////////////////////////////////////////////////////////// void sfShader_destroy(sfShader* shader) { delete shader; } //////////////////////////////////////////////////////////// void sfShader_setFloatUniform(sfShader* shader, const char* name, float x) { CSFML_CALL(shader, setUniform(name, x)); } //////////////////////////////////////////////////////////// void sfShader_setVec2Uniform(sfShader* shader, const char* name, sfGlslVec2 vector) { CSFML_CALL(shader, setUniform(name, sf::Glsl::Vec2(vector.x, vector.y))); } //////////////////////////////////////////////////////////// void sfShader_setVec3Uniform(sfShader* shader, const char* name, sfGlslVec3 vector) { CSFML_CALL(shader, setUniform(name, sf::Glsl::Vec3(vector.x, vector.y, vector.z))); } //////////////////////////////////////////////////////////// void sfShader_setVec4Uniform(sfShader* shader, const char* name, sfGlslVec4 vector) { CSFML_CALL(shader, setUniform(name, sf::Glsl::Vec4(vector.x, vector.y, vector.z, vector.w))); } //////////////////////////////////////////////////////////// void sfShader_setColorUniform(sfShader* shader, const char* name, sfColor color) { sfGlslVec4 vec4; vec4.x = color.r / 255.f; vec4.y = color.g / 255.f; vec4.z = color.b / 255.f; vec4.w = color.a / 255.f; sfShader_setVec4Uniform(shader, name, vec4); } //////////////////////////////////////////////////////////// void sfShader_setIntUniform(sfShader* shader, const char* name, int x) { CSFML_CALL(shader, setUniform(name, x)); } //////////////////////////////////////////////////////////// void sfShader_setIvec2Uniform(sfShader* shader, const char* name, sfGlslIvec2 vector) { CSFML_CALL(shader, setUniform(name, sf::Glsl::Ivec2(vector.x, vector.y))); } //////////////////////////////////////////////////////////// void sfShader_setIvec3Uniform(sfShader* shader, const char* name, sfGlslIvec3 vector) { CSFML_CALL(shader, setUniform(name, sf::Glsl::Ivec3(vector.x, vector.y, vector.z))); } //////////////////////////////////////////////////////////// void sfShader_setIvec4Uniform(sfShader* shader, const char* name, sfGlslIvec4 vector) { CSFML_CALL(shader, setUniform(name, sf::Glsl::Ivec4(vector.x, vector.y, vector.z, vector.w))); } //////////////////////////////////////////////////////////// void sfShader_setIntColorUniform(sfShader* shader, const char* name, sfColor color) { sfGlslIvec4 ivec4; ivec4.x = (int)color.r; ivec4.y = (int)color.g; ivec4.z = (int)color.b; ivec4.w = (int)color.a; sfShader_setIvec4Uniform(shader, name, ivec4); } //////////////////////////////////////////////////////////// void sfShader_setBoolUniform(sfShader* shader, const char* name, sfBool x) { CSFML_CALL(shader, setUniform(name, x != sfFalse)); } //////////////////////////////////////////////////////////// void sfShader_setBvec2Uniform(sfShader* shader, const char* name, sfGlslBvec2 vector) { CSFML_CALL(shader, setUniform(name, sf::Glsl::Bvec2(vector.x != sfFalse, vector.y != sfFalse))); } //////////////////////////////////////////////////////////// void sfShader_setBvec3Uniform(sfShader* shader, const char* name, sfGlslBvec3 vector) { CSFML_CALL(shader, setUniform(name, sf::Glsl::Bvec3(vector.x != sfFalse, vector.y != sfFalse, vector.z != sfFalse))); } //////////////////////////////////////////////////////////// void sfShader_setBvec4Uniform(sfShader* shader, const char* name, sfGlslBvec4 vector) { CSFML_CALL(shader, setUniform(name, sf::Glsl::Bvec4(vector.x != sfFalse, vector.y != sfFalse, vector.z != sfFalse, vector.w != sfFalse))); } //////////////////////////////////////////////////////////// void sfShader_setMat3Uniform(sfShader* shader, const char* name, const sfGlslMat3* matrix) { CSFML_CALL(shader, setUniform(name, sf::Glsl::Mat3(matrix->array))); } //////////////////////////////////////////////////////////// void sfShader_setMat4Uniform(sfShader* shader, const char* name, const sfGlslMat4* matrix) { CSFML_CALL(shader, setUniform(name, sf::Glsl::Mat4(matrix->array))); } //////////////////////////////////////////////////////////// void sfShader_setTextureUniform(sfShader* shader, const char* name, const sfTexture* texture) { CSFML_CALL(shader, setUniform(name, *texture->This)); } //////////////////////////////////////////////////////////// void sfShader_setCurrentTextureUniform(sfShader* shader, const char* name) { CSFML_CALL(shader, setUniform(name, sf::Shader::CurrentTexture)); } //////////////////////////////////////////////////////////// void sfShader_setFloatUniformArray(sfShader* shader, const char* name, const float* scalarArray, size_t length) { CSFML_CALL(shader, setUniformArray(name, scalarArray, length)); } //////////////////////////////////////////////////////////// void sfShader_setVec2UniformArray(sfShader* shader, const char* name, const sfGlslVec2* vectorArray, size_t length) { CSFML_CALL(shader, setUniformArray(name, reinterpret_cast(vectorArray), length)); } //////////////////////////////////////////////////////////// void sfShader_setVec3UniformArray(sfShader* shader, const char* name, const sfGlslVec3* vectorArray, size_t length) { CSFML_CALL(shader, setUniformArray(name, reinterpret_cast(vectorArray), length)); } //////////////////////////////////////////////////////////// void sfShader_setVec4UniformArray(sfShader* shader, const char* name, const sfGlslVec4* vectorArray, size_t length) { CSFML_CALL(shader, setUniformArray(name, reinterpret_cast(vectorArray), length)); } //////////////////////////////////////////////////////////// void sfShader_setMat3UniformArray(sfShader* shader, const char* name, const sfGlslMat3* matrixArray, size_t length) { CSFML_CALL(shader, setUniformArray(name, reinterpret_cast(matrixArray), length)); } //////////////////////////////////////////////////////////// void sfShader_setMat4UniformArray(sfShader* shader, const char* name, const sfGlslMat4* matrixArray, size_t length) { CSFML_CALL(shader, setUniformArray(name, reinterpret_cast(matrixArray), length)); } //////////////////////////////////////////////////////////// void sfShader_setFloatParameter(sfShader* shader, const char* name, float x) { CSFML_CALL(shader, setParameter(name, x)); } //////////////////////////////////////////////////////////// void sfShader_setFloat2Parameter(sfShader* shader, const char* name, float x, float y) { CSFML_CALL(shader, setParameter(name, x, y)); } //////////////////////////////////////////////////////////// void sfShader_setFloat3Parameter(sfShader* shader, const char* name, float x, float y, float z) { CSFML_CALL(shader, setParameter(name, x, y, z)); } //////////////////////////////////////////////////////////// void sfShader_setFloat4Parameter(sfShader* shader, const char* name, float x, float y, float z, float w) { CSFML_CALL(shader, setParameter(name, x, y, z, w)); } //////////////////////////////////////////////////////////// void sfShader_setVector2Parameter(sfShader* shader, const char* name, sfVector2f vector) { CSFML_CALL(shader, setParameter(name, sf::Vector2f(vector.x, vector.y))); } //////////////////////////////////////////////////////////// void sfShader_setVector3Parameter(sfShader* shader, const char* name, sfVector3f vector) { CSFML_CALL(shader, setParameter(name, sf::Vector3f(vector.x, vector.y, vector.z))); } //////////////////////////////////////////////////////////// void sfShader_setColorParameter(sfShader* shader, const char* name, sfColor color) { CSFML_CALL(shader, setParameter(name, sf::Color(color.r, color.g, color.b, color.a))); } //////////////////////////////////////////////////////////// void sfShader_setTransformParameter(sfShader* shader, const char* name, sfTransform transform) { CSFML_CALL(shader, setParameter(name, convertTransform(transform))); } //////////////////////////////////////////////////////////// void sfShader_setTextureParameter(sfShader* shader, const char* name, const sfTexture* texture) { CSFML_CHECK(texture); CSFML_CALL(shader, setParameter(name,*texture->This)); } //////////////////////////////////////////////////////////// void sfShader_setCurrentTextureParameter(sfShader* shader, const char* name) { CSFML_CALL(shader, setParameter(name, sf::Shader::CurrentTexture)); } //////////////////////////////////////////////////////////// unsigned int sfShader_getNativeHandle(const sfShader* shader) { CSFML_CALL_RETURN(shader, getNativeHandle(), 0); } //////////////////////////////////////////////////////////// void sfShader_bind(const sfShader* shader) { sf::Shader::bind(shader ? &shader->This : NULL); } //////////////////////////////////////////////////////////// sfBool sfShader_isAvailable(void) { return sf::Shader::isAvailable() ? sfTrue : sfFalse; } //////////////////////////////////////////////////////////// sfBool sfShader_isGeometryAvailable(void) { return sf::Shader::isGeometryAvailable() ? sfTrue : sfFalse; } CSFML-2.4/src/SFML/Graphics/ShaderStruct.h000066400000000000000000000030341301071240500200700ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SHADERSTRUCT_H #define SFML_SHADERSTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// // Internal structure of sfShader //////////////////////////////////////////////////////////// struct sfShader { sf::Shader This; }; #endif // SFML_SHADERSTRUCT_H CSFML-2.4/src/SFML/Graphics/Shape.cpp000066400000000000000000000211521301071240500170510ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include //////////////////////////////////////////////////////////// sfShape* sfShape_create(sfShapeGetPointCountCallback getPointCount, sfShapeGetPointCallback getPoint, void* userData) { return new sfShape(getPointCount, getPoint, userData); } //////////////////////////////////////////////////////////// void sfShape_destroy(sfShape* shape) { delete shape; } //////////////////////////////////////////////////////////// void sfShape_setPosition(sfShape* shape, sfVector2f position) { CSFML_CALL(shape, setPosition(position.x, position.y)); } //////////////////////////////////////////////////////////// void sfShape_setRotation(sfShape* shape, float angle) { CSFML_CALL(shape, setRotation(angle)); } //////////////////////////////////////////////////////////// void sfShape_setScale(sfShape* shape, sfVector2f scale) { CSFML_CALL(shape, setScale(scale.x, scale.y)); } //////////////////////////////////////////////////////////// void sfShape_setOrigin(sfShape* shape, sfVector2f origin) { CSFML_CALL(shape, setOrigin(origin.x, origin.y)); } //////////////////////////////////////////////////////////// sfVector2f sfShape_getPosition(const sfShape* shape) { sfVector2f position = {0, 0}; CSFML_CHECK_RETURN(shape, position); sf::Vector2f sfmlPos = shape->This.getPosition(); position.x = sfmlPos.x; position.y = sfmlPos.y; return position; } //////////////////////////////////////////////////////////// float sfShape_getRotation(const sfShape* shape) { CSFML_CALL_RETURN(shape, getRotation(), 0.f); } //////////////////////////////////////////////////////////// sfVector2f sfShape_getScale(const sfShape* shape) { sfVector2f scale = {0, 0}; CSFML_CHECK_RETURN(shape, scale); sf::Vector2f sfmlScale = shape->This.getScale(); scale.x = sfmlScale.x; scale.y = sfmlScale.y; return scale; } //////////////////////////////////////////////////////////// sfVector2f sfShape_getOrigin(const sfShape* shape) { sfVector2f origin = {0, 0}; CSFML_CHECK_RETURN(shape, origin); sf::Vector2f sfmlOrigin = shape->This.getOrigin(); origin.x = sfmlOrigin.x; origin.y = sfmlOrigin.y; return origin; } //////////////////////////////////////////////////////////// void sfShape_move(sfShape* shape, sfVector2f offset) { CSFML_CALL(shape, move(offset.x, offset.y)); } //////////////////////////////////////////////////////////// void sfShape_rotate(sfShape* shape, float angle) { CSFML_CALL(shape, rotate(angle)); } //////////////////////////////////////////////////////////// void sfShape_scale(sfShape* shape, sfVector2f factors) { CSFML_CALL(shape, scale(factors.x, factors.y)); } //////////////////////////////////////////////////////////// sfTransform sfShape_getTransform(const sfShape* shape) { CSFML_CHECK_RETURN(shape, sfTransform_Identity); shape->Transform = convertTransform(shape->This.getTransform()); return shape->Transform; } //////////////////////////////////////////////////////////// sfTransform sfShape_getInverseTransform(const sfShape* shape) { CSFML_CHECK_RETURN(shape, sfTransform_Identity); shape->InverseTransform = convertTransform(shape->This.getInverseTransform()); return shape->InverseTransform; } //////////////////////////////////////////////////////////// void sfShape_setTexture(sfShape* shape, const sfTexture* texture, sfBool resetRect) { CSFML_CALL(shape, setTexture(texture ? texture->This : NULL, resetRect == sfTrue)); shape->Texture = texture; } //////////////////////////////////////////////////////////// void sfShape_setTextureRect(sfShape* shape, sfIntRect rect) { CSFML_CALL(shape, setTextureRect(sf::IntRect(rect.left, rect.top, rect.width, rect.height))); } //////////////////////////////////////////////////////////// void sfShape_setFillColor(sfShape* shape, sfColor color) { CSFML_CALL(shape, setFillColor(sf::Color(color.r, color.g, color.b, color.a))); } //////////////////////////////////////////////////////////// void sfShape_setOutlineColor(sfShape* shape, sfColor color) { CSFML_CALL(shape, setOutlineColor(sf::Color(color.r, color.g, color.b, color.a))); } //////////////////////////////////////////////////////////// void sfShape_setOutlineThickness(sfShape* shape, float thickness) { CSFML_CALL(shape, setOutlineThickness(thickness)); } //////////////////////////////////////////////////////////// const sfTexture* sfShape_getTexture(const sfShape* shape) { CSFML_CHECK_RETURN(shape, NULL); return shape->Texture; } //////////////////////////////////////////////////////////// sfIntRect sfShape_getTextureRect(const sfShape* shape) { sfIntRect rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(shape, rect); sf::IntRect sfmlRect = shape->This.getTextureRect(); rect.left = sfmlRect.left; rect.top = sfmlRect.top; rect.width = sfmlRect.width; rect.height = sfmlRect.height; return rect; } //////////////////////////////////////////////////////////// sfColor sfShape_getFillColor(const sfShape* shape) { sfColor color = {0, 0, 0, 0}; CSFML_CHECK_RETURN(shape, color); sf::Color sfmlColor = shape->This.getFillColor(); color.r = sfmlColor.r; color.g = sfmlColor.g; color.b = sfmlColor.b; color.a = sfmlColor.a; return color; } //////////////////////////////////////////////////////////// sfColor sfShape_getOutlineColor(const sfShape* shape) { sfColor color = {0, 0, 0, 0}; CSFML_CHECK_RETURN(shape, color); sf::Color sfmlColor = shape->This.getOutlineColor(); color.r = sfmlColor.r; color.g = sfmlColor.g; color.b = sfmlColor.b; color.a = sfmlColor.a; return color; } //////////////////////////////////////////////////////////// float sfShape_getOutlineThickness(const sfShape* shape) { CSFML_CALL_RETURN(shape, getOutlineThickness(), 0.f); } //////////////////////////////////////////////////////////// size_t sfShape_getPointCount(const sfShape* shape) { CSFML_CALL_RETURN(shape, getPointCount(), 0); } //////////////////////////////////////////////////////////// sfVector2f sfShape_getPoint(const sfShape* shape, size_t index) { sfVector2f point = {0, 0}; CSFML_CHECK_RETURN(shape, point); sf::Vector2f sfmlPoint = shape->This.getPoint(index); point.x = sfmlPoint.x; point.y = sfmlPoint.y; return point; } //////////////////////////////////////////////////////////// sfFloatRect sfShape_getLocalBounds(const sfShape* shape) { sfFloatRect rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(shape, rect); sf::FloatRect sfmlRect = shape->This.getLocalBounds(); rect.left = sfmlRect.left; rect.top = sfmlRect.top; rect.width = sfmlRect.width; rect.height = sfmlRect.height; return rect; } //////////////////////////////////////////////////////////// sfFloatRect sfShape_getGlobalBounds(const sfShape* shape) { sfFloatRect rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(shape, rect); sf::FloatRect sfmlRect = shape->This.getGlobalBounds(); rect.left = sfmlRect.left; rect.top = sfmlRect.top; rect.width = sfmlRect.width; rect.height = sfmlRect.height; return rect; } //////////////////////////////////////////////////////////// void sfShape_update(sfShape* shape) { CSFML_CALL(shape, update()); } CSFML-2.4/src/SFML/Graphics/ShapeStruct.h000066400000000000000000000057641301071240500177360ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SHAPESTRUCT_H #define SFML_SHAPESTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include //////////////////////////////////////////////////////////// // Helper class implementing the callback forwarding from // C++ to C in sfShape //////////////////////////////////////////////////////////// class sfShapeImpl : public sf::Shape { public : sfShapeImpl(sfShapeGetPointCountCallback getPointCount, sfShapeGetPointCallback getPoint, void* userData) : myGetPointCountCallback(getPointCount), myGetPointCallback (getPoint), myUserData (userData) { } virtual std::size_t getPointCount() const { return myGetPointCountCallback(myUserData); } virtual sf::Vector2f getPoint(std::size_t index) const { sfVector2f point = myGetPointCallback(index, myUserData); return sf::Vector2f(point.x, point.y); } using sf::Shape::update; private: sfShapeGetPointCountCallback myGetPointCountCallback; sfShapeGetPointCallback myGetPointCallback; void* myUserData; }; //////////////////////////////////////////////////////////// // Internal structure of sfShape //////////////////////////////////////////////////////////// struct sfShape { sfShape(sfShapeGetPointCountCallback getPointCount, sfShapeGetPointCallback getPoint, void* userData) : This(getPointCount, getPoint, userData) { } sfShapeImpl This; const sfTexture* Texture; mutable sfTransform Transform; mutable sfTransform InverseTransform; }; #endif // SFML_SHAPESTRUCT_H CSFML-2.4/src/SFML/Graphics/Sprite.cpp000066400000000000000000000164701301071240500172660ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include //////////////////////////////////////////////////////////// sfSprite* sfSprite_create(void) { sfSprite* sprite = new sfSprite; sprite->Texture = NULL; return sprite; } //////////////////////////////////////////////////////////// sfSprite* sfSprite_copy(const sfSprite* sprite) { CSFML_CHECK_RETURN(sprite, NULL); return new sfSprite(*sprite); } //////////////////////////////////////////////////////////// void sfSprite_destroy(sfSprite* sprite) { delete sprite; } //////////////////////////////////////////////////////////// void sfSprite_setPosition(sfSprite* sprite, sfVector2f position) { CSFML_CALL(sprite, setPosition(position.x, position.y)); } //////////////////////////////////////////////////////////// void sfSprite_setRotation(sfSprite* sprite, float angle) { CSFML_CALL(sprite, setRotation(angle)); } //////////////////////////////////////////////////////////// void sfSprite_setScale(sfSprite* sprite, sfVector2f scale) { CSFML_CALL(sprite, setScale(scale.x, scale.y)); } //////////////////////////////////////////////////////////// void sfSprite_setOrigin(sfSprite* sprite, sfVector2f origin) { CSFML_CALL(sprite, setOrigin(origin.x, origin.y)); } //////////////////////////////////////////////////////////// sfVector2f sfSprite_getPosition(const sfSprite* sprite) { sfVector2f position = {0, 0}; CSFML_CHECK_RETURN(sprite, position); sf::Vector2f sfmlPos = sprite->This.getPosition(); position.x = sfmlPos.x; position.y = sfmlPos.y; return position; } //////////////////////////////////////////////////////////// float sfSprite_getRotation(const sfSprite* sprite) { CSFML_CALL_RETURN(sprite, getRotation(), 0.f); } //////////////////////////////////////////////////////////// sfVector2f sfSprite_getScale(const sfSprite* sprite) { sfVector2f scale = {0, 0}; CSFML_CHECK_RETURN(sprite, scale); sf::Vector2f sfmlScale = sprite->This.getScale(); scale.x = sfmlScale.x; scale.y = sfmlScale.y; return scale; } //////////////////////////////////////////////////////////// sfVector2f sfSprite_getOrigin(const sfSprite* sprite) { sfVector2f origin = {0, 0}; CSFML_CHECK_RETURN(sprite, origin); sf::Vector2f sfmlOrigin = sprite->This.getOrigin(); origin.x = sfmlOrigin.x; origin.y = sfmlOrigin.y; return origin; } //////////////////////////////////////////////////////////// void sfSprite_move(sfSprite* sprite, sfVector2f offset) { CSFML_CALL(sprite, move(offset.x, offset.y)); } //////////////////////////////////////////////////////////// void sfSprite_rotate(sfSprite* sprite, float angle) { CSFML_CALL(sprite, rotate(angle)); } //////////////////////////////////////////////////////////// void sfSprite_scale(sfSprite* sprite, sfVector2f factors) { CSFML_CALL(sprite, scale(factors.x, factors.y)); } //////////////////////////////////////////////////////////// sfTransform sfSprite_getTransform(const sfSprite* sprite) { CSFML_CHECK_RETURN(sprite, sfTransform_Identity); sprite->Transform = convertTransform(sprite->This.getTransform()); return sprite->Transform; } //////////////////////////////////////////////////////////// sfTransform sfSprite_getInverseTransform(const sfSprite* sprite) { CSFML_CHECK_RETURN(sprite, sfTransform_Identity); sprite->InverseTransform = convertTransform(sprite->This.getInverseTransform()); return sprite->InverseTransform; } //////////////////////////////////////////////////////////// void sfSprite_setTexture(sfSprite* sprite, const sfTexture* texture, sfBool resetRect) { if (texture && texture->This) { CSFML_CALL(sprite, setTexture(*texture->This, resetRect == sfTrue)); sprite->Texture = texture; } } //////////////////////////////////////////////////////////// void sfSprite_setTextureRect(sfSprite* sprite, sfIntRect rectangle) { CSFML_CALL(sprite, setTextureRect(sf::IntRect(rectangle.left, rectangle.top, rectangle.width, rectangle.height))); } //////////////////////////////////////////////////////////// void sfSprite_setColor(sfSprite* sprite, sfColor color) { CSFML_CALL(sprite, setColor(sf::Color(color.r, color.g, color.b, color.a))); } //////////////////////////////////////////////////////////// const sfTexture* sfSprite_getTexture(const sfSprite* sprite) { CSFML_CHECK_RETURN(sprite, NULL); return sprite->Texture; } //////////////////////////////////////////////////////////// sfIntRect sfSprite_getTextureRect(const sfSprite* sprite) { sfIntRect rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(sprite, rect); sf::IntRect sfmlRect = sprite->This.getTextureRect(); rect.left = sfmlRect.left; rect.top = sfmlRect.top; rect.width = sfmlRect.width; rect.height = sfmlRect.height; return rect; } //////////////////////////////////////////////////////////// sfColor sfSprite_getColor(const sfSprite* sprite) { sfColor color = {0, 0, 0, 0}; CSFML_CHECK_RETURN(sprite, color); sf::Color sfmlColor = sprite->This.getColor(); color.r = sfmlColor.r; color.g = sfmlColor.g; color.b = sfmlColor.b; color.a = sfmlColor.a; return color; } //////////////////////////////////////////////////////////// sfFloatRect sfSprite_getLocalBounds(const sfSprite* sprite) { sfFloatRect rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(sprite, rect); sf::FloatRect sfmlRect = sprite->This.getLocalBounds(); rect.left = sfmlRect.left; rect.top = sfmlRect.top; rect.width = sfmlRect.width; rect.height = sfmlRect.height; return rect; } //////////////////////////////////////////////////////////// sfFloatRect sfSprite_getGlobalBounds(const sfSprite* sprite) { sfFloatRect rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(sprite, rect); sf::FloatRect sfmlRect = sprite->This.getGlobalBounds(); rect.left = sfmlRect.left; rect.top = sfmlRect.top; rect.width = sfmlRect.width; rect.height = sfmlRect.height; return rect; } CSFML-2.4/src/SFML/Graphics/SpriteStruct.h000066400000000000000000000033411301071240500201310ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SPRITESTRUCT_H #define SFML_SPRITESTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// // Internal structure of sfSprite //////////////////////////////////////////////////////////// struct sfSprite { sf::Sprite This; const sfTexture* Texture; mutable sfTransform Transform; mutable sfTransform InverseTransform; }; #endif // SFML_SPRITESTRUCT_H CSFML-2.4/src/SFML/Graphics/Text.cpp000066400000000000000000000226121301071240500167370ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include //////////////////////////////////////////////////////////// sfText* sfText_create(void) { sfText* text = new sfText; text->Font = NULL; return text; } //////////////////////////////////////////////////////////// sfText* sfText_copy(const sfText* text) { CSFML_CHECK_RETURN(text, NULL); return new sfText(*text); } //////////////////////////////////////////////////////////// void sfText_destroy(sfText* text) { delete text; } //////////////////////////////////////////////////////////// void sfText_setPosition(sfText* text, sfVector2f position) { CSFML_CALL(text, setPosition(position.x, position.y)); } //////////////////////////////////////////////////////////// void sfText_setRotation(sfText* text, float angle) { CSFML_CALL(text, setRotation(angle)); } //////////////////////////////////////////////////////////// void sfText_setScale(sfText* text, sfVector2f scale) { CSFML_CALL(text, setScale(scale.x, scale.y)); } //////////////////////////////////////////////////////////// void sfText_setOrigin(sfText* text, sfVector2f origin) { CSFML_CALL(text, setOrigin(origin.x, origin.y)); } //////////////////////////////////////////////////////////// sfVector2f sfText_getPosition(const sfText* text) { sfVector2f position = {0, 0}; CSFML_CHECK_RETURN(text, position); sf::Vector2f sfmlPos = text->This.getPosition(); position.x = sfmlPos.x; position.y = sfmlPos.y; return position; } //////////////////////////////////////////////////////////// float sfText_getRotation(const sfText* text) { CSFML_CALL_RETURN(text, getRotation(), 0.f); } //////////////////////////////////////////////////////////// sfVector2f sfText_getScale(const sfText* text) { sfVector2f scale = {0, 0}; CSFML_CHECK_RETURN(text, scale); sf::Vector2f sfmlScale = text->This.getScale(); scale.x = sfmlScale.x; scale.y = sfmlScale.y; return scale; } //////////////////////////////////////////////////////////// sfVector2f sfText_getOrigin(const sfText* text) { sfVector2f origin = {0, 0}; CSFML_CHECK_RETURN(text, origin); sf::Vector2f sfmlOrigin = text->This.getOrigin(); origin.x = sfmlOrigin.x; origin.y = sfmlOrigin.y; return origin; } //////////////////////////////////////////////////////////// void sfText_move(sfText* text, sfVector2f offset) { CSFML_CALL(text, move(offset.x, offset.y)); } //////////////////////////////////////////////////////////// void sfText_rotate(sfText* text, float angle) { CSFML_CALL(text, rotate(angle)); } //////////////////////////////////////////////////////////// void sfText_scale(sfText* text, sfVector2f factors) { CSFML_CALL(text, scale(factors.x, factors.y)); } //////////////////////////////////////////////////////////// sfTransform sfText_getTransform(const sfText* text) { CSFML_CHECK_RETURN(text, sfTransform_Identity); text->Transform = convertTransform(text->This.getTransform()); return text->Transform; } //////////////////////////////////////////////////////////// sfTransform sfText_getInverseTransform(const sfText* text) { CSFML_CHECK_RETURN(text, sfTransform_Identity); text->InverseTransform = convertTransform(text->This.getInverseTransform()); return text->InverseTransform; } //////////////////////////////////////////////////////////// void sfText_setString(sfText* text, const char* string) { CSFML_CALL(text, setString(string)); } //////////////////////////////////////////////////////////// void sfText_setUnicodeString(sfText* text, const sfUint32* string) { sf::String UTF32Text = string; CSFML_CALL(text, setString(UTF32Text)); } //////////////////////////////////////////////////////////// void sfText_setFont(sfText* text, const sfFont* font) { CSFML_CHECK(font); CSFML_CALL(text, setFont(font->This)); text->Font = font; } //////////////////////////////////////////////////////////// void sfText_setCharacterSize(sfText* text, unsigned int size) { CSFML_CALL(text, setCharacterSize(size)); } //////////////////////////////////////////////////////////// void sfText_setStyle(sfText* text, sfUint32 style) { CSFML_CALL(text, setStyle(style)); } //////////////////////////////////////////////////////////// void sfText_setColor(sfText* text, sfColor color) { sfText_setFillColor(text, color); } //////////////////////////////////////////////////////////// void sfText_setFillColor(sfText* text, sfColor color) { CSFML_CALL(text, setFillColor(sf::Color(color.r, color.g, color.b, color.a))); } //////////////////////////////////////////////////////////// void sfText_setOutlineColor(sfText* text, sfColor color) { CSFML_CALL(text, setOutlineColor(sf::Color(color.r, color.g, color.b, color.a))); } //////////////////////////////////////////////////////////// void sfText_setOutlineThickness(sfText* text, float thickness) { CSFML_CALL(text, setOutlineThickness(thickness)); } //////////////////////////////////////////////////////////// const char* sfText_getString(const sfText* text) { CSFML_CHECK_RETURN(text, NULL); text->String = text->This.getString().toAnsiString(); return text->String.c_str(); } //////////////////////////////////////////////////////////// const sfUint32* sfText_getUnicodeString(const sfText* text) { CSFML_CHECK_RETURN(text, NULL); return text->This.getString().getData(); } //////////////////////////////////////////////////////////// const sfFont* sfText_getFont(const sfText* text) { CSFML_CHECK_RETURN(text, NULL); return text->Font; } //////////////////////////////////////////////////////////// unsigned int sfText_getCharacterSize(const sfText* text) { CSFML_CALL_RETURN(text, getCharacterSize(), 0); } //////////////////////////////////////////////////////////// sfUint32 sfText_getStyle(const sfText* text) { CSFML_CALL_RETURN(text, getStyle(), 0); } //////////////////////////////////////////////////////////// sfColor sfText_getColor(const sfText* text) { return sfText_getFillColor(text); } //////////////////////////////////////////////////////////// sfColor sfText_getFillColor(const sfText* text) { sfColor color = {0, 0, 0, 0}; CSFML_CHECK_RETURN(text, color); sf::Color sfmlColor = text->This.getFillColor(); color.r = sfmlColor.r; color.g = sfmlColor.g; color.b = sfmlColor.b; color.a = sfmlColor.a; return color; } //////////////////////////////////////////////////////////// sfColor sfText_getOutlineColor(const sfText* text) { sfColor color = { 0, 0, 0, 0 }; CSFML_CHECK_RETURN(text, color); sf::Color sfmlColor = text->This.getOutlineColor(); color.r = sfmlColor.r; color.g = sfmlColor.g; color.b = sfmlColor.b; color.a = sfmlColor.a; return color; } //////////////////////////////////////////////////////////// float sfText_getOutlineThickness(const sfText* text) { CSFML_CALL_RETURN(text, getOutlineThickness(), 0.f); } //////////////////////////////////////////////////////////// sfVector2f sfText_findCharacterPos(const sfText* text, size_t index) { sfVector2f position = {0, 0}; CSFML_CHECK_RETURN(text, position); sf::Vector2f sfmlPos = text->This.findCharacterPos(index); position.x = sfmlPos.x; position.y = sfmlPos.y; return position; } //////////////////////////////////////////////////////////// sfFloatRect sfText_getLocalBounds(const sfText* text) { sfFloatRect rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(text, rect); sf::FloatRect sfmlRect = text->This.getLocalBounds(); rect.left = sfmlRect.left; rect.top = sfmlRect.top; rect.width = sfmlRect.width; rect.height = sfmlRect.height; return rect; } //////////////////////////////////////////////////////////// sfFloatRect sfText_getGlobalBounds(const sfText* text) { sfFloatRect rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(text, rect); sf::FloatRect sfmlRect = text->This.getGlobalBounds(); rect.left = sfmlRect.left; rect.top = sfmlRect.top; rect.width = sfmlRect.width; rect.height = sfmlRect.height; return rect; } CSFML-2.4/src/SFML/Graphics/TextStruct.h000066400000000000000000000034411301071240500176100ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_TEXTSTRUCT_H #define SFML_TEXTSTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include //////////////////////////////////////////////////////////// // Internal structure of sfText //////////////////////////////////////////////////////////// struct sfText { sf::Text This; const sfFont* Font; mutable std::string String; mutable sfTransform Transform; mutable sfTransform InverseTransform; }; #endif // SFML_TEXTSTRUCT_H CSFML-2.4/src/SFML/Graphics/Texture.cpp000066400000000000000000000167621301071240500174640ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include #include //////////////////////////////////////////////////////////// sfTexture* sfTexture_create(unsigned int width, unsigned int height) { sfTexture* texture = new sfTexture; if (!texture->This->create(width, height)) { delete texture; texture = NULL; } return texture; } //////////////////////////////////////////////////////////// sfTexture* sfTexture_createFromFile(const char* filename, const sfIntRect* area) { sfTexture* texture = new sfTexture; sf::IntRect rect; if (area) rect = sf::IntRect(area->left, area->top, area->width, area->height); if (!texture->This->loadFromFile(filename, rect)) { delete texture; texture = NULL; } return texture; } //////////////////////////////////////////////////////////// sfTexture* sfTexture_createFromMemory(const void* data, size_t sizeInBytes, const sfIntRect* area) { sfTexture* texture = new sfTexture; sf::IntRect rect; if (area) rect = sf::IntRect(area->left, area->top, area->width, area->height); if (!texture->This->loadFromMemory(data, sizeInBytes, rect)) { delete texture; texture = NULL; } return texture; } //////////////////////////////////////////////////////////// sfTexture* sfTexture_createFromStream(sfInputStream* stream, const sfIntRect* area) { CSFML_CHECK_RETURN(stream, NULL); sfTexture* texture = new sfTexture; sf::IntRect rect; if (area) rect = sf::IntRect(area->left, area->top, area->width, area->height); CallbackStream sfmlStream(stream); if (!texture->This->loadFromStream(sfmlStream, rect)) { delete texture; texture = NULL; } return texture; } //////////////////////////////////////////////////////////// sfTexture* sfTexture_createFromImage(const sfImage* image, const sfIntRect* area) { CSFML_CHECK_RETURN(image, NULL); sfTexture* texture = new sfTexture; sf::IntRect rect; if (area) rect = sf::IntRect(area->left, area->top, area->width, area->height); if (!texture->This->loadFromImage(image->This, rect)) { delete texture; texture = NULL; } return texture; } //////////////////////////////////////////////////////////// sfTexture* sfTexture_copy(const sfTexture* texture) { CSFML_CHECK_RETURN(texture, NULL); return new sfTexture(*texture); } //////////////////////////////////////////////////////////// void sfTexture_destroy(sfTexture* texture) { delete texture; } //////////////////////////////////////////////////////////// sfVector2u sfTexture_getSize(const sfTexture* texture) { sfVector2u size = {0, 0}; CSFML_CHECK_RETURN(texture, size); sf::Vector2u sfmlSize = texture->This->getSize(); size.x = sfmlSize.x; size.y = sfmlSize.y; return size; } //////////////////////////////////////////////////////////// sfImage* sfTexture_copyToImage(const sfTexture* texture) { CSFML_CHECK_RETURN(texture, NULL); CSFML_CHECK_RETURN(texture->This, NULL); sfImage* image = new sfImage; image->This = texture->This->copyToImage(); return image; } //////////////////////////////////////////////////////////// void sfTexture_updateFromPixels(sfTexture* texture, const sfUint8* pixels, unsigned int width, unsigned int height, unsigned int x, unsigned int y) { CSFML_CALL_PTR(texture, update(pixels, width, height, x, y)); } //////////////////////////////////////////////////////////// void sfTexture_updateFromImage(sfTexture* texture, const sfImage* image, unsigned int x, unsigned int y) { CSFML_CHECK(image); CSFML_CALL_PTR(texture, update(image->This, x, y)); } //////////////////////////////////////////////////////////// void sfTexture_updateFromWindow(sfTexture* texture, const sfWindow* window, unsigned int x, unsigned int y) { CSFML_CHECK(window); CSFML_CALL_PTR(texture, update(window->This, x, y)); } //////////////////////////////////////////////////////////// void sfTexture_updateFromRenderWindow(sfTexture* texture, const sfRenderWindow* renderWindow, unsigned int x, unsigned int y) { CSFML_CHECK(renderWindow); CSFML_CALL_PTR(texture, update(renderWindow->This, x, y)); } //////////////////////////////////////////////////////////// void sfTexture_setSmooth(sfTexture* texture, sfBool smooth) { CSFML_CALL_PTR(texture, setSmooth(smooth == sfTrue)); } //////////////////////////////////////////////////////////// sfBool sfTexture_isSmooth(const sfTexture* texture) { CSFML_CHECK_RETURN(texture, sfFalse); CSFML_CHECK_RETURN(texture->This, sfFalse); return texture->This->isSmooth(); } //////////////////////////////////////////////////////////// void sfTexture_setSrgb(sfTexture* texture, sfBool sRgb) { CSFML_CALL_PTR(texture, setSrgb(sRgb == sfTrue)); } //////////////////////////////////////////////////////////// sfBool sfTexture_isSrgb(const sfTexture* texture) { CSFML_CALL_PTR_RETURN(texture, isSrgb(), sfFalse); } //////////////////////////////////////////////////////////// void sfTexture_setRepeated(sfTexture* texture, sfBool repeated) { CSFML_CALL_PTR(texture, setRepeated(repeated == sfTrue)); } //////////////////////////////////////////////////////////// sfBool sfTexture_isRepeated(const sfTexture* texture) { CSFML_CHECK_RETURN(texture, sfFalse); CSFML_CHECK_RETURN(texture->This, sfFalse); return texture->This->isRepeated(); } //////////////////////////////////////////////////////////// sfBool sfTexture_generateMipmap(sfTexture* texture) { CSFML_CALL_PTR_RETURN(texture, generateMipmap(), sfFalse); } //////////////////////////////////////////////////////////// unsigned int sfTexture_getNativeHandle(const sfTexture* texture) { CSFML_CALL_PTR_RETURN(texture, getNativeHandle(), 0); } //////////////////////////////////////////////////////////// void sfTexture_bind(const sfTexture* texture) { sf::Texture::bind(texture ? texture->This : NULL); } //////////////////////////////////////////////////////////// unsigned int sfTexture_getMaximumSize() { return sf::Texture::getMaximumSize(); } CSFML-2.4/src/SFML/Graphics/TextureStruct.h000066400000000000000000000037371301071240500203340ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_TEXTURESTRUCT_H #define SFML_TEXTURESTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// // Internal structure of sfTexture //////////////////////////////////////////////////////////// struct sfTexture { sfTexture() { This = new sf::Texture; OwnInstance = true; } sfTexture(sf::Texture* texture) { This = texture; OwnInstance = false; } sfTexture(const sfTexture& texture) { This = texture.This ? new sf::Texture(*texture.This) : NULL; OwnInstance = true; } ~sfTexture() { if (OwnInstance) delete This; } sf::Texture* This; bool OwnInstance; }; #endif // SFML_TEXTURESTRUCT_H CSFML-2.4/src/SFML/Graphics/Transform.cpp000066400000000000000000000117001301071240500177620ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include //////////////////////////////////////////////////////////// const sfTransform sfTransform_Identity = { 1, 0, 0, 0, 1, 0, 0, 0, 1, }; //////////////////////////////////////////////////////////// sfTransform sfTransform_fromMatrix(float a00, float a01, float a02, float a10, float a11, float a12, float a20, float a21, float a22) { sfTransform transform = {a00, a01, a02, a10, a11, a12, a20, a21, a22}; return transform; } //////////////////////////////////////////////////////////// void sfTransform_getMatrix(const sfTransform* transform, float* matrix) { CSFML_CHECK(transform); sf::Transform converted = convertTransform(*transform); if (matrix) std::memcpy(matrix, converted.getMatrix(), 16 * sizeof(float)); } //////////////////////////////////////////////////////////// sfTransform sfTransform_getInverse(const sfTransform* transform) { CSFML_CHECK_RETURN(transform, sfTransform_Identity); return convertTransform(convertTransform(*transform).getInverse()); } //////////////////////////////////////////////////////////// sfVector2f sfTransform_transformPoint(const sfTransform* transform, sfVector2f point) { sfVector2f p = {0, 0}; CSFML_CHECK_RETURN(transform, p); sf::Vector2f sfmlPoint = convertTransform(*transform).transformPoint(point.x, point.y); p.x = sfmlPoint.x; p.y = sfmlPoint.y; return p; } //////////////////////////////////////////////////////////// sfFloatRect sfTransform_transformRect(const sfTransform* transform, sfFloatRect rectangle) { sfFloatRect rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(transform, rect); sf::FloatRect sfmlRect = convertTransform(*transform).transformRect(sf::FloatRect(rectangle.left, rectangle.top, rectangle.width, rectangle.height)); rect.left = sfmlRect.left; rect.top = sfmlRect.top; rect.width = sfmlRect.width; rect.height = sfmlRect.height; return rect; } //////////////////////////////////////////////////////////// void sfTransform_combine(sfTransform* transform, const sfTransform* other) { CSFML_CHECK(transform); CSFML_CHECK(other); *transform = convertTransform(convertTransform(*transform).combine(convertTransform(*other))); } //////////////////////////////////////////////////////////// void sfTransform_translate(sfTransform* transform, float x, float y) { CSFML_CHECK(transform); *transform = convertTransform(convertTransform(*transform).translate(x, y)); } //////////////////////////////////////////////////////////// void sfTransform_rotate(sfTransform* transform, float angle) { CSFML_CHECK(transform); *transform = convertTransform(convertTransform(*transform).rotate(angle)); } //////////////////////////////////////////////////////////// void sfTransform_rotateWithCenter(sfTransform* transform, float angle, float centerX, float centerY) { CSFML_CHECK(transform); *transform = convertTransform(convertTransform(*transform).rotate(angle, centerX, centerY)); } //////////////////////////////////////////////////////////// void sfTransform_scale(sfTransform* transform, float scaleX, float scaleY) { CSFML_CHECK(transform); *transform = convertTransform(convertTransform(*transform).scale(scaleX, scaleY)); } //////////////////////////////////////////////////////////// void sfTransform_scaleWithCenter(sfTransform* transform, float scaleX, float scaleY, float centerX, float centerY) { CSFML_CHECK(transform); *transform = convertTransform(convertTransform(*transform).scale(scaleX, scaleY, centerX, centerY)); } CSFML-2.4/src/SFML/Graphics/Transformable.cpp000066400000000000000000000124111301071240500206060ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include //////////////////////////////////////////////////////////// sfTransformable* sfTransformable_create(void) { sfTransformable* transformable = new sfTransformable; return transformable; } //////////////////////////////////////////////////////////// sfTransformable* sfTransformable_copy(const sfTransformable* transformable) { CSFML_CHECK_RETURN(transformable, NULL); return new sfTransformable(*transformable); } //////////////////////////////////////////////////////////// void sfTransformable_destroy(sfTransformable* transformable) { delete transformable; } //////////////////////////////////////////////////////////// void sfTransformable_setPosition(sfTransformable* transformable, sfVector2f position) { CSFML_CALL(transformable, setPosition(position.x, position.y)); } //////////////////////////////////////////////////////////// void sfTransformable_setRotation(sfTransformable* transformable, float angle) { CSFML_CALL(transformable, setRotation(angle)); } //////////////////////////////////////////////////////////// void sfTransformable_setScale(sfTransformable* transformable, sfVector2f scale) { CSFML_CALL(transformable, setScale(scale.x, scale.y)); } //////////////////////////////////////////////////////////// void sfTransformable_setOrigin(sfTransformable* transformable, sfVector2f origin) { CSFML_CALL(transformable, setOrigin(origin.x, origin.y)); } //////////////////////////////////////////////////////////// sfVector2f sfTransformable_getPosition(const sfTransformable* transformable) { sfVector2f position = {0, 0}; CSFML_CHECK_RETURN(transformable, position); sf::Vector2f sfmlPos = transformable->This.getPosition(); position.x = sfmlPos.x; position.y = sfmlPos.y; return position; } //////////////////////////////////////////////////////////// float sfTransformable_getRotation(const sfTransformable* transformable) { CSFML_CALL_RETURN(transformable, getRotation(), 0.f); } //////////////////////////////////////////////////////////// sfVector2f sfTransformable_getScale(const sfTransformable* transformable) { sfVector2f scale = {0, 0}; CSFML_CHECK_RETURN(transformable, scale); sf::Vector2f sfmlScale = transformable->This.getScale(); scale.x = sfmlScale.x; scale.y = sfmlScale.y; return scale; } //////////////////////////////////////////////////////////// sfVector2f sfTransformable_getOrigin(const sfTransformable* transformable) { sfVector2f origin = {0, 0}; CSFML_CHECK_RETURN(transformable, origin); sf::Vector2f sfmlOrigin = transformable->This.getOrigin(); origin.x = sfmlOrigin.x; origin.y = sfmlOrigin.y; return origin; } //////////////////////////////////////////////////////////// void sfTransformable_move(sfTransformable* transformable, sfVector2f offset) { CSFML_CALL(transformable, move(offset.x, offset.y)); } //////////////////////////////////////////////////////////// void sfTransformable_rotate(sfTransformable* transformable, float angle) { CSFML_CALL(transformable, rotate(angle)); } //////////////////////////////////////////////////////////// void sfTransformable_scale(sfTransformable* transformable, sfVector2f factors) { CSFML_CALL(transformable, scale(factors.x, factors.y)); } //////////////////////////////////////////////////////////// sfTransform sfTransformable_getTransform(const sfTransformable* transformable) { CSFML_CHECK_RETURN(transformable, sfTransform_Identity); transformable->Transform = convertTransform(transformable->This.getTransform()); return transformable->Transform; } //////////////////////////////////////////////////////////// sfTransform sfTransformable_getInverseTransform(const sfTransformable* transformable) { CSFML_CHECK_RETURN(transformable, sfTransform_Identity); transformable->InverseTransform = convertTransform(transformable->This.getInverseTransform()); return transformable->InverseTransform; } CSFML-2.4/src/SFML/Graphics/TransformableStruct.h000066400000000000000000000033011301071240500214560ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_TRANSFORMABLESTRUCT_H #define SFML_TRANSFORMABLESTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include //////////////////////////////////////////////////////////// // Internal structure of sfTransformable //////////////////////////////////////////////////////////// struct sfTransformable { sf::Transformable This; mutable sfTransform Transform; mutable sfTransform InverseTransform; }; #endif // SFML_TRANSFORMABLESTRUCT_H CSFML-2.4/src/SFML/Graphics/VertexArray.cpp000066400000000000000000000075551301071240500203000ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// sfVertexArray* sfVertexArray_create(void) { return new sfVertexArray; } //////////////////////////////////////////////////////////// sfVertexArray* sfVertexArray_copy(const sfVertexArray* vertexArray) { CSFML_CHECK_RETURN(vertexArray, NULL); return new sfVertexArray(*vertexArray); } //////////////////////////////////////////////////////////// void sfVertexArray_destroy(sfVertexArray* vertexArray) { delete vertexArray; } //////////////////////////////////////////////////////////// size_t sfVertexArray_getVertexCount(const sfVertexArray* vertexArray) { CSFML_CALL_RETURN(vertexArray, getVertexCount(), 0); } //////////////////////////////////////////////////////////// sfVertex* sfVertexArray_getVertex(sfVertexArray* vertexArray, size_t index) { CSFML_CHECK_RETURN(vertexArray, NULL); // the cast is safe, sfVertex has to be binary compatible with sf::Vertex return reinterpret_cast(&vertexArray->This[index]); } //////////////////////////////////////////////////////////// void sfVertexArray_clear(sfVertexArray* vertexArray) { CSFML_CALL(vertexArray, clear()); } //////////////////////////////////////////////////////////// void sfVertexArray_resize(sfVertexArray* vertexArray, size_t vertexCount) { CSFML_CALL(vertexArray, resize(vertexCount)); } //////////////////////////////////////////////////////////// void sfVertexArray_append(sfVertexArray* vertexArray, sfVertex vertex) { // the cast is safe, sfVertex has to be binary compatible with sf::Vertex CSFML_CALL(vertexArray, append(reinterpret_cast(vertex))); } //////////////////////////////////////////////////////////// void sfVertexArray_setPrimitiveType(sfVertexArray* vertexArray, sfPrimitiveType type) { CSFML_CALL(vertexArray, setPrimitiveType(static_cast(type))); } //////////////////////////////////////////////////////////// sfPrimitiveType sfVertexArray_getPrimitiveType(sfVertexArray* vertexArray) { CSFML_CHECK_RETURN(vertexArray, sfPoints); return static_cast(vertexArray->This.getPrimitiveType()); } //////////////////////////////////////////////////////////// sfFloatRect sfVertexArray_getBounds(sfVertexArray* vertexArray) { sfFloatRect rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(vertexArray, rect); sf::FloatRect sfmlRect = vertexArray->This.getBounds(); rect.left = sfmlRect.left; rect.top = sfmlRect.top; rect.width = sfmlRect.width; rect.height = sfmlRect.height; return rect; } CSFML-2.4/src/SFML/Graphics/VertexArrayStruct.h000066400000000000000000000030771301071240500211450ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_VERTEXARRAYSTRUCT_H #define SFML_VERTEXARRAYSTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// // Internal structure of sfVertexArray //////////////////////////////////////////////////////////// struct sfVertexArray { sf::VertexArray This; }; #endif // SFML_VERTEXARRAYSTRUCT_H CSFML-2.4/src/SFML/Graphics/View.cpp000066400000000000000000000107201301071240500167220ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// sfView* sfView_create(void) { return new sfView; } //////////////////////////////////////////////////////////// sfView* sfView_createFromRect(sfFloatRect rectangle) { sfView* view = new sfView; sfView_reset(view, rectangle); return view; } //////////////////////////////////////////////////////////// sfView* sfView_copy(const sfView* view) { CSFML_CHECK_RETURN(view, NULL); return new sfView(*view); } //////////////////////////////////////////////////////////// void sfView_destroy(sfView* view) { delete view; } //////////////////////////////////////////////////////////// void sfView_setCenter(sfView* view, sfVector2f center) { CSFML_CALL(view, setCenter(center.x, center.y)); } //////////////////////////////////////////////////////////// void sfView_setSize(sfView* view, sfVector2f size) { CSFML_CALL(view, setSize(size.x, size.y)); } //////////////////////////////////////////////////////////// void sfView_setRotation(sfView* view, float angle) { CSFML_CALL(view, setRotation(angle)); } //////////////////////////////////////////////////////////// void sfView_setViewport(sfView* view, sfFloatRect viewport) { CSFML_CALL(view, setViewport(sf::FloatRect(viewport.left, viewport.top, viewport.width, viewport.height))); } //////////////////////////////////////////////////////////// void sfView_reset(sfView* view, sfFloatRect rectangle) { CSFML_CALL(view, reset(sf::FloatRect(rectangle.left, rectangle.top, rectangle.width, rectangle.height))); } //////////////////////////////////////////////////////////// sfVector2f sfView_getCenter(const sfView* view) { sfVector2f center = {0, 0}; CSFML_CHECK_RETURN(view, center); sf::Vector2f sfmlCenter = view->This.getCenter(); center.x = sfmlCenter.x; center.y = sfmlCenter.y; return center; } //////////////////////////////////////////////////////////// sfVector2f sfView_getSize(const sfView* view) { sfVector2f size = {0, 0}; CSFML_CHECK_RETURN(view, size); sf::Vector2f sfmlSize = view->This.getSize(); size.x = sfmlSize.x; size.y = sfmlSize.y; return size; } //////////////////////////////////////////////////////////// float sfView_getRotation(const sfView* view) { CSFML_CALL_RETURN(view, getRotation(), 0.f); } //////////////////////////////////////////////////////////// sfFloatRect sfView_getViewport(const sfView* view) { sfFloatRect rect = {0, 0, 0, 0}; CSFML_CHECK_RETURN(view, rect); sf::FloatRect SFMLRect = view->This.getViewport(); rect.left = SFMLRect.left; rect.top = SFMLRect.top; rect.width = SFMLRect.width; rect.height = SFMLRect.height; return rect; } //////////////////////////////////////////////////////////// void sfView_move(sfView* view, sfVector2f offset) { CSFML_CALL(view, move(offset.x, offset.y)); } //////////////////////////////////////////////////////////// void sfView_rotate(sfView* view, float angle) { CSFML_CALL(view, rotate(angle)); } //////////////////////////////////////////////////////////// void sfView_zoom(sfView* view, float factor) { CSFML_CALL(view, zoom(factor)); } CSFML-2.4/src/SFML/Graphics/ViewStruct.h000066400000000000000000000030171301071240500175750ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_VIEWSTRUCT_H #define SFML_VIEWSTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// // Internal structure of sfMusic //////////////////////////////////////////////////////////// struct sfView { sf::View This; }; #endif // SFML_VIEWSTRUCT_H CSFML-2.4/src/SFML/Internal.h000066400000000000000000000100411301071240500154650ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_INTERNAL_H #define SFML_INTERNAL_H //////////////////////////////////////////////////////////// // Define macros to check the validity of CSFML objects in debug run //////////////////////////////////////////////////////////// #include // this macro avoids the C4127 warning on VC++ ("conditional expression is constant") #define ASSERT_FALSE (__LINE__ == -1) #ifndef NDEBUG #define CSFML_CHECK(object_) \ do \ { \ if (object_ == NULL) \ { \ fprintf(stderr, "SFML warning: trying to use a null " #object_ " object\n"); \ return; \ } \ } \ while (ASSERT_FALSE) #define CSFML_CALL(object_, function_) \ do \ { \ if (object_) \ { \ (object_->This.function_); \ } \ else \ { \ fprintf(stderr, "SFML warning: trying to use a null " #object_ " object\n"); \ } \ } \ while (ASSERT_FALSE) #define CSFML_CALL_PTR(object_, function_) \ do \ { \ if (object_) \ { \ (object_->This->function_); \ } \ else \ { \ fprintf(stderr, "SFML warning: trying to use a null " #object_ " object\n"); \ } \ } \ while (ASSERT_FALSE) #define CSFML_CHECK_RETURN(object_, default_) \ do \ { \ if (object_ == NULL) \ { \ fprintf(stderr, "SFML warning: trying to use a null " #object_ " object\n"); \ return default_; \ } \ } \ while (ASSERT_FALSE) #define CSFML_CALL_RETURN(object_, function_, default_) \ if (object_) \ { \ return (object_->This.function_); \ } \ else \ { \ fprintf(stderr, "SFML warning: trying to use a null " #object_ " object\n"); \ return default_; \ } #define CSFML_CALL_PTR_RETURN(object_, function_, default_) \ if (object_) \ { \ return (object_->This->function_); \ } \ else \ { \ fprintf(stderr, "SFML warning: trying to use a null " #object_ " object\n"); \ return default_; \ } #else #define CSFML_CHECK(object_) #define CSFML_CALL(object_, function_) \ (object_->This.function_) #define CSFML_CALL_PTR(object_, function_) \ (object_->This->function_) #define CSFML_CHECK_RETURN(object_, default_) \ (void)default_; #define CSFML_CALL_RETURN(object_, function_, default_) \ { \ (void)default_; \ return (object_->This.function_); \ } #define CSFML_CALL_PTR_RETURN(object_, function_, default_) \ { \ (void)default_; \ return (object_->This->function_); \ } #endif #endif // SFML_INTERNAL_H CSFML-2.4/src/SFML/Main/000077500000000000000000000000001301071240500144305ustar00rootroot00000000000000CSFML-2.4/src/SFML/Main/CMakeLists.txt000066400000000000000000000005051301071240500171700ustar00rootroot00000000000000 # define the csfml-main target add_library(csfml-main STATIC ${CMAKE_SOURCE_DIR}/src/SFML/Main/SFML_Main.cpp) # set the debug suffix set_target_properties(csfml-main PROPERTIES DEBUG_POSTFIX -d) # insert the major version number in the output filename set_target_properties(csfml-main PROPERTIES OUTPUT_NAME "csfml-main") CSFML-2.4/src/SFML/Main/SFML_Main.cpp000066400000000000000000000031341301071240500166420ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Windows specific : defines the WinMain entry function, // so that developers can use the standard main function // even in a Win32 Application project, and keep a portable code //////////////////////////////////////////////////////////// #if defined(_WIN32) #include extern int main(int argc, char* argv[]); int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, INT) { return main(__argc, __argv); } #endif // _WIN32 CSFML-2.4/src/SFML/Network/000077500000000000000000000000001301071240500151755ustar00rootroot00000000000000CSFML-2.4/src/SFML/Network/CMakeLists.txt000066400000000000000000000021151301071240500177340ustar00rootroot00000000000000 set(INCROOT ${CMAKE_SOURCE_DIR}/include/SFML/Network) set(SRCROOT ${CMAKE_SOURCE_DIR}/src/SFML/Network) # all source files set(SRC ${INCROOT}/Export.h ${SRCROOT}/Ftp.cpp ${SRCROOT}/FtpStruct.h ${INCROOT}/Ftp.h ${SRCROOT}/Http.cpp ${SRCROOT}/HttpStruct.h ${INCROOT}/Http.h ${SRCROOT}/IpAddress.cpp ${INCROOT}/IpAddress.h ${SRCROOT}/Packet.cpp ${SRCROOT}/PacketStruct.h ${INCROOT}/Packet.h ${SRCROOT}/SocketSelector.cpp ${SRCROOT}/SocketSelectorStruct.h ${INCROOT}/SocketSelector.h ${INCROOT}/SocketStatus.h ${SRCROOT}/TcpListener.cpp ${SRCROOT}/TcpListenerStruct.h ${INCROOT}/TcpListener.h ${SRCROOT}/TcpSocket.cpp ${SRCROOT}/TcpSocketStruct.h ${INCROOT}/TcpSocket.h ${INCROOT}/Types.h ${SRCROOT}/UdpSocket.cpp ${SRCROOT}/UdpSocketStruct.h ${INCROOT}/UdpSocket.h ) # define the csfml-network target csfml_add_library(csfml-network SOURCES ${SRC} DEPENDS ${SFML_NETWORK_LIBRARY} ${SFML_SYSTEM_LIBRARY} ${SFML_NETWORK_DEPENDENCIES} ${SFML_SYSTEM_DEPENDENCIES}) CSFML-2.4/src/SFML/Network/Ftp.cpp000066400000000000000000000226241301071240500164400ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include //////////////////////////////////////////////////////////// void sfFtpListingResponse_destroy(sfFtpListingResponse* ftpListingResponse) { delete ftpListingResponse; } //////////////////////////////////////////////////////////// sfBool sfFtpListingResponse_isOk(const sfFtpListingResponse* ftpListingResponse) { CSFML_CALL_RETURN(ftpListingResponse, isOk(), sfFalse); } //////////////////////////////////////////////////////////// sfFtpStatus sfFtpListingResponse_getStatus(const sfFtpListingResponse* ftpListingResponse) { CSFML_CHECK_RETURN(ftpListingResponse, sfFtpInvalidResponse); return static_cast(ftpListingResponse->This.getStatus()); } //////////////////////////////////////////////////////////// const char* sfFtpListingResponse_getMessage(const sfFtpListingResponse* ftpListingResponse) { CSFML_CHECK_RETURN(ftpListingResponse, NULL); return ftpListingResponse->This.getMessage().c_str(); } //////////////////////////////////////////////////////////// size_t sfFtpListingResponse_getCount(const sfFtpListingResponse* ftpListingResponse) { CSFML_CHECK_RETURN(ftpListingResponse, 0); return ftpListingResponse->This.getListing().size(); } //////////////////////////////////////////////////////////// const char* sfFtpListingResponse_getName(const sfFtpListingResponse* ftpListingResponse, size_t index) { CSFML_CHECK_RETURN(ftpListingResponse, NULL); return ftpListingResponse->This.getListing()[index].c_str(); } //////////////////////////////////////////////////////////// void sfFtpDirectoryResponse_destroy(sfFtpDirectoryResponse* ftpDirectoryResponse) { delete ftpDirectoryResponse; } //////////////////////////////////////////////////////////// sfBool sfFtpDirectoryResponse_isOk(const sfFtpDirectoryResponse* ftpDirectoryResponse) { CSFML_CALL_RETURN(ftpDirectoryResponse, isOk(), sfFalse); } //////////////////////////////////////////////////////////// sfFtpStatus sfFtpDirectoryResponse_getStatus(const sfFtpDirectoryResponse* ftpDirectoryResponse) { CSFML_CHECK_RETURN(ftpDirectoryResponse, sfFtpInvalidResponse); return static_cast(ftpDirectoryResponse->This.getStatus()); } //////////////////////////////////////////////////////////// const char* sfFtpDirectoryResponse_getMessage(const sfFtpDirectoryResponse* ftpDirectoryResponse) { CSFML_CHECK_RETURN(ftpDirectoryResponse, NULL); return ftpDirectoryResponse->This.getMessage().c_str(); } //////////////////////////////////////////////////////////// const char* sfFtpDirectoryResponse_getDirectory(const sfFtpDirectoryResponse* ftpDirectoryResponse) { CSFML_CHECK_RETURN(ftpDirectoryResponse, NULL); return ftpDirectoryResponse->This.getDirectory().c_str(); } //////////////////////////////////////////////////////////// void sfFtpResponse_destroy(sfFtpResponse* ftpResponse) { delete ftpResponse; } //////////////////////////////////////////////////////////// sfBool sfFtpResponse_isOk(const sfFtpResponse* ftpResponse) { CSFML_CALL_RETURN(ftpResponse, isOk(), sfFalse); } //////////////////////////////////////////////////////////// sfFtpStatus sfFtpResponse_getStatus(const sfFtpResponse* ftpResponse) { CSFML_CHECK_RETURN(ftpResponse, sfFtpInvalidResponse); return static_cast(ftpResponse->This.getStatus()); } //////////////////////////////////////////////////////////// const char* sfFtpResponse_getMessage(const sfFtpResponse* ftpResponse) { CSFML_CHECK_RETURN(ftpResponse, NULL); return ftpResponse->This.getMessage().c_str(); } //////////////////////////////////////////////////////////// sfFtp* sfFtp_create(void) { return new sfFtp; } //////////////////////////////////////////////////////////// void sfFtp_destroy(sfFtp* ftp) { delete ftp; } //////////////////////////////////////////////////////////// sfFtpResponse* sfFtp_connect(sfFtp* ftp, sfIpAddress server, unsigned short port, sfTime timeout) { CSFML_CHECK_RETURN(ftp, NULL); sf::IpAddress SFMLServer(server.address); return new sfFtpResponse(ftp->This.connect(SFMLServer, port, sf::microseconds(timeout.microseconds))); } //////////////////////////////////////////////////////////// sfFtpResponse* sfFtp_loginAnonymous(sfFtp* ftp) { CSFML_CHECK_RETURN(ftp, NULL); return new sfFtpResponse(ftp->This.login()); } //////////////////////////////////////////////////////////// sfFtpResponse* sfFtp_login(sfFtp* ftp, const char* name, const char* password) { CSFML_CHECK_RETURN(ftp, NULL); return new sfFtpResponse(ftp->This.login(name ? name : "", password ? password : "")); } //////////////////////////////////////////////////////////// sfFtpResponse* sfFtp_disconnect(sfFtp* ftp) { CSFML_CHECK_RETURN(ftp, NULL); return new sfFtpResponse(ftp->This.disconnect()); } //////////////////////////////////////////////////////////// sfFtpResponse* sfFtp_keepAlive(sfFtp* ftp) { CSFML_CHECK_RETURN(ftp, NULL); return new sfFtpResponse(ftp->This.keepAlive()); } //////////////////////////////////////////////////////////// sfFtpDirectoryResponse* sfFtp_getWorkingDirectory(sfFtp* ftp) { CSFML_CHECK_RETURN(ftp, NULL); return new sfFtpDirectoryResponse(ftp->This.getWorkingDirectory()); } //////////////////////////////////////////////////////////// sfFtpListingResponse* sfFtp_getDirectoryListing(sfFtp* ftp, const char* directory) { CSFML_CHECK_RETURN(ftp, NULL); return new sfFtpListingResponse(ftp->This.getDirectoryListing(directory ? directory : "")); } //////////////////////////////////////////////////////////// sfFtpResponse* sfFtp_changeDirectory(sfFtp* ftp, const char* directory) { CSFML_CHECK_RETURN(ftp, NULL); return new sfFtpResponse(ftp->This.changeDirectory(directory ? directory : "")); } //////////////////////////////////////////////////////////// sfFtpResponse* sfFtp_parentDirectory(sfFtp* ftp) { CSFML_CHECK_RETURN(ftp, NULL); return new sfFtpResponse(ftp->This.parentDirectory()); } //////////////////////////////////////////////////////////// sfFtpResponse* sfFtp_createDirectory(sfFtp* ftp, const char* name) { CSFML_CHECK_RETURN(ftp, NULL); return new sfFtpResponse(ftp->This.createDirectory(name ? name : "")); } //////////////////////////////////////////////////////////// sfFtpResponse* sfFtp_deleteDirectory(sfFtp* ftp, const char* name) { CSFML_CHECK_RETURN(ftp, NULL); return new sfFtpResponse(ftp->This.deleteDirectory(name ? name : "")); } //////////////////////////////////////////////////////////// sfFtpResponse* sfFtp_renameFile(sfFtp* ftp, const char* file, const char* newName) { CSFML_CHECK_RETURN(ftp, NULL); return new sfFtpResponse(ftp->This.renameFile(file ? file : "", newName ? newName : "")); } //////////////////////////////////////////////////////////// sfFtpResponse* sfFtp_deleteFile(sfFtp* ftp, const char* name) { CSFML_CHECK_RETURN(ftp, NULL); return new sfFtpResponse(ftp->This.deleteFile(name ? name : "")); } //////////////////////////////////////////////////////////// sfFtpResponse* sfFtp_download(sfFtp* ftp, const char* remoteFile, const char* localPath, sfFtpTransferMode mode) { CSFML_CHECK_RETURN(ftp, NULL); return new sfFtpResponse(ftp->This.download(remoteFile ? remoteFile : "", localPath ? localPath : "", static_cast(mode))); } //////////////////////////////////////////////////////////// sfFtpResponse* sfFtp_upload(sfFtp* ftp, const char* localFile, const char* remotePath, sfFtpTransferMode mode) { CSFML_CHECK_RETURN(ftp, NULL); return new sfFtpResponse(ftp->This.upload(localFile ? localFile : "", remotePath ? remotePath : "", static_cast(mode))); } //////////////////////////////////////////////////////////// sfFtpResponse* sfFtp_sendCommand(sfFtp* ftp, const char* command, const char* parameter) { CSFML_CHECK_RETURN(ftp, NULL); return new sfFtpResponse(ftp->This.sendCommand(command ? command : "", parameter ? parameter : "")); } CSFML-2.4/src/SFML/Network/FtpStruct.h000066400000000000000000000053241301071240500173100ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_FTPSTRUCT_H #define SFML_FTPSTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include //////////////////////////////////////////////////////////// // Internal structure of sfFtp //////////////////////////////////////////////////////////// struct sfFtp { sf::Ftp This; }; //////////////////////////////////////////////////////////// // Internal structure of sfFtpResponse //////////////////////////////////////////////////////////// struct sfFtpResponse { sfFtpResponse(const sf::Ftp::Response& Response) : This(Response) { } sf::Ftp::Response This; }; //////////////////////////////////////////////////////////// // Internal structure of sfFtpDirectoryResponse //////////////////////////////////////////////////////////// struct sfFtpDirectoryResponse { sfFtpDirectoryResponse(const sf::Ftp::DirectoryResponse& Response) : This(Response) { } sf::Ftp::DirectoryResponse This; }; //////////////////////////////////////////////////////////// // Internal structure of sfFtpListingResponse //////////////////////////////////////////////////////////// struct sfFtpListingResponse { sfFtpListingResponse(const sf::Ftp::ListingResponse& Response) : This(Response) { } ~sfFtpListingResponse() { for (std::vector::iterator it = Filenames.begin(); it != Filenames.end(); ++it) delete[] *it; } sf::Ftp::ListingResponse This; std::vector Filenames; }; #endif // SFML_FTPSTRUCT_H CSFML-2.4/src/SFML/Network/Http.cpp000066400000000000000000000115121301071240500166200ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// sfHttpRequest* sfHttpRequest_create(void) { return new sfHttpRequest; } //////////////////////////////////////////////////////////// void sfHttpRequest_destroy(sfHttpRequest* httpRequest) { delete httpRequest; } //////////////////////////////////////////////////////////// void sfHttpRequest_setField(sfHttpRequest* httpRequest, const char* field, const char* value) { CSFML_CHECK(httpRequest); if (field) httpRequest->This.setField(field, value); } //////////////////////////////////////////////////////////// void sfHttpRequest_setMethod(sfHttpRequest* httpRequest, sfHttpMethod method) { CSFML_CALL(httpRequest, setMethod(static_cast(method))); } //////////////////////////////////////////////////////////// void sfHttpRequest_setUri(sfHttpRequest* httpRequest, const char* uri) { CSFML_CALL(httpRequest, setUri(uri ? uri : "")); } //////////////////////////////////////////////////////////// void sfHttpRequest_setHttpVersion(sfHttpRequest* httpRequest, unsigned int major, unsigned int minor) { CSFML_CALL(httpRequest, setHttpVersion(major, minor)); } //////////////////////////////////////////////////////////// void sfHttpRequest_setBody(sfHttpRequest* httpRequest, const char* body) { CSFML_CALL(httpRequest, setBody(body ? body : "")); } //////////////////////////////////////////////////////////// void sfHttpResponse_destroy(sfHttpResponse* httpResponse) { delete httpResponse; } //////////////////////////////////////////////////////////// const char* sfHttpResponse_getField(const sfHttpResponse* httpResponse, const char* field) { CSFML_CHECK_RETURN(httpResponse, NULL); if (!field) return NULL; return httpResponse->This.getField(field).c_str(); } //////////////////////////////////////////////////////////// sfHttpStatus sfHttpResponse_getStatus(const sfHttpResponse* httpResponse) { CSFML_CHECK_RETURN(httpResponse, sfHttpInvalidResponse); return static_cast(httpResponse->This.getStatus()); } //////////////////////////////////////////////////////////// unsigned int sfHttpResponse_getMajorVersion(const sfHttpResponse* httpResponse) { CSFML_CALL_RETURN(httpResponse, getMajorHttpVersion(), 0); } //////////////////////////////////////////////////////////// unsigned int sfHttpResponse_getMinorVersion(const sfHttpResponse* httpResponse) { CSFML_CALL_RETURN(httpResponse, getMinorHttpVersion(), 0); } //////////////////////////////////////////////////////////// const char* sfHttpResponse_getBody(const sfHttpResponse* httpResponse) { CSFML_CHECK_RETURN(httpResponse, NULL); return httpResponse->This.getBody().c_str(); } //////////////////////////////////////////////////////////// sfHttp* sfHttp_create(void) { return new sfHttp; } //////////////////////////////////////////////////////////// void sfHttp_destroy(sfHttp* http) { delete http; } //////////////////////////////////////////////////////////// void sfHttp_setHost(sfHttp* http, const char* host, unsigned short port) { CSFML_CALL(http, setHost(host ? host : "", port)); } //////////////////////////////////////////////////////////// sfHttpResponse* sfHttp_sendRequest(sfHttp* http, const sfHttpRequest* request, sfTime timeout) { CSFML_CHECK_RETURN(http, NULL); CSFML_CHECK_RETURN(request, NULL); sfHttpResponse* response = new sfHttpResponse; response->This = http->This.sendRequest(request->This, sf::microseconds(timeout.microseconds)); return response; } CSFML-2.4/src/SFML/Network/HttpStruct.h000066400000000000000000000037021301071240500174740ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_HTTPSTRUCT_H #define SFML_HTTPSTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// // Internal structure of sfHttp //////////////////////////////////////////////////////////// struct sfHttp { sf::Http This; }; //////////////////////////////////////////////////////////// // Internal structure of sfHttpRequest //////////////////////////////////////////////////////////// struct sfHttpRequest { sf::Http::Request This; }; //////////////////////////////////////////////////////////// // Internal structure of sfHttpResponse //////////////////////////////////////////////////////////// struct sfHttpResponse { sf::Http::Response This; }; #endif // SFML_HTTPSTRUCT_H CSFML-2.4/src/SFML/Network/IpAddress.cpp000066400000000000000000000071301301071240500175600ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include namespace { // Helper function for converting a SFML address to a CSFML one sfIpAddress fromSFMLAddress(sf::IpAddress address) { sfIpAddress result; strncpy(result.address, address.toString().c_str(), 16); return result; } // Helper function for converting a CSFML address to a SFML one sf::IpAddress toSFMLAddress(sfIpAddress address) { return sf::IpAddress(address.address); } } //////////////////////////////////////////////////////////// const sfIpAddress sfIpAddress_None = sfIpAddress_fromBytes(0, 0, 0, 0); //////////////////////////////////////////////////////////// const sfIpAddress sfIpAddress_Any = sfIpAddress_fromBytes(0, 0, 0, 0); //////////////////////////////////////////////////////////// const sfIpAddress sfIpAddress_LocalHost = sfIpAddress_fromBytes(127, 0, 0, 1); //////////////////////////////////////////////////////////// const sfIpAddress sfIpAddress_Broadcast = sfIpAddress_fromBytes(255, 255, 255, 255); //////////////////////////////////////////////////////////// sfIpAddress sfIpAddress_fromString(const char* address) { return fromSFMLAddress(sf::IpAddress(address)); } //////////////////////////////////////////////////////////// sfIpAddress sfIpAddress_fromBytes(sfUint8 byte0, sfUint8 byte1, sfUint8 byte2, sfUint8 byte3) { return fromSFMLAddress(sf::IpAddress(byte0, byte1, byte2, byte3)); } //////////////////////////////////////////////////////////// sfIpAddress sfIpAddress_fromInteger(sfUint32 address) { return fromSFMLAddress(sf::IpAddress(address)); } //////////////////////////////////////////////////////////// void sfIpAddress_toString(sfIpAddress address, char* string) { if (string) strcpy(string, address.address); } //////////////////////////////////////////////////////////// sfUint32 sfIpAddress_toInteger(sfIpAddress address) { return toSFMLAddress(address).toInteger(); } //////////////////////////////////////////////////////////// sfIpAddress sfIpAddress_getLocalAddress(void) { return fromSFMLAddress(sf::IpAddress::getLocalAddress()); } //////////////////////////////////////////////////////////// sfIpAddress sfIpAddress_getPublicAddress(sfTime timeout) { return fromSFMLAddress(sf::IpAddress::getPublicAddress(sf::microseconds(timeout.microseconds))); } CSFML-2.4/src/SFML/Network/Packet.cpp000066400000000000000000000133271301071240500171160ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// sfPacket* sfPacket_create(void) { return new sfPacket; } //////////////////////////////////////////////////////////// sfPacket* sfPacket_copy(const sfPacket* packet) { CSFML_CHECK_RETURN(packet, NULL); return new sfPacket(*packet); } //////////////////////////////////////////////////////////// void sfPacket_destroy(sfPacket* packet) { delete packet; } //////////////////////////////////////////////////////////// void sfPacket_append(sfPacket* packet, const void* data, size_t sizeInBytes) { CSFML_CALL(packet, append(data, sizeInBytes)); } //////////////////////////////////////////////////////////// void sfPacket_clear(sfPacket* packet) { CSFML_CALL(packet, clear()); } //////////////////////////////////////////////////////////// const void* sfPacket_getData(const sfPacket* packet) { CSFML_CALL_RETURN(packet, getData(), NULL); } //////////////////////////////////////////////////////////// size_t sfPacket_getDataSize(const sfPacket* packet) { CSFML_CALL_RETURN(packet, getDataSize(), 0); } //////////////////////////////////////////////////////////// sfBool sfPacket_endOfPacket(const sfPacket* packet) { CSFML_CALL_RETURN(packet, endOfPacket(), sfFalse); } //////////////////////////////////////////////////////////// sfBool sfPacket_canRead(const sfPacket* packet) { CSFML_CHECK_RETURN(packet, sfFalse); return packet->This ? sfTrue : sfFalse; } //////////////////////////////////////////////////////////// sfBool sfPacket_readBool(sfPacket* packet) { return sfPacket_readUint8(packet); } sfInt8 sfPacket_readInt8(sfPacket* packet) { CSFML_CHECK_RETURN(packet, sfFalse); sfInt8 value; packet->This >> value; return value; } sfUint8 sfPacket_readUint8(sfPacket* packet) { CSFML_CHECK_RETURN(packet, sfFalse); sfUint8 value; packet->This >> value; return value; } sfInt16 sfPacket_readInt16(sfPacket* packet) { CSFML_CHECK_RETURN(packet, sfFalse); sfInt16 value; packet->This >> value; return value; } sfUint16 sfPacket_readUint16(sfPacket* packet) { CSFML_CHECK_RETURN(packet, sfFalse); sfUint16 value; packet->This >> value; return value; } sfInt32 sfPacket_readInt32(sfPacket* packet) { CSFML_CHECK_RETURN(packet, sfFalse); sfInt32 value; packet->This >> value; return value; } sfUint32 sfPacket_readUint32(sfPacket* packet) { CSFML_CHECK_RETURN(packet, sfFalse); sfUint32 value; packet->This >> value; return value; } float sfPacket_readFloat(sfPacket* packet) { CSFML_CHECK_RETURN(packet, sfFalse); float value; packet->This >> value; return value; } double sfPacket_readDouble(sfPacket* packet) { CSFML_CHECK_RETURN(packet, sfFalse); double value; packet->This >> value; return value; } void sfPacket_readString(sfPacket* packet, char* string) { CSFML_CHECK(packet); if (string) packet->This >> string; } void sfPacket_readWideString(sfPacket* packet, wchar_t* string) { CSFML_CHECK(packet); if (string) packet->This >> string; } //////////////////////////////////////////////////////////// void sfPacket_writeBool(sfPacket* packet, sfBool value) { sfPacket_writeUint8(packet, value ? 1 : 0); } void sfPacket_writeInt8(sfPacket* packet, sfInt8 value) { CSFML_CHECK(packet); packet->This << value; } void sfPacket_writeUint8(sfPacket* packet, sfUint8 value) { CSFML_CHECK(packet); packet->This << value; } void sfPacket_writeInt16(sfPacket* packet, sfInt16 value) { CSFML_CHECK(packet); packet->This << value; } void sfPacket_writeUint16(sfPacket* packet, sfUint16 value) { CSFML_CHECK(packet); packet->This << value; } void sfPacket_writeInt32(sfPacket* packet, sfInt32 value) { CSFML_CHECK(packet); packet->This << value; } void sfPacket_writeUint32(sfPacket* packet, sfUint32 value) { CSFML_CHECK(packet); packet->This << value; } void sfPacket_writeFloat(sfPacket* packet, float value) { CSFML_CHECK(packet); packet->This << value; } void sfPacket_writeDouble(sfPacket* packet, double value) { CSFML_CHECK(packet); packet->This << value; } void sfPacket_writeString(sfPacket* packet, const char* string) { CSFML_CHECK(packet); if (string) packet->This << string; } void sfPacket_writeWideString(sfPacket* packet, const wchar_t* string) { CSFML_CHECK(packet); if (string) packet->This << string; } CSFML-2.4/src/SFML/Network/PacketStruct.h000066400000000000000000000030331301071240500177610ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_PACKETSTRUCT_H #define SFML_PACKETSTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// // Internal structure of sfPacket //////////////////////////////////////////////////////////// struct sfPacket { sf::Packet This; }; #endif // SFML_PACKETSTRUCT_H CSFML-2.4/src/SFML/Network/SocketSelector.cpp000066400000000000000000000101151301071240500206300ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include //////////////////////////////////////////////////////////// sfSocketSelector* sfSocketSelector_create(void) { return new sfSocketSelector; } //////////////////////////////////////////////////////////// sfSocketSelector* sfSocketSelector_copy(const sfSocketSelector* selector) { CSFML_CHECK_RETURN(selector, NULL); return new sfSocketSelector(*selector); } //////////////////////////////////////////////////////////// void sfSocketSelector_destroy(sfSocketSelector* selector) { delete selector; } //////////////////////////////////////////////////////////// void sfSocketSelector_addTcpListener(sfSocketSelector* selector, sfTcpListener* socket) { CSFML_CHECK(socket); CSFML_CALL(selector, add(socket->This)); } void sfSocketSelector_addTcpSocket(sfSocketSelector* selector, sfTcpSocket* socket) { CSFML_CHECK(socket); CSFML_CALL(selector, add(socket->This)); } void sfSocketSelector_addUdpSocket(sfSocketSelector* selector, sfUdpSocket* socket) { CSFML_CHECK(socket); CSFML_CALL(selector, add(socket->This)); } //////////////////////////////////////////////////////////// void sfSocketSelector_removeTcpListener(sfSocketSelector* selector, sfTcpListener* socket) { CSFML_CHECK(socket); CSFML_CALL(selector, remove(socket->This)); } void sfSocketSelector_removeTcpSocket(sfSocketSelector* selector, sfTcpSocket* socket) { CSFML_CHECK(socket); CSFML_CALL(selector, remove(socket->This)); } void sfSocketSelector_removeUdpSocket(sfSocketSelector* selector, sfUdpSocket* socket) { CSFML_CHECK(socket); CSFML_CALL(selector, remove(socket->This)); } //////////////////////////////////////////////////////////// void sfSocketSelector_clear(sfSocketSelector* selector) { CSFML_CALL(selector, clear()); } //////////////////////////////////////////////////////////// sfBool sfSocketSelector_wait(sfSocketSelector* selector, sfTime timeout) { CSFML_CALL_RETURN(selector, wait(sf::microseconds(timeout.microseconds)), sfFalse); } //////////////////////////////////////////////////////////// sfBool sfSocketSelector_isTcpListenerReady(const sfSocketSelector* selector, sfTcpListener* socket) { CSFML_CHECK_RETURN(socket, sfFalse); CSFML_CALL_RETURN(selector, isReady(socket->This), sfFalse); } sfBool sfSocketSelector_isTcpSocketReady(const sfSocketSelector* selector, sfTcpSocket* socket) { CSFML_CHECK_RETURN(socket, sfFalse); CSFML_CALL_RETURN(selector, isReady(socket->This), sfFalse); } sfBool sfSocketSelector_isUdpSocketReady(const sfSocketSelector* selector, sfUdpSocket* socket) { CSFML_CHECK_RETURN(socket, sfFalse); CSFML_CALL_RETURN(selector, isReady(socket->This), sfFalse); } CSFML-2.4/src/SFML/Network/SocketSelectorStruct.h000066400000000000000000000031231301071240500215030ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_SOCKETSELECTORSTRUCT_H #define SFML_SOCKETSELECTORSTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// // Internal structure of sfSocketSelector //////////////////////////////////////////////////////////// struct sfSocketSelector { sf::SocketSelector This; }; #endif // SFML_SOCKETSELECTORSTRUCT_H CSFML-2.4/src/SFML/Network/TcpListener.cpp000066400000000000000000000060361301071240500201420ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include //////////////////////////////////////////////////////////// sfTcpListener* sfTcpListener_create(void) { return new sfTcpListener; } //////////////////////////////////////////////////////////// void sfTcpListener_destroy(sfTcpListener* listener) { delete listener; } //////////////////////////////////////////////////////////// void sfTcpListener_setBlocking(sfTcpListener* listener, sfBool blocking) { CSFML_CALL(listener, setBlocking(blocking == sfTrue)); } //////////////////////////////////////////////////////////// sfBool sfTcpListener_isBlocking(const sfTcpListener* listener) { CSFML_CALL_RETURN(listener, isBlocking(), sfFalse); } //////////////////////////////////////////////////////////// unsigned short sfTcpListener_getLocalPort(const sfTcpListener* listener) { CSFML_CALL_RETURN(listener, getLocalPort(), 0); } //////////////////////////////////////////////////////////// sfSocketStatus sfTcpListener_listen(sfTcpListener* listener, unsigned short port, sfIpAddress address) { CSFML_CHECK_RETURN(listener, sfSocketError); sf::IpAddress sfmlAddress(address.address); return static_cast(listener->This.listen(port, sfmlAddress)); } //////////////////////////////////////////////////////////// sfSocketStatus sfTcpListener_accept(sfTcpListener* listener, sfTcpSocket** connected) { CSFML_CHECK_RETURN(listener, sfSocketError); CSFML_CHECK_RETURN(connected, sfSocketError); *connected = new sfTcpSocket; sfSocketStatus status = static_cast(listener->This.accept((*connected)->This)); if (status != sfSocketDone) { delete *connected; *connected = NULL; } return status; } CSFML-2.4/src/SFML/Network/TcpListenerStruct.h000066400000000000000000000030761301071240500210150ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_TCPLISTENERSTRUCT_H #define SFML_TCPLISTENERSTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// // Internal structure of sfTcpListener //////////////////////////////////////////////////////////// struct sfTcpListener { sf::TcpListener This; }; #endif // SFML_TCPLISTENERSTRUCT_H CSFML-2.4/src/SFML/Network/TcpSocket.cpp000066400000000000000000000117011301071240500176000ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include //////////////////////////////////////////////////////////// sfTcpSocket* sfTcpSocket_create(void) { return new sfTcpSocket; } //////////////////////////////////////////////////////////// void sfTcpSocket_destroy(sfTcpSocket* socket) { delete socket; } //////////////////////////////////////////////////////////// void sfTcpSocket_setBlocking(sfTcpSocket* socket, sfBool blocking) { CSFML_CALL(socket, setBlocking(blocking == sfTrue)); } //////////////////////////////////////////////////////////// sfBool sfTcpSocket_isBlocking(const sfTcpSocket* socket) { CSFML_CALL_RETURN(socket, isBlocking(), sfFalse); } //////////////////////////////////////////////////////////// unsigned short sfTcpSocket_getLocalPort(const sfTcpSocket* socket) { CSFML_CALL_RETURN(socket, getLocalPort(), 0); } //////////////////////////////////////////////////////////// sfIpAddress sfTcpSocket_getRemoteAddress(const sfTcpSocket* socket) { sfIpAddress result = sfIpAddress_None; CSFML_CHECK_RETURN(socket, result); sf::IpAddress address = socket->This.getRemoteAddress(); strncpy(result.address, address.toString().c_str(), 16); return result; } //////////////////////////////////////////////////////////// unsigned short sfTcpSocket_getRemotePort(const sfTcpSocket* socket) { CSFML_CALL_RETURN(socket, getRemotePort(), 0); } //////////////////////////////////////////////////////////// sfSocketStatus sfTcpSocket_connect(sfTcpSocket* socket, sfIpAddress remoteAddress, unsigned short remotePort, sfTime timeout) { sf::IpAddress address(remoteAddress.address); CSFML_CHECK_RETURN(socket, sfSocketError); return static_cast(socket->This.connect(address, remotePort, sf::microseconds(timeout.microseconds))); } //////////////////////////////////////////////////////////// void sfTcpSocket_disconnect(sfTcpSocket* socket) { CSFML_CALL(socket, disconnect()); } //////////////////////////////////////////////////////////// sfSocketStatus sfTcpSocket_send(sfTcpSocket* socket, const void* data, size_t size) { CSFML_CHECK_RETURN(socket, sfSocketError); return static_cast(socket->This.send(data, size)); } //////////////////////////////////////////////////////////// sfSocketStatus sfTcpSocket_sendPartial(sfTcpSocket* socket, const void* data, size_t size, size_t* sent) { CSFML_CHECK_RETURN(socket, sfSocketError); return static_cast(socket->This.send(data, size, *sent)); } //////////////////////////////////////////////////////////// sfSocketStatus sfTcpSocket_receive(sfTcpSocket* socket, void* data, size_t size, size_t* received) { CSFML_CHECK_RETURN(socket, sfSocketError); if (received) { return static_cast(socket->This.receive(data, size, *received)); } else { std::size_t tempReceived = 0; return static_cast(socket->This.receive(data, size, tempReceived)); } } //////////////////////////////////////////////////////////// sfSocketStatus sfTcpSocket_sendPacket(sfTcpSocket* socket, sfPacket* packet) { CSFML_CHECK_RETURN(socket, sfSocketError); CSFML_CHECK_RETURN(packet, sfSocketError); return static_cast(socket->This.send(packet->This)); } //////////////////////////////////////////////////////////// sfSocketStatus sfTcpSocket_receivePacket(sfTcpSocket* socket, sfPacket* packet) { CSFML_CHECK_RETURN(socket, sfSocketError); CSFML_CHECK_RETURN(packet, sfSocketError); return static_cast(socket->This.receive(packet->This)); } CSFML-2.4/src/SFML/Network/TcpSocketStruct.h000066400000000000000000000030601301071240500204510ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_TCPSOCKETSTRUCT_H #define SFML_TCPSOCKETSTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// // Internal structure of sfTcpSocket //////////////////////////////////////////////////////////// struct sfTcpSocket { sf::TcpSocket This; }; #endif // SFML_TCPSOCKETSTRUCT_H CSFML-2.4/src/SFML/Network/UdpSocket.cpp000066400000000000000000000121641301071240500176060ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include #include //////////////////////////////////////////////////////////// sfUdpSocket* sfUdpSocket_create(void) { return new sfUdpSocket; } //////////////////////////////////////////////////////////// void sfUdpSocket_destroy(sfUdpSocket* socket) { delete socket; } //////////////////////////////////////////////////////////// void sfUdpSocket_setBlocking(sfUdpSocket* socket, sfBool blocking) { CSFML_CALL(socket, setBlocking(blocking == sfTrue)); } //////////////////////////////////////////////////////////// sfBool sfUdpSocket_isBlocking(const sfUdpSocket* socket) { CSFML_CALL_RETURN(socket, isBlocking(), sfFalse); } //////////////////////////////////////////////////////////// unsigned short sfUdpSocket_getLocalPort(const sfUdpSocket* socket) { CSFML_CALL_RETURN(socket, getLocalPort(), 0); } //////////////////////////////////////////////////////////// sfSocketStatus sfUdpSocket_bind(sfUdpSocket* socket, unsigned short port, sfIpAddress address) { CSFML_CHECK_RETURN(socket, sfSocketError); sf::IpAddress sfmlAddress(address.address); return static_cast(socket->This.bind(port, sfmlAddress)); } //////////////////////////////////////////////////////////// void sfUdpSocket_unbind(sfUdpSocket* socket) { CSFML_CALL(socket, unbind()); } //////////////////////////////////////////////////////////// sfSocketStatus sfUdpSocket_send(sfUdpSocket* socket, const void* data, size_t size, sfIpAddress remoteAddress, unsigned short remotePort) { CSFML_CHECK_RETURN(socket, sfSocketError); // Convert the address sf::IpAddress address(remoteAddress.address); return static_cast(socket->This.send(data, size, address, remotePort)); } //////////////////////////////////////////////////////////// sfSocketStatus sfUdpSocket_receive(sfUdpSocket* socket, void* data, size_t size, size_t* received, sfIpAddress* remoteAddress, unsigned short* remotePort) { CSFML_CHECK_RETURN(socket, sfSocketError); sf::IpAddress address; unsigned short port; std::size_t sizeReceived; sf::Socket::Status status = socket->This.receive(data, size, sizeReceived, address, port); if (status != sf::Socket::Done) return static_cast(status); if (received) *received = sizeReceived; if (remoteAddress) strncpy(remoteAddress->address, address.toString().c_str(), 16); if (remotePort) *remotePort = port; return sfSocketDone; } //////////////////////////////////////////////////////////// sfSocketStatus sfUdpSocket_sendPacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress remoteAddress, unsigned short remotePort) { CSFML_CHECK_RETURN(socket, sfSocketError); CSFML_CHECK_RETURN(packet, sfSocketError); // Convert the address sf::IpAddress address(remoteAddress.address); return static_cast(socket->This.send(packet->This, address, remotePort)); } //////////////////////////////////////////////////////////// sfSocketStatus sfUdpSocket_receivePacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress* remoteAddress, unsigned short* remotePort) { CSFML_CHECK_RETURN(socket, sfSocketError); CSFML_CHECK_RETURN(packet, sfSocketError); sf::IpAddress address; unsigned short port; sf::Socket::Status status = socket->This.receive(packet->This, address, port); if (status != sf::Socket::Done) return static_cast(status); if (remoteAddress) strncpy(remoteAddress->address, address.toString().c_str(), 16); if (remotePort) *remotePort = port; return sfSocketDone; } //////////////////////////////////////////////////////////// unsigned int sfUdpSocket_maxDatagramSize() { return sf::UdpSocket::MaxDatagramSize; } CSFML-2.4/src/SFML/Network/UdpSocketStruct.h000066400000000000000000000030601301071240500204530ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_UDPSOCKETSTRUCT_H #define SFML_UDPSOCKETSTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// // Internal structure of sfUdpSocket //////////////////////////////////////////////////////////// struct sfUdpSocket { sf::UdpSocket This; }; #endif // SFML_UDPSOCKETSTRUCT_H CSFML-2.4/src/SFML/System/000077500000000000000000000000001301071240500150305ustar00rootroot00000000000000CSFML-2.4/src/SFML/System/CMakeLists.txt000066400000000000000000000013731301071240500175740ustar00rootroot00000000000000 set(INCROOT ${CMAKE_SOURCE_DIR}/include/SFML/System) set(SRCROOT ${CMAKE_SOURCE_DIR}/src/SFML/System) # all source files set(SRC ${INCROOT}/Export.h ${SRCROOT}/Clock.cpp ${SRCROOT}/ClockStruct.h ${INCROOT}/Clock.h ${INCROOT}/InputStream.h ${SRCROOT}/Mutex.cpp ${SRCROOT}/MutexStruct.h ${INCROOT}/Mutex.h ${SRCROOT}/Sleep.cpp ${INCROOT}/Sleep.h ${SRCROOT}/Thread.cpp ${SRCROOT}/ThreadStruct.h ${INCROOT}/Thread.h ${SRCROOT}/Time.cpp ${INCROOT}/Time.h ${INCROOT}/Types.h ${INCROOT}/Vector2.h ${INCROOT}/Vector3.h ) # define the csfml-system target csfml_add_library(csfml-system SOURCES ${SRC} DEPENDS ${SFML_SYSTEM_LIBRARY} ${SFML_SYSTEM_DEPENDENCIES}) CSFML-2.4/src/SFML/System/Clock.cpp000066400000000000000000000043321301071240500165710ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// sfClock* sfClock_create(void) { return new sfClock; } //////////////////////////////////////////////////////////// sfClock* sfClock_copy(const sfClock* clock) { CSFML_CHECK_RETURN(clock, NULL); return new sfClock(*clock); } //////////////////////////////////////////////////////////// void sfClock_destroy(sfClock* clock) { delete clock; } //////////////////////////////////////////////////////////// sfTime sfClock_getElapsedTime(const sfClock* clock) { CSFML_CHECK_RETURN(clock, sfTime_Zero); sf::Time time = clock->This.getElapsedTime(); return sfMicroseconds(time.asMicroseconds()); } //////////////////////////////////////////////////////////// sfTime sfClock_restart(sfClock* clock) { CSFML_CHECK_RETURN(clock, sfTime_Zero); sf::Time time = clock->This.restart(); return sfMicroseconds(time.asMicroseconds()); } CSFML-2.4/src/SFML/System/ClockStruct.h000066400000000000000000000030231301071240500174370ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_CLOCKSTRUCT_H #define SFML_CLOCKSTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// // Internal structure of sfClock //////////////////////////////////////////////////////////// struct sfClock { sf::Clock This; }; #endif // SFML_CLOCKSTRUCT_H CSFML-2.4/src/SFML/System/Mutex.cpp000066400000000000000000000034651301071240500166460ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// sfMutex* sfMutex_create(void) { return new sfMutex; } //////////////////////////////////////////////////////////// void sfMutex_destroy(sfMutex* mutex) { delete mutex; } //////////////////////////////////////////////////////////// void sfMutex_lock(sfMutex* mutex) { CSFML_CALL(mutex, lock()); } //////////////////////////////////////////////////////////// void sfMutex_unlock(sfMutex* mutex) { CSFML_CALL(mutex, unlock()); } CSFML-2.4/src/SFML/System/MutexStruct.h000066400000000000000000000030231301071240500175060ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_MUTEXSTRUCT_H #define SFML_MUTEXSTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// // Internal structure of sfMutex //////////////////////////////////////////////////////////// struct sfMutex { sf::Mutex This; }; #endif // SFML_MUTEXSTRUCT_H CSFML-2.4/src/SFML/System/Sleep.cpp000066400000000000000000000027131301071240500166070ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// void sfSleep(sfTime duration) { sf::sleep(sf::microseconds(duration.microseconds)); } CSFML-2.4/src/SFML/System/Thread.cpp000066400000000000000000000040171301071240500167450ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// sfThread* sfThread_create(void (*function)(void*), void* userData) { return new sfThread(function, userData); } //////////////////////////////////////////////////////////// void sfThread_destroy(sfThread* thread) { delete thread; } //////////////////////////////////////////////////////////// void sfThread_launch(sfThread* thread) { CSFML_CALL(thread, launch()); } //////////////////////////////////////////////////////////// void sfThread_wait(sfThread* thread) { CSFML_CALL(thread, wait()); } //////////////////////////////////////////////////////////// void sfThread_terminate(sfThread* thread) { CSFML_CALL(thread, terminate()); } CSFML-2.4/src/SFML/System/ThreadStruct.h000066400000000000000000000031741301071240500176220ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_THREADSTRUCT_H #define SFML_THREADSTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// // Internal structure of sfThread //////////////////////////////////////////////////////////// struct sfThread { sfThread(void (*function)(void*), void* userData) : This(function, userData) { } sf::Thread This; }; #endif // SFML_THREADSTRUCT_H CSFML-2.4/src/SFML/System/Time.cpp000066400000000000000000000045161301071240500164400ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// sfTime sfTime_Zero = {0}; //////////////////////////////////////////////////////////// float sfTime_asSeconds(sfTime time) { return time.microseconds / 1000000.f; } //////////////////////////////////////////////////////////// sfInt32 sfTime_asMilliseconds(sfTime time) { return static_cast(time.microseconds / 1000); } //////////////////////////////////////////////////////////// sfInt64 sfTime_asMicroseconds(sfTime time) { return time.microseconds; } //////////////////////////////////////////////////////////// sfTime sfSeconds(float amount) { sfTime time; time.microseconds = static_cast(amount * 1000000); return time; } //////////////////////////////////////////////////////////// sfTime sfMilliseconds(sfInt32 amount) { sfTime time; time.microseconds = static_cast(amount) * 1000; return time; } //////////////////////////////////////////////////////////// sfTime sfMicroseconds(sfInt64 amount) { sfTime time; time.microseconds = amount; return time; } CSFML-2.4/src/SFML/Window/000077500000000000000000000000001301071240500150135ustar00rootroot00000000000000CSFML-2.4/src/SFML/Window/CMakeLists.txt000066400000000000000000000017661301071240500175650ustar00rootroot00000000000000 set(INCROOT ${CMAKE_SOURCE_DIR}/include/SFML/Window) set(SRCROOT ${CMAKE_SOURCE_DIR}/src/SFML/Window) # all source files set(SRC ${INCROOT}/Export.h ${SRCROOT}/Context.cpp ${SRCROOT}/ContextSettingsInternal.h ${SRCROOT}/ContextStruct.h ${INCROOT}/Context.h ${INCROOT}/Event.h ${SRCROOT}/Joystick.cpp ${INCROOT}/Joystick.h ${INCROOT}/JoystickIdentification.h ${SRCROOT}/Keyboard.cpp ${INCROOT}/Keyboard.h ${SRCROOT}/Mouse.cpp ${INCROOT}/Mouse.h ${SRCROOT}/Sensor.cpp ${INCROOT}/Sensor.h ${SRCROOT}/Touch.cpp ${INCROOT}/Touch.h ${INCROOT}/Types.h ${SRCROOT}/VideoMode.cpp ${INCROOT}/VideoMode.h ${SRCROOT}/Window.cpp ${SRCROOT}/WindowStruct.h ${INCROOT}/Window.h ${INCROOT}/WindowHandle.h ) # define the csfml-window target csfml_add_library(csfml-window SOURCES ${SRC} DEPENDS ${SFML_WINDOW_LIBRARY} ${SFML_SYSTEM_LIBRARY} ${SFML_WINDOW_DEPENDENCIES} ${SFML_SYSTEM_DEPENDENCIES}) CSFML-2.4/src/SFML/Window/Context.cpp000066400000000000000000000042671301071240500171540ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include //////////////////////////////////////////////////////////// sfContext* sfContext_create(void) { return new sfContext; } //////////////////////////////////////////////////////////// void sfContext_destroy(sfContext* context) { delete context; } //////////////////////////////////////////////////////////// sfBool sfContext_setActive(sfContext* context, sfBool active) { CSFML_CALL_RETURN(context, setActive(active == sfTrue), false) } //////////////////////////////////////////////////////////// sfContextSettings sfContext_getSettings(const sfContext* context) { sfContextSettings settings = priv::sfContextSettings_null(); CSFML_CHECK_RETURN(context, settings); const sf::ContextSettings& params = context->This.getSettings(); priv::sfContextSettings_readFromCpp(params, settings); return settings; } CSFML-2.4/src/SFML/Window/ContextSettingsInternal.h000066400000000000000000000061371301071240500220350ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2016 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_CONTEXTSETTINGSINTERNAL_H #define SFML_CONTEXTSETTINGSINTERNAL_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include namespace priv { //////////////////////////////////////////////////////////// // Create a "null" sfContextSettings that's returned in case of an error. //////////////////////////////////////////////////////////// inline sfContextSettings sfContextSettings_null() { sfContextSettings settings = {0, 0, 0, 0, 0, 0, sfFalse}; return settings; } //////////////////////////////////////////////////////////// // Read the data of an sf::ContextSettings into an sfContextSettings //////////////////////////////////////////////////////////// inline void sfContextSettings_readFromCpp(const sf::ContextSettings& from, sfContextSettings& to) { to.depthBits = from.depthBits; to.stencilBits = from.stencilBits; to.antialiasingLevel = from.antialiasingLevel; to.majorVersion = from.majorVersion; to.minorVersion = from.minorVersion; to.attributeFlags = from.attributeFlags; to.sRgbCapable = from.sRgbCapable ? sfTrue : sfFalse; } //////////////////////////////////////////////////////////// // Write the data of an sfContextSettings into an sf::ContextSettings //////////////////////////////////////////////////////////// inline void sfContextSettings_writeToCpp(const sfContextSettings& from, sf::ContextSettings& to) { to.depthBits = from.depthBits; to.stencilBits = from.stencilBits; to.antialiasingLevel = from.antialiasingLevel; to.majorVersion = from.majorVersion; to.minorVersion = from.minorVersion; to.attributeFlags = from.attributeFlags; to.sRgbCapable = from.sRgbCapable == sfTrue; } } #endif // SFML_CONTEXTSETTINGSINTERNAL_H CSFML-2.4/src/SFML/Window/ContextStruct.h000066400000000000000000000030411301071240500200130ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_CONTEXTSTRUCT_H #define SFML_CONTEXTSTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// // Internal structure of sfContext //////////////////////////////////////////////////////////// struct sfContext { sf::Context This; }; #endif // SFML_CONTEXTSTRUCT_H CSFML-2.4/src/SFML/Window/Joystick.cpp000066400000000000000000000057011301071240500173210ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// sfBool sfJoystick_isConnected(unsigned int joystick) { return sf::Joystick::isConnected(joystick) ? sfTrue : sfFalse; } //////////////////////////////////////////////////////////// unsigned int sfJoystick_getButtonCount(unsigned int joystick) { return sf::Joystick::getButtonCount(joystick); } //////////////////////////////////////////////////////////// sfBool sfJoystick_hasAxis(unsigned int joystick, sfJoystickAxis axis) { return sf::Joystick::hasAxis(joystick, static_cast(axis)) ? sfTrue : sfFalse; } //////////////////////////////////////////////////////////// sfBool sfJoystick_isButtonPressed(unsigned int joystick, unsigned int button) { return sf::Joystick::isButtonPressed(joystick, button) ? sfTrue : sfFalse; } //////////////////////////////////////////////////////////// float sfJoystick_getAxisPosition(unsigned int joystick, sfJoystickAxis axis) { return sf::Joystick::getAxisPosition(joystick, static_cast(axis)); } //////////////////////////////////////////////////////////// sfJoystickIdentification sfJoystick_getIdentification(unsigned int joystick) { static std::string name; sf::Joystick::Identification identification = sf::Joystick::getIdentification(joystick); name = identification.name; sfJoystickIdentification result; result.name = name.c_str(); result.productId = identification.productId; result.vendorId = identification.vendorId; return result; } //////////////////////////////////////////////////////////// void sfJoystick_update(void) { sf::Joystick::update(); } CSFML-2.4/src/SFML/Window/Keyboard.cpp000066400000000000000000000032611301071240500172610ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// sfBool sfKeyboard_isKeyPressed(sfKeyCode key) { return sf::Keyboard::isKeyPressed(static_cast(key)); } //////////////////////////////////////////////////////////// void sfKeyboard_setVirtualKeyboardVisible(sfBool visible) { sf::Keyboard::setVirtualKeyboardVisible(visible == sfTrue); } CSFML-2.4/src/SFML/Window/Mouse.cpp000066400000000000000000000043371301071240500166160ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include //////////////////////////////////////////////////////////// sfBool sfMouse_isButtonPressed(sfMouseButton button) { return sf::Mouse::isButtonPressed(static_cast(button)) ? sfTrue : sfFalse; } //////////////////////////////////////////////////////////// sfVector2i sfMouse_getPosition(const sfWindow* relativeTo) { sf::Vector2i sfmlPos; if (relativeTo) sfmlPos = sf::Mouse::getPosition(relativeTo->This); else sfmlPos = sf::Mouse::getPosition(); sfVector2i position = {sfmlPos.x, sfmlPos.y}; return position; } //////////////////////////////////////////////////////////// void sfMouse_setPosition(sfVector2i position, const sfWindow* relativeTo) { if (relativeTo) sf::Mouse::setPosition(sf::Vector2i(position.x, position.y), relativeTo->This); else sf::Mouse::setPosition(sf::Vector2i(position.x, position.y)); } CSFML-2.4/src/SFML/Window/Sensor.cpp000066400000000000000000000037521301071240500167770ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// sfBool sfSensor_isAvailable(sfSensorType sensor) { return sf::Sensor::isAvailable(static_cast(sensor)); } //////////////////////////////////////////////////////////// void sfSensor_setEnabled(sfSensorType sensor, sfBool enabled) { sf::Sensor::setEnabled(static_cast(sensor), enabled == sfTrue); } //////////////////////////////////////////////////////////// sfVector3f sfSensor_getValue(sfSensorType sensor) { sf::Vector3f sfmlValue = sf::Sensor::getValue(static_cast(sensor)); sfVector3f value = {sfmlValue.x, sfmlValue.y, sfmlValue.z}; return value; } CSFML-2.4/src/SFML/Window/Touch.cpp000066400000000000000000000036161301071240500166070ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include //////////////////////////////////////////////////////////// sfBool sfTouch_isDown(unsigned int finger) { return sf::Touch::isDown(finger); } //////////////////////////////////////////////////////////// sfVector2i sfTouch_getPosition(unsigned int finger, const sfWindow* relativeTo) { sf::Vector2i sfmlPosition; if (relativeTo) sfmlPosition = sf::Touch::getPosition(finger, relativeTo->This); else sfmlPosition = sf::Touch::getPosition(finger); sfVector2i position = {sfmlPosition.x, sfmlPosition.y}; return position; } CSFML-2.4/src/SFML/Window/VideoMode.cpp000066400000000000000000000051621301071240500173760ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include //////////////////////////////////////////////////////////// sfVideoMode sfVideoMode_getDesktopMode(void) { sf::VideoMode desktop = sf::VideoMode::getDesktopMode(); sfVideoMode ret; ret.width = desktop.width; ret.height = desktop.height; ret.bitsPerPixel = desktop.bitsPerPixel; return ret; } //////////////////////////////////////////////////////////// const sfVideoMode* sfVideoMode_getFullscreenModes(size_t* count) { static std::vector modes; // Populate the array on first call if (modes.empty()) { const std::vector& SFMLModes = sf::VideoMode::getFullscreenModes(); for (std::vector::const_iterator it = SFMLModes.begin(); it != SFMLModes.end(); ++it) { sfVideoMode mode; mode.width = it->width; mode.height = it->height; mode.bitsPerPixel = it->bitsPerPixel; modes.push_back(mode); } } if (count) *count = modes.size(); return !modes.empty() ? &modes[0] : NULL; } //////////////////////////////////////////////////////////// sfBool sfVideoMode_isValid(sfVideoMode mode) { sf::VideoMode videoMode(mode.width, mode.height, mode.bitsPerPixel); return videoMode.isValid() ? sfTrue : sfFalse; } CSFML-2.4/src/SFML/Window/Window.cpp000066400000000000000000000207131301071240500167710ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include #include #include #include #include //////////////////////////////////////////////////////////// sfWindow* sfWindow_create(sfVideoMode mode, const char* title, sfUint32 style, const sfContextSettings* settings) { // Convert video mode sf::VideoMode videoMode(mode.width, mode.height, mode.bitsPerPixel); // Convert context settings sf::ContextSettings params; if (settings) { priv::sfContextSettings_writeToCpp(*settings, params); } // Create the window sfWindow* window = new sfWindow; window->This.create(videoMode, title, style, params); return window; } //////////////////////////////////////////////////////////// sfWindow* sfWindow_createUnicode(sfVideoMode mode, const sfUint32* title, sfUint32 style, const sfContextSettings* settings) { // Convert video mode sf::VideoMode videoMode(mode.width, mode.height, mode.bitsPerPixel); // Convert context settings sf::ContextSettings params; if (settings) { priv::sfContextSettings_writeToCpp(*settings, params); } // Create the window sfWindow* window = new sfWindow; window->This.create(videoMode, title, style, params); return window; } //////////////////////////////////////////////////////////// sfWindow* sfWindow_createFromHandle(sfWindowHandle handle, const sfContextSettings* settings) { // Convert context settings sf::ContextSettings params; if (settings) { priv::sfContextSettings_writeToCpp(*settings, params); } // Create the window sfWindow* window = new sfWindow; window->This.create(handle, params); return window; } //////////////////////////////////////////////////////////// void sfWindow_destroy(sfWindow* window) { delete window; } //////////////////////////////////////////////////////////// void sfWindow_close(sfWindow* window) { CSFML_CALL(window, close()); } //////////////////////////////////////////////////////////// sfBool sfWindow_isOpen(const sfWindow* window) { CSFML_CALL_RETURN(window, isOpen(), sfFalse); } //////////////////////////////////////////////////////////// sfContextSettings sfWindow_getSettings(const sfWindow* window) { sfContextSettings settings = priv::sfContextSettings_null(); CSFML_CHECK_RETURN(window, settings); const sf::ContextSettings& params = window->This.getSettings(); priv::sfContextSettings_readFromCpp(params, settings); return settings; } //////////////////////////////////////////////////////////// sfBool sfWindow_pollEvent(sfWindow* window, sfEvent* event) { CSFML_CHECK_RETURN(window, sfFalse); CSFML_CHECK_RETURN(event, sfFalse); // Get the event sf::Event SFMLEvent; sfBool ret = window->This.pollEvent(SFMLEvent); // No event, return if (!ret) return sfFalse; // Convert the sf::Event event to a sfEvent convertEvent(SFMLEvent, event); return sfTrue; } //////////////////////////////////////////////////////////// sfBool sfWindow_waitEvent(sfWindow* window, sfEvent* event) { CSFML_CHECK_RETURN(window, sfFalse); CSFML_CHECK_RETURN(event, sfFalse); // Get the event sf::Event SFMLEvent; sfBool ret = window->This.waitEvent(SFMLEvent); // Error, return if (!ret) return sfFalse; // Convert the sf::Event event to a sfEvent convertEvent(SFMLEvent, event); return sfTrue; } //////////////////////////////////////////////////////////// sfVector2i sfWindow_getPosition(const sfWindow* window) { sfVector2i position = {0, 0}; CSFML_CHECK_RETURN(window, position); sf::Vector2i sfmlPos = window->This.getPosition(); position.x = sfmlPos.x; position.y = sfmlPos.y; return position; } //////////////////////////////////////////////////////////// void sfWindow_setPosition(sfWindow* window, sfVector2i position) { CSFML_CALL(window, setPosition(sf::Vector2i(position.x, position.y))); } //////////////////////////////////////////////////////////// sfVector2u sfWindow_getSize(const sfWindow* window) { sfVector2u size = {0, 0}; CSFML_CHECK_RETURN(window, size); sf::Vector2u sfmlSize = window->This.getSize(); size.x = sfmlSize.x; size.y = sfmlSize.y; return size; } //////////////////////////////////////////////////////////// void sfWindow_setSize(sfWindow* window, sfVector2u size) { CSFML_CALL(window, setSize(sf::Vector2u(size.x, size.y))); } //////////////////////////////////////////////////////////// void sfWindow_setTitle(sfWindow* window, const char* title) { CSFML_CALL(window, setTitle(title)); } //////////////////////////////////////////////////////////// void sfWindow_setUnicodeTitle(sfWindow* window, const sfUint32* title) { CSFML_CALL(window, setTitle(title)); } //////////////////////////////////////////////////////////// void sfWindow_setIcon(sfWindow* window, unsigned int width, unsigned int height, const sfUint8* pixels) { CSFML_CALL(window, setIcon(width, height, pixels)); } //////////////////////////////////////////////////////////// void sfWindow_setVisible(sfWindow* window, sfBool visible) { CSFML_CALL(window, setVisible(visible == sfTrue)); } //////////////////////////////////////////////////////////// void sfWindow_setMouseCursorVisible(sfWindow* window, sfBool visible) { CSFML_CALL(window, setMouseCursorVisible(visible == sfTrue)); } //////////////////////////////////////////////////////////// void sfWindow_setMouseCursorGrabbed(sfWindow* window, sfBool grabbed) { CSFML_CALL(window, setMouseCursorGrabbed(grabbed == sfTrue)); } //////////////////////////////////////////////////////////// void sfWindow_setVerticalSyncEnabled(sfWindow* window, sfBool enabled) { CSFML_CALL(window, setVerticalSyncEnabled(enabled == sfTrue)); } //////////////////////////////////////////////////////////// void sfWindow_setKeyRepeatEnabled(sfWindow* window, sfBool enabled) { CSFML_CALL(window, setKeyRepeatEnabled(enabled == sfTrue)); } //////////////////////////////////////////////////////////// sfBool sfWindow_setActive(sfWindow* window, sfBool active) { CSFML_CALL_RETURN(window, setActive(active == sfTrue), sfFalse); } //////////////////////////////////////////////////////////// void sfWindow_requestFocus(sfWindow* window) { CSFML_CALL(window, requestFocus()); } //////////////////////////////////////////////////////////// sfBool sfWindow_hasFocus(const sfWindow* window) { CSFML_CALL_RETURN(window, hasFocus(), sfFalse); } //////////////////////////////////////////////////////////// void sfWindow_display(sfWindow* window) { CSFML_CALL(window, display()); } //////////////////////////////////////////////////////////// void sfWindow_setFramerateLimit(sfWindow* window, unsigned int limit) { CSFML_CALL(window, setFramerateLimit(limit)); } //////////////////////////////////////////////////////////// void sfWindow_setJoystickThreshold(sfWindow* window, float threshold) { CSFML_CALL(window, setJoystickThreshold(threshold)); } //////////////////////////////////////////////////////////// sfWindowHandle sfWindow_getSystemHandle(const sfWindow* window) { CSFML_CHECK_RETURN(window, 0); return (sfWindowHandle)window->This.getSystemHandle(); } CSFML-2.4/src/SFML/Window/WindowStruct.h000066400000000000000000000030321301071240500176360ustar00rootroot00000000000000//////////////////////////////////////////////////////////// // // SFML - Simple and Fast Multimedia Library // Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // //////////////////////////////////////////////////////////// #ifndef SFML_WINDOWSTRUCT_H #define SFML_WINDOWSTRUCT_H //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include //////////////////////////////////////////////////////////// // Internal structure of sfWindow //////////////////////////////////////////////////////////// struct sfWindow { sf::Window This; }; #endif // SFML_WINDOWSTRUCT_H