209 Commits
Author SHA1 Message Date
Lukas Dürrenberger f84ff413a1 Update CSFML version to 2.5.1
- Add macOS build script
- Update existing nuget build script
2021-07-11 16:54:41 +02:00
Davipb 76671cf453 Change 'net' TFM to 'netframework' 2021-05-12 00:55:16 +02:00
Davipb ea8048376f Add icon on package 2021-03-01 15:19:41 +01:00
Davipb 063923308f Add build error for AnyCPU on .NET Framework 2021-03-01 15:19:41 +01:00
Lukas Dürrenberger 99cea94aaf Add GitHub actions for Windows, Linux and macOS 2021-02-19 20:48:44 +01:00
Jairard@Windows ffb5763206 Fix compilation and add check in sfTexture_updateFromTexture 2019-11-22 13:26:00 +01:00
asumface 0f8209fade Remove stray semicolon 2019-11-22 12:53:20 +01:00
DemoXin 7627ef1c5d Implement sfTexture_updateFromTexture
Method was declared, but not implemented. Also corrects an EntryPointNotFound exception in SFML.NET
2019-07-17 17:51:29 +02:00
crumblingstatue cdc9bc6a21 Fix incorrect sfRenderTexture_createWithSettings header signature 2019-07-17 16:05:43 +02:00
Laurent Gomila 282621e499 Merge pull request #139 from DJMaster/patch-1
Update RenderTexture.h
2019-03-23 18:35:41 +01:00
DJMaster 1c75ff0546 Update RenderTexture.h
CSFML_GRAPHICS_API is missing
2019-03-23 18:22:42 +01:00
Davipb d6f3ec2f34 Fix $OutDir vestiges 2019-01-23 22:59:18 +01:00
Davipb b189a4e168 Fix Windows script for non-existing runtimes folder 2019-01-23 22:59:18 +01:00
Davipb d8e19e74ed Add NuGet package tools 2019-01-23 22:59:18 +01:00
Lukas Dürrenberger 61f17e3c1d Merge pull request #130 from DemoXinMC/master
sfText_getLineSpacing is not properly declared in Text.h
2018-11-19 21:24:58 +01:00
Demo Xin 93c8f8ee21 * Corrected Text.h getLineSpacing to the proper name sfText_getLineSpacing 2018-11-10 09:08:40 -05:00
Zachariah Brown bff4a69a73 Fixed an issue where it was impossible to link against static SFML libs on non Windows platforms 2018-10-06 20:46:13 +02:00
Lukas Dürrenberger 3b41d938f9 Merge pull request #128 from SFML/bugfix/doc_gen
Update the doxygen file and made adjustments for the latest doxygen version
2018-08-20 08:40:04 +02:00
Lukas Dürrenberger 05847516fd Merge pull request #127 from spacechase0/update-2.5.0
Update for SFML 2.5.0
2018-08-20 08:38:28 +02:00
spacechase0 eb4a9cfe1d Update copyright year 2018-06-05 14:05:52 -04:00
spacechase0 7ef69e3b1c Update for 2.5.0 2018-06-05 14:05:52 -04:00
Lukas Dürrenberger 643abd95ea Update the doxygen file and made adjustments for the latest doxygen version 2018-06-02 12:09:45 +02:00
Laurent Gomila 75f95202b7 Merge pull request #123 from DJMaster/master
Comments fixed
2017-08-28 06:22:29 +02:00
DJMaster fed0b38279 Comments fixed 2017-08-27 19:49:18 +02:00
Laurent Gomila 55e03e92be Merge pull request #122 from crumblingstatue/font-missing-const
Add missing const qualifiers to sfFont methods
2017-03-11 11:53:07 +01:00
Mika Attila b4163081ba Add missing const qualifiers to sfFont methods 2017-03-11 11:42:07 +01:00
Laurent Gomila b5facb85d1 Merge pull request #120 from crumblingstatue/master
Add setVirtualKeyboardVisible
2016-11-09 22:28:37 +01:00
Mika Attila 55be7dbfd6 Add setVirtualKeyboardVisible 2016-11-09 18:47:33 +01:00
Laurent Gomila bca82a4c6b Merge pull request #119 from crumblingstatue/master
Inline the functions in ContextSettingsInternal
2016-11-05 16:44:39 +01:00
Mika Attila 6dca26ed3c Inline the functions in ContextSettingsInternal
This solves a visibility problem when linking dynamically against
csfml-graphics.
2016-10-31 16:01:34 +01:00
Laurent Gomila 8ec6eb094f Merge pull request #117 from crumblingstatue/master
Add sRgbCapable field to sfContextSettings
2016-10-31 14:32:43 +01:00
Mika Attila aed28415ed Add sRgbCapable field to sfContextSettings 2016-10-31 14:05:21 +01:00
Mika Attila 2e47e5dbda Deduplicate code for sfContextSettings (#116)
Deduplicate code for sfContextSettings
2016-10-31 13:32:34 +01:00
Laurent Gomila 1226d9db94 Merge pull request #114 from crumblingstatue/context-get-settings
Add missing sfContext_getSettings
2016-10-25 17:27:07 +02:00
Mika Attila 57eda5f923 Add missing sfContext_getSettings 2016-10-25 15:28:22 +02:00
Laurent Gomila dbc7147b47 Merge pull request #113 from crumblingstatue/master
Have sfContext_setActive return sfBool instead of void
2016-10-25 14:00:49 +02:00
Mika Attila b56ca39562 Update docs for sfContext_setActive 2016-10-25 13:53:41 +02:00
Mika Attila 52c7de16f0 Have sfContext_setActive return sfBool instead of void
Return the result of sf::Context::setActive instead of discarding it.
2016-10-25 13:50:09 +02:00
Laurent Gomila 4d35e0a91c Merge pull request #112 from SFML/bugfix/bumpversion
Bump version number in Config.h
2016-10-09 19:28:15 +02:00
Marco Antognini 16c3b6936a Bump version number in Config.h 2016-10-09 17:00:14 +02:00
Laurent Gomila 2aee52d65f Merge pull request #109 from DJMaster/patch-1
Added missing headers separator
2016-10-04 06:22:52 +02:00
DJMaster 94558cdb63 Added missing headers separator 2016-10-03 23:03:12 +02:00
Laurent Gomila f512854b54 Merge pull request #107 from DJMaster/master
SFML\Graphics\PrimitiveType.h Typo fix
2016-10-01 14:59:07 +02:00
DJMaster d78a8bfa33 Typo fix 2016-10-01 13:29:56 +02:00
Laurent Gomila 2017578197 Merge pull request #106 from dabbertorres/2.4
Correct #105 and bump CMakeLists.txt version
2016-10-01 09:15:20 +02:00
Alec Iverson 6ec6c104a8 Bumped CMakeLists.txt version to 2.4. 2016-09-30 09:12:57 -07:00
Alec Iverson 4e269cf863 Correct sfGlslBVec* members to sfBool from bool.
Corrected sfShader_setBvec*Uniform()s accordingly.

Fixes #105.
2016-09-30 09:11:52 -07:00
Laurent Gomila e4e1bcb139 Merge pull request #104 from crumblingstatue/master
Add missing header for size_t in Shader.h
2016-09-29 13:40:01 +02:00
Mika Attila 45fe62b7ed Strip trailing whitespace in Shader.h 2016-09-29 13:31:19 +02:00
Mika Attila a192e85345 Add missing header for size_t in Shader.h
This fixes a build error with GCC 6
2016-09-29 13:30:25 +02:00
Laurent Gomila 0e8c6379f0 Merge pull request #102 from dabbertorres/2.4
Update to 2.4
2016-09-29 11:17:42 +02:00
Laurent Gomila 8a7ba8ae8e Merge pull request #101 from DJMaster/audio-patch
Added return value to function sfSoundBufferRecorder_start
2016-08-18 22:30:19 +02:00
Alec Iverson 9df98d8c17 Merge 'djmaster/shader-patch' into 2.4
Fixes shader loading.
2016-08-13 01:04:38 -07:00
Laurent Gomila 14653882ae Merge pull request #103 from DJMaster/doxyfile-patch
Removed MSCGEN_PATH local settings
2016-08-13 09:13:19 +02:00
DJMaster 3f63678eaa Removed MSCGEN_PATH local settings 2016-08-13 07:46:14 +02:00
Alec Iverson ac9b33dd1a Merge pull request #1 from DJMaster/audio-patch
Added return value to function sfSoundBufferRecorder_start
2016-08-12 17:03:04 -07:00
Alec Iverson 470bf3d190 Correctly deprecated sfMouseWheelEvent.
Corrected some spacing/alignment.
2016-08-12 16:57:01 -07:00
Alec Iverson 41fa94478a Added address arg to listen/bind on (sockets) 2016-08-12 16:29:42 -07:00
Alec Iverson 3c70f99028 Added stereo recording support to sfSoundRecorder. 2016-08-12 16:04:24 -07:00
Alec Iverson 15995fa19c Fixed spacing... 2016-08-12 16:04:14 -07:00
Alec Iverson 962a685570 Added mipmaps to sfRenderTexture and sfTexture. 2016-08-12 16:01:46 -07:00
Alec Iverson ae727f0a04 Added ReverseSubtract sfBlendMode 2016-08-12 15:48:03 -07:00
Alec Iverson 784b20038f Added sRGB support to sfTexture. 2016-08-12 15:43:15 -07:00
Alec Iverson 490a21fdff Renamed/deprecated sfPrimitiveType values.
sfLinesStrip     -> sfLineStrip
sfTrianglesStrip -> sfTriangleStrip
sfTrianglesFan   -> sfTriangleFan
2016-08-12 15:28:03 -07:00
Alec Iverson 864d7b822a Merged zsbzsb's outlined text branch. 2016-08-12 15:17:51 -07:00
Alec Iverson 16ea259e04 Implemented new setUniform API for shaders.
Deprecated old setParameter API.
2016-08-12 15:11:54 -07:00
Alec Iverson 36430b11c7 Added geometry shader support. 2016-08-12 14:02:18 -07:00
Alec Iverson 826ebac51a Add Glsl typedefs for sf::Shader::setUniform API. 2016-08-10 13:04:54 -07:00
Alec Iverson ce5e3a3891 Deprecated capture(), added mouse grabbing API.
Deprecated: sfImage* sfRenderWindow_capture(const sfRenderWindow*);

Added: sfRenderWindow_setMouseCursorGrabbed(sfRenderWindow*, sfBool);
Added: sfWindow_setMouseCursorGrabbed(sfWindow*, sfBool);

Also reordered some functions according to order in SFML.
2016-08-10 11:34:51 -07:00
Alec Iverson 21e8e0523f Copied/Converted SFML_DEPRECATED to CSFML. 2016-08-10 11:33:44 -07:00
DJMaster bf46c5386a Modified sfShader_createFromFile, sfShader_createFromMemory and sfShader_createFromStream functions to allow loading of all three vertex + geometry + fragment shaders 2016-08-08 20:23:22 +02:00
DJMaster da9cce8350 Added missing sfShader_isGeometryAvailable(void) function 2016-08-08 19:57:17 +02:00
DJMaster 9d757589ba Added return value to function sfSoundBufferRecorder_start 2016-08-07 11:41:45 +02:00
Laurent Gomila 74220430ea Merge pull request #95 from WillyGoat95/patch-1
Fixed typo in readme
2016-03-24 07:36:02 +01:00
WesOfX dc3ba7cc33 Fixed typo in readme 2016-03-23 22:46:59 -06:00
Zachariah Brown 19e3a18cde Merge pull request #92 from SFML/bugfix/doc_issues
Corrected issues with documentation
2016-01-29 10:19:27 -05:00
Zachariah Brown 66451e6596 Corrected issues with documentation 2016-01-19 12:38:39 -05:00
Laurent Gomila 92fb5f6dc8 Merge pull request #94 from SFML/bugfix/sound_copypaste_debug_fix
Corrected typo from copy-paste mistake...
2015-11-27 16:11:21 +01:00
Zachariah Brown ef49a86942 Corrected typo from copy-paste mistake when adding sfSoundBufferRecorder_getDevice 2015-11-27 09:09:11 -05:00
Zachariah Brown e8224208a2 Merge pull request #90 from SFML/bugfix/missing_recorder_methods
Added missing sfSoundBufferRecorder_XXX methods
2015-10-12 07:55:51 -04:00
Zachariah Brown e3df1539f5 Added missing sfSoundBufferRecorder_XXX methods 2015-09-29 15:11:45 -04:00
Zachariah Brown 3e767dec4f Updated email address 2015-09-26 10:19:25 -04:00
Zachariah Brown 068bb14937 Added support for outlined text 2015-09-26 10:09:28 -04:00
Zachariah Brown d91b8d0dfb Merge pull request #88 from BlaXpirit/feature/ftp_sendcommand
Added sfFtp_sendCommand
2015-09-20 06:00:57 -04:00
Oleh Prypin 9bf4197e0a Added sfFtp_sendCommand 2015-09-19 19:21:04 +03:00
Laurent Gomila ee9b927dec Merge pull request #84 from SFML/feature/doc_fix
Renamed documentation output file to CSFML.chm
2015-06-02 07:34:05 +02:00
Zachariah Brown 9e1cd46c73 Renamed documentation output file to CSFML.chm 2015-06-01 18:06:00 -04:00
Zachariah Brown 2e272c187f Merge pull request #75 from SFML/feature/2.3_prep
Bumped version number to 2.3 and updated readme.txt
2015-05-21 12:45:47 -04:00
Zachariah Brown 910bcc86d0 Merge pull request #80 from vonagam/fix_rpath_for_os_x
Fix rpath for OS X
2015-05-21 12:44:48 -04:00
Dmitry Maganov 448949ef7a fix rpath for OS X 2015-05-19 22:42:38 +06:00
Zachariah Brown 33bf91a1da Bumped version number to 2.3 and updated readme.txt 2015-05-07 08:43:08 -04:00
Laurent Gomila 9f4c4abaca Merge pull request #77 from Gyscos/master
Use size_t instead of unsigned int to follow SFML change
2015-05-02 10:12:59 +02:00
Laurent Gomila 4069448128 Merge pull request #78 from BlaXpirit/feature/color_subtract
Added subtract function for Colors
2015-05-01 22:21:06 +02:00
Alexandre Bury 4720e109b6 Use size_t instead of unsigned int in Graphics
Also use sfUint64 for sampleCount in sfSoundBuffer_createFromSamples
2015-05-01 13:20:43 -07:00
Laurent Gomila f3153dc9c1 Merge pull request #79 from SFML/feature/precise_mouse_events
Added support for the MouseWheelScrolled event
2015-05-01 22:20:19 +02:00
Zachariah Brown a424e91a54 Added support for the MouseWheelScrolled event 2015-05-01 15:20:45 -04:00
Oleh Prypin 1d0d7164c8 Added subtract function for Colors 2015-05-01 21:09:52 +03:00
Laurent Gomila 1486a30e2f Merge pull request #74 from LaurentGomila/feature/gl_improvements
Added support for context creation flags and texture/shader native handles
2015-03-31 15:08:25 +02:00
Zachariah Brown 88a59374bc Added support for context creation flags and texture/shader native handles 2015-03-31 08:14:32 -04:00
Laurent Gomila 78eea7face Merge pull request #76 from LaurentGomila/bugfix/missing_headers
Added missing headers to the general headers
2015-03-30 22:42:52 +02:00
Zachariah Brown 90b168aaaf Added missing includes to the general headers 2015-03-30 15:42:08 -04:00
Laurent Gomila 2ca7fbfb61 Merge pull request #71 from LaurentGomila/feature/color_int_ctor
Added the ctor to create a sfColor from an sfUint32
2015-03-22 22:39:29 +01:00
Zachariah Brown 2d9ae6cd04 Added the ctor to create a sfColor from an sfUint32 2015-03-22 14:48:16 -04:00
Laurent Gomila 0fe078ec8a Merge pull request #72 from LaurentGomila/feature/partial_send
Added support for patial TCP sends
2015-03-22 18:41:29 +01:00
Laurent Gomila 10d785df80 Merge pull request #73 from LaurentGomila/bugfix/sample_count_type
Changed getSampleCount return type to sfUint64 to better match SFML
2015-03-22 18:40:39 +01:00
Zachariah Brown 728a0e0002 Changed getSampleCount return type to sfUint64 to better match SFML 2015-03-22 07:05:47 -04:00
Zachariah Brown 3de58bfef4 Added support for patial TCP sends 2015-03-22 07:01:05 -04:00
Laurent Gomila 57d3ee0d89 Merge pull request #69 from jcowgill/fix-conversion-null
Fix pointer conversion warning when compiling without NDEBUG on Linux
2015-03-04 18:45:04 +01:00
James Cowgill e5c4b0927d Fix pointer conversion warning when compiling without NDEBUG on Linux 2015-03-03 22:43:34 +00:00
Laurent Gomila 141fbf55f6 Merge pull request #53 from eXpl0it3r/feature/version_2.2
Updated CSFML's version to 2.2.0.
2015-03-03 21:33:04 +01:00
Lukas Dürrenberger aad6f7b2d1 Updated CSFML's version to 2.2.0. 2015-02-28 11:25:49 +01:00
Laurent Gomila 944b267262 Merge pull request #67 from BlaXpirit/master
Remove non-ASCII symbols in Sensor.h
2015-02-27 17:52:57 +01:00
Laurent Gomila caf9aba55e Merge pull request #68 from zsbzsb/update/touch_get_position_renderwindow
Added sfTouch_getPositionRenderWindow(...) function
2015-02-27 17:51:40 +01:00
Zachariah Brown 109a02c829 Added sfTouch_getPositionRenderWindow(...) function 2015-02-26 21:30:37 -05:00
Oleh Prypin d849c0eae5 Removed non-ASCII symbols in Sensor.hpp
https://github.com/LaurentGomila/SFML/issues/806
2015-02-27 01:52:51 +02:00
Laurent Gomila 7c6e4e64b5 Merge pull request #66 from zsbzsb/bugfix/get_device_return
Fixed wrong macro usage preventing debug compilation
2015-02-26 20:33:14 +01:00
Zachariah Brown 93dd72dc26 Fixed wrong macro usage preventing debug compilation 2015-02-26 14:27:52 -05:00
Laurent Gomila 91a09b3ce5 Merge pull request #65 from zsbzsb/feature/sensor_touch_events
Added support for sensor and touch events
2015-02-26 19:51:46 +01:00
Zachariah Brown 7c5a55746a Added support for sensor and touch events 2015-02-26 12:00:22 -05:00
Laurent Gomila a499927784 Merge pull request #63 from zsbzsb/feature/touch_api
Added touch API
2015-02-26 15:17:43 +01:00
Zachariah Brown 4cc30a1f21 Added touch API 2015-02-26 09:05:41 -05:00
Laurent Gomila fb1824b3b0 Merge pull request #62 from zsbzsb/feature/sensor_api
Added sensor API
2015-02-26 14:09:30 +01:00
Zachariah Brown 1193ded996 Added sensor API 2015-02-26 07:57:12 -05:00
Laurent Gomila c1873e4499 Merge pull request #64 from zsbzsb/update/copyright_year
Fixed a few last old copyright years and email
2015-02-26 07:49:56 +01:00
Zachariah Brown 6ca48631aa Fixed a few last old copyright years and email 2015-02-25 11:56:03 -05:00
Laurent Gomila b7b2ed5d34 Merge pull request #61 from zsbzsb/update/copyright_year
Updated copyright year and email
2015-02-25 09:41:44 +01:00
Zachariah Brown f532c0dc98 Updated copyright year and email 2015-02-24 18:17:39 -05:00
Laurent Gomila 15009493e0 Merge pull request #60 from BlaXpirit/patch-1
Added HTTP methods
2015-02-24 22:57:41 +01:00
Oleh Prypin 2636bec9a1 Added HTTP methods 2015-02-24 22:51:20 +02:00
Laurent Gomila a7ff14c407 Merge pull request #59 from zsbzsb/feature/joystick_identification
Added support for joystick identification
2015-02-24 20:20:59 +01:00
Zachariah Brown 0e6c07a149 Added support for joystick identification 2015-02-24 12:03:32 -05:00
Laurent Gomila e10f7caecb Merge pull request #58 from zsbzsb/feature/fontinfo_struct
Added support for the Font::Info struct
2015-02-24 16:56:10 +01:00
Zachariah Brown 9f4120faf4 Added support for the Font::Info struct 2015-02-24 10:41:32 -05:00
Laurent Gomila 4789261e1e Merge pull request #57 from zsbzsb/feature/sound_recorder
Updated sfSoundRecorder
2015-02-24 15:19:14 +01:00
Zachariah Brown 58781d458e Updated SoundRecorder to support multiple recording devices 2015-02-24 09:03:31 -05:00
Laurent Gomila 6fa1212560 Merge pull request #56 from zsbzsb/feature/underline
Added underline functions to sfFont
2015-02-24 08:40:11 +01:00
Zachariah Brown 62188c38ec Added missing get underline thickness and position functions 2015-02-23 21:01:39 -05:00
Zachariah Brown 6667deca6f Removed excessive documentation to remain more consistant with the rest of the code base 2015-02-23 20:59:55 -05:00
Laurent Gomila 302048d29e Merge pull request #55 from eXpl0it3r/bugfix/readme
Updated the readme.txt and added a comment about FindSFML.cmake.
2015-01-06 16:28:19 +01:00
Lukas Dürrenberger c8b2e62da0 Updated the readme.txt and added a comment about FindSFML.cmake. 2015-01-06 16:17:01 +01:00
Laurent Gomila 2a2951e608 Merge pull request #51 from FRex/master
Added extern "C" inside ifdef __cplusplus to allow including and linking CSFML correctly in C++.
2015-01-02 17:23:54 +01:00
FRex 29382a4492 Added checks for __cplusplus so that CSFML can be used in C++. 2015-01-02 02:12:52 +01:00
Laurent Gomila 848b4d3aaa Merge pull request #49 from delehef/master
Compile with OS X 10.10
2014-11-22 23:09:56 +01:00
Franklin Delehelle 31ac05d8f4 Compile with OS X 10.10
Fixes the OS X version detection regex to allow compiling under OS X
10.10+.
2014-11-22 18:44:40 +01:00
Laurent Gomila 8de6cde2d1 Merge pull request #48 from zsbzsb/feature/window_focus
Added methods to check and request window focus
2014-10-09 22:48:24 +02:00
Zachariah Brown 766398d86e Added methods to check and request window focus 2014-10-09 15:23:25 -04:00
Laurent Gomila d105eded16 Merge pull request #47 from zsbzsb/update/font_metrics
Changed the font metrics to return floats instead of ints
2014-10-09 17:30:19 +02:00
Laurent Gomila 59a7060088 Merge pull request #46 from zsbzsb/feature/strike_through
Added text strikethrough and updated the style documentation
2014-10-09 17:30:05 +02:00
Zachariah Brown 1f8b022d17 Changed the font metrics to return floats instead of ints 2014-10-09 09:35:37 -04:00
Zachariah Brown 1529d3fa34 Added text strikethrough and updated the style documentation 2014-10-09 09:05:03 -04:00
Laurent Gomila c0b80724b4 Merge pull request #45 from zsbzsb/update/copyright_year
Updated copyright year
2014-10-03 07:58:12 +02:00
Zachariah Brown fdf58188ca Updated copyright year 2014-09-08 08:19:33 -04:00
Laurent Gomila 9a2c8d0ecb Merge pull request #43 from zsbzsb/feature/processing_interval
Updated CSFML to support sf::SoundRecorder::setProcessingInterval(...)
2014-09-05 21:12:48 +02:00
Zachariah Brown 87d69530a0 Updated CSFML to support sf::SoundRecorder::setProcessingInterval(...) 2014-09-05 14:52:22 -04:00
Laurent Gomila b790fbd28f Merge pull request #42 from zsbzsb/feature/up_vector
Updated CSFML to match the changes related to the up vector changes
2014-09-05 20:33:16 +02:00
Zachariah Brown 6abeaed4aa Updated CSFML to match the changes related to the up vector changes 2014-09-05 14:26:10 -04:00
Laurent Gomila 42c2fb1f5c Merge pull request #39 from ResponSySS/patch-1
Give a name to window style enum
2014-06-22 15:28:14 +02:00
ResponSyS ed44d9e0db Give a name to window style enum
Window style sfUint32 enum was unnanmed, which made it hard to find in the documentation.
2014-06-22 15:23:15 +02:00
Laurent Gomila 2a1a11ca4b Merge pull request #38 from zsbzsb/master
Updated CSFML to match the blending mode changes
2014-06-10 13:40:40 +02:00
Zachariah Brown d6849a3d57 Updated CSFML to match the blending mode changes 2014-06-09 16:57:44 -04:00
Laurent Gomila 8478569b4b Merge pull request #37 from zsbzsb/link_dynamically
Added CMake option to link dynamically
2014-06-06 23:24:55 +02:00
Zachariah Brown 4e509ff160 Added option to allow SFML to be linked dynamically 2014-06-06 16:38:20 -04:00
Laurent Gomila a6fdf83073 Merge pull request #36 from zsbzsb/master
Removed export macros in the function definitions
2014-04-11 08:32:55 +02:00
Laurent Gomila 4b4d84da0b Merge pull request #35 from eXpl0it3r/master
Renamed a few missed variables when the config filehad been updated.
2014-04-11 08:32:21 +02:00
Zachariah Brown ccf18cf8f9 Removed export macros in the function definitions 2014-04-10 21:07:35 -04:00
Lukas Dürrenberger b465c53afe Renamed a few missed variables when the config filehad been updated. 2014-04-11 02:57:30 +02:00
Laurent Gomila bc9ae12596 Added missing include in CMake file 2013-11-24 20:27:42 +01:00
Laurent Gomila 6669a6590a Updated build files to reflect the latest changes in SFML 2013-11-04 22:39:52 +01:00
Laurent Gomila 85a648ccc6 Removed useless line in build scripts 2013-09-02 17:41:18 +02:00
Laurent Gomila bd0faf69c5 Updated version number 2013-07-21 09:30:53 +02:00
Laurent Gomila 91e11cc095 sfTcpListener_accept now returns a null pointer when it fails 2013-07-09 15:46:17 +02:00
Laurent Gomila 12b7c5a6a5 Updated links in readme.txt 2013-06-26 23:31:12 +02:00
Laurent Gomila acfb53c8d5 Merge pull request #25 from krepa098/master
Added sfRenderTexture_set/isRepeated
2013-06-01 10:38:54 -07:00
krepa098 a707c5e0c7 added sfRenderTexture_setRepeated, sfRenderTexture_isRepeated 2013-06-01 18:05:41 +02:00
Laurent Gomila c7cabf8fb2 Added readme.txt to the install rules 2013-05-03 13:32:17 +02:00
Laurent Gomila f06b95526c Updated the documentation stylesheet 2013-04-25 21:40:56 +02:00
Laurent Gomila 7aab9a20d1 Updated the website links in readme.txt 2013-04-06 09:56:19 +02:00
Laurent Gomila 7535e03679 Updated the year in the copyright notice 2013-04-06 09:37:28 +02:00
Laurent Gomila 85db0634e5 Added functions to set the title of sfWindow/sfRenderWindow with a UTF-32 string 2013-03-24 12:25:09 +01:00
Laurent Gomila 2ec849d7b9 Added a compile flag to hide stupid VC++ warnings 2013-03-24 12:17:44 +01:00
Laurent Gomila 44288a186c Updated sfShader_bind and sfTexture_bind 2013-01-08 22:25:05 +01:00
Laurent Gomila de75c6a122 The Xxx_copy functions now take a const pointer 2012-12-08 13:53:57 +01:00
Laurent Gomila 8c9f98f17e Updated the main page of the API documentation 2012-12-02 23:14:21 +01:00
Laurent Gomila b2409bee14 Minor correction in API doc 2012-11-21 21:49:12 +01:00
Laurent Gomila 3277479584 Renamed convertCoords to mapPixelToCoords, and added its inverse mapCoordsToPixel 2012-11-10 10:49:49 +01:00
Laurent Gomila 00bd5c9a22 Renamed sfFtpListingDirectory_getFilename() to getName() 2012-10-26 17:10:21 +02:00
Laurent Gomila cc8637f65c Removed sfShader_unbind 2012-10-20 23:44:01 +02:00
Laurent Gomila 53f5e263a2 Correction in API documentation 2012-10-16 23:18:50 +02:00
Laurent Gomila 4310a05d67 Minor corrections in the API documentation 2012-10-11 11:07:19 +02:00
Laurent Gomila 65c8bfc655 Added overloads of sfMouse_getPosition and sfMouse_setPosition for sfRenderWindow 2012-10-06 00:13:10 +02:00
Laurent Gomila a74e57bcd4 Minor corrections in the API documentation 2012-10-05 18:04:42 +02:00
Laurent Gomila 1dd4f6484d Minor fix in API documentation 2012-10-03 20:21:21 +02:00
Laurent Gomila 5a60afa475 Typedef'd structures in Event.h 2012-09-29 22:39:34 +02:00
Laurent Gomila 9ee38bd681 Made SFML global objects "const" 2012-09-29 14:52:01 +02:00
Laurent Gomila 8f89740308 Merge pull request #10 from lmbarros/master
Fixed sfFtp_connect() signature.
2012-09-22 09:32:28 -07:00
Leandro Motta Barros c23b08245e Fixed sfFtp_connect() signature.
Signatures in the header and in the implementation files were
different.
2012-09-22 13:16:41 -03:00
Laurent Gomila d7240abb18 Removed the default font 2012-08-03 23:53:48 +02:00
Laurent Gomila 0757c89d7c Minor correction in API documentation 2012-07-10 20:22:35 +02:00
Laurent Gomila fe6c23f26f Added the sfKeyUnknown key code 2012-07-09 23:30:43 +02:00
Laurent Gomila 56d1db8b45 Added missing HTTP codes 2012-07-09 18:50:06 +02:00
Laurent Gomila 8e856b00b4 Added missing sfImage* argument in sfImage_createMaskFromColor 2012-06-26 22:07:52 +02:00
Laurent Gomila 046d415f98 Fix compiler errors in debug 2012-06-17 09:34:14 +02:00
Laurent Gomila 7e9321e57c Added missing include 2012-05-31 21:43:20 +02:00
Laurent Gomila 5aab13ca8d Added missing include of Http.h and Ftp.h to Network.h 2012-05-24 07:55:49 +02:00
Laurent Gomila 8f722ad0fc Fixed enum declaration errors (C++ style) in sfHttp and sfFtp 2012-05-24 07:55:30 +02:00
Laurent Gomila bfebe0aab4 sfTransform is no longer a wrapper around a sf::Transform*, it is a simple structure 2012-05-22 17:56:01 +02:00
Laurent Gomila bf614690ad Some functions were still using the old naming convention 2012-05-01 20:21:00 +02:00
Laurent Gomila d1b0c2221b Fixed bad prototype of sfMusic_setPlayingOffset 2012-04-30 17:45:43 +02:00
Laurent Gomila c581a975ed Added missing include of Sprite.h in Graphics.h 2012-04-24 17:37:26 +02:00
214 changed files with 9036 additions and 2453 deletions

No files matched your search

+50
View File
@@ -0,0 +1,50 @@
name: CI
on: [push, pull_request]
jobs:
build:
name: ${{ matrix.platform.name }} ${{ matrix.config.name }}
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false
matrix:
platform:
- { name: Windows VS2017, os: windows-2016 }
- { name: Windows VS2019, os: windows-latest }
- { name: Linux GCC, os: ubuntu-latest }
- { name: Linux Clang, os: ubuntu-latest, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ }
- { name: MacOS XCode, os: macos-latest, flags: -DSFML_BUILD_FRAMEWORKS=FALSE, prefix: sudo }
steps:
- name: Install Linux Dependencies
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev
- name: Checkout SFML
uses: actions/checkout@v2
with:
repository: SFML/SFML
ref: 2.5.1
path: SFML
- name: Configure SFML CMake
shell: bash
run: cmake -S $GITHUB_WORKSPACE/SFML -B $GITHUB_WORKSPACE/SFML/build -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/SFML/install -DBUILD_SHARED_LIBS=TRUE -DSFML_BUILD_EXAMPLES=FALSE -DSFML_BUILD_TEST_SUITE=FALSE -DCMAKE_VERBOSE_MAKEFILE=ON ${{matrix.platform.flags}}
- name: Build SFML
shell: bash
run: ${{matrix.platform.prefix}} cmake --build $GITHUB_WORKSPACE/SFML/build --config Release --target install
- name: Checkout CSFML
uses: actions/checkout@v2
with:
path: CSFML
- name: Configure CSFML CMake
shell: bash
run: cmake -S $GITHUB_WORKSPACE/CSFML -B $GITHUB_WORKSPACE/CSFML/build -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/CSFML/install -DBUILD_SHARED_LIBS=TRUE -DCSFML_LINK_SFML_STATICALLY=FALSE -DSFML_DIR=$GITHUB_WORKSPACE/SFML/install/lib/cmake/SFML -DCMAKE_VERBOSE_MAKEFILE=ON ${{matrix.platform.flags}}
- name: Build CSFML
shell: bash
run: cmake --build $GITHUB_WORKSPACE/CSFML/build --config Release --target install
+29 -13
View File
@@ -1,11 +1,17 @@
cmake_minimum_required(VERSION 2.8)
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!
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build (Debug or Release)" FORCE)
endif()
csfml_set_option(CMAKE_BUILD_TYPE Release STRING "Choose the type of build (Debug or Release)")
# project name
project(CSFML)
@@ -15,27 +21,36 @@ include(${CMAKE_SOURCE_DIR}/cmake/Config.cmake)
# setup version numbers
set(VERSION_MAJOR 2)
set(VERSION_MINOR 0)
set(VERSION_PATCH 0)
set(VERSION_MINOR 5)
set(VERSION_PATCH 1)
# add the CSFML header path
include_directories(${CMAKE_SOURCE_DIR}/include)
# force dynamic build (static build is not supported)
set(BUILD_SHARED_LIBS TRUE)
# 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
set(BUILD_DOC FALSE CACHE BOOL "TRUE to generate the API documentation, FALSE to ignore it")
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
# default on windows to static and on other platforms to dynamic
if(SFML_OS_WINDOWS)
set(LINK_STATICALLY_DEFAULT TRUE)
else()
set(LINK_STATICALLY_DEFAULT FALSE)
endif()
csfml_set_option(CSFML_LINK_SFML_STATICALLY ${LINK_STATICALLY_DEFAULT} 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(WINDOWS)
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(COMPILER_MSVC AND STATIC_STD_LIBS)
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)
@@ -48,7 +63,7 @@ endif()
# add the subdirectories
add_subdirectory(src/SFML)
if(BUILD_DOC)
if(CSFML_BUILD_DOC)
add_subdirectory(doc)
endif()
@@ -58,3 +73,4 @@ install(DIRECTORY include
COMPONENT devel
PATTERN ".svn" EXCLUDE)
install(FILES license.txt DESTINATION ${INSTALL_MISC_DIR})
install(FILES readme.txt DESTINATION ${INSTALL_MISC_DIR})
+33 -20
View File
@@ -1,30 +1,28 @@
# detect the OS
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(WINDOWS 1)
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} EQUAL "4")
if("${SIZEOF_VOID_PTR}" STREQUAL "4")
set(ARCH_32BITS 1)
elseif(${SIZEOF_VOID_PTR} EQUAL "8")
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(LINUX 1)
set(SFML_OS_LINUX 1)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
# FreeBSD compile path is the same as Linux
set(LINUX 1)
set(SFML_OS_FREEBSD 1)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(MACOSX 1)
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}")
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()
@@ -40,23 +38,38 @@ endif()
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(COMPILER_CLANG 1)
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" CLANG_VERSION "${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(COMPILER_GCC 1)
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" GCC_VERSION "${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(COMPILER_MSVC 1)
set(SFML_COMPILER_MSVC 1)
if(MSVC_VERSION EQUAL 1400)
set(MSVC_VERSION 2005)
set(SFML_MSVC_VERSION 8)
elseif(MSVC_VERSION EQUAL 1500)
set(MSVC_VERSION 2008)
set(SFML_MSVC_VERSION 9)
elseif(MSVC_VERSION EQUAL 1600)
set(MSVC_VERSION 2010)
set(SFML_MSVC_VERSION 10)
elseif(MSVC_VERSION EQUAL 1700)
set(MSVC_VERSION 2011)
set(SFML_MSVC_VERSION 11)
elseif(MSVC_VERSION EQUAL 1800)
set(SFML_MSVC_VERSION 12)
elseif(MSVC_VERSION EQUAL 1900)
set(SFML_MSVC_VERSION 14)
elseif(MSVC_VERSION LESS_EQUAL 1919)
set(SFML_MSVC_VERSION 15)
elseif(MSVC_VERSION LESS_EQUAL 1929)
set(SFML_MSVC_VERSION 16)
endif()
else()
message(FATAL_ERROR "Unsupported compiler")
@@ -64,8 +77,8 @@ else()
endif()
# define the install directory for miscellaneous files
if(WINDOWS)
if(SFML_OS_WINDOWS)
set(INSTALL_MISC_DIR .)
elseif(UNIX)
elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_MACOSX)
set(INSTALL_MISC_DIR share/CSFML)
endif()
+24 -57
View File
@@ -1,49 +1,4 @@
# some of these macros are inspired from the boost/cmake macros
# check if a value is contained in a list
# sets ${var} to TRUE if the value is found
macro(csfml_list_contains var value)
set(${var})
foreach(value2 ${ARGN})
if(${value} STREQUAL ${value2})
set(${var} TRUE)
endif()
endforeach()
endmacro()
# parse a list of arguments and options
# ex: sfml_parse_arguments(THIS "SOURCES;DEPENDS" "FLAG" FLAG SOURCES s1 s2 s3 DEPENDS d1 d2)
# will define the following variables:
# - THIS_SOURCES (s1 s2 s3)
# - THIS_DEPENDS (d1 d2)
# - THIS_FLAG TRUE
macro(csfml_parse_arguments prefix arg_names option_names)
foreach(arg_name ${arg_names})
set(${prefix}_${arg_name})
endforeach()
foreach(option_name ${option_names})
set(${prefix}_${option_name} FALSE)
endforeach()
set(current_arg_name)
set(current_arg_list)
foreach(arg ${ARGN})
csfml_list_contains(is_arg_name ${arg} ${arg_names})
if(is_arg_name)
set(${prefix}_${current_arg_name} ${current_arg_list})
set(current_arg_name ${arg})
set(current_arg_list)
else()
csfml_list_contains(is_option ${arg} ${option_names})
if(is_option)
set(${prefix}_${arg} TRUE)
else()
set(current_arg_list ${current_arg_list} ${arg})
endif()
endif()
endforeach()
set(${prefix}_${current_arg_name} ${current_arg_list})
endmacro()
include(CMakeParseArguments)
# add a new target which is a CSFML library
# ex: csfml_add_library(csfml-graphics
@@ -52,7 +7,7 @@ endmacro()
macro(csfml_add_library target)
# parse the arguments
csfml_parse_arguments(THIS "SOURCES;DEPENDS" "" ${ARGN})
cmake_parse_arguments(THIS "" "" "SOURCES;DEPENDS;EXTERNAL_LIBS" ${ARGN})
# create the target
add_library(${target} ${THIS_SOURCES})
@@ -62,15 +17,14 @@ macro(csfml_add_library target)
string(TOUPPER "${NAME_UPPER}" NAME_UPPER)
set_target_properties(${target} PROPERTIES DEFINE_SYMBOL ${NAME_UPPER}_EXPORTS)
# adjust the output file prefix/suffix to match our conventions
if(WINDOWS)
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 (WINDOWS AND COMPILER_GCC)
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 "")
@@ -78,25 +32,38 @@ macro(csfml_add_library target)
endif()
# set the version and soversion of the target (for compatible systems -- mostly Linuxes)
set_target_properties(${target} PROPERTIES SOVERSION ${VERSION_MAJOR})
set_target_properties(${target} PROPERTIES VERSION ${VERSION_MAJOR}.${VERSION_MINOR})
set_target_properties(${target} PROPERTIES SOVERSION ${VERSION_MAJOR}.${VERSION_MINOR})
set_target_properties(${target} PROPERTIES VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
# for gcc >= 4.0 on Windows, apply the STATIC_STD_LIBS option if it is enabled
if(WINDOWS AND COMPILER_GCC AND STATIC_STD_LIBS)
if(NOT GCC_VERSION VERSION_LESS "4")
# 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
# 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 WINDOWS AND ((COMPILER_GCC AND NOT GCC_VERSION VERSION_LESS "4") OR (COMPILER_CLANG AND NOT CLANG_VERSION VERSION_LESS "3")))
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
+3 -5
View File
@@ -7,11 +7,11 @@ set(DOXYGEN_INPUT_DIR ${CMAKE_SOURCE_DIR})
set(DOXYGEN_OUTPUT_DIR ${CMAKE_BINARY_DIR}/doc)
# see if we can generate the CHM documentation
if(WINDOWS)
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"
PATHS "C:/Program Files/HTML Help Workshop" "C:/Program Files (x86)/HTML Help Workshop"
DOC "HTML Help Compiler program")
if(DOXYGEN_HHC_PROGRAM)
set(DOXYGEN_GENERATE_HTMLHELP YES)
@@ -29,8 +29,6 @@ configure_file(${DOXYGEN_INPUT_DIR}/doc/doxyfile.in ${DOXYGEN_CONFIGURED_INPUT}
# copy the files needed by the documentation
configure_file(${DOXYGEN_INPUT_DIR}/doc/doxygen.css ${DOXYGEN_OUTPUT_DIR}/html/doxygen.css COPYONLY)
configure_file(${DOXYGEN_INPUT_DIR}/doc/logo.jpg ${DOXYGEN_OUTPUT_DIR}/html/logo.jpg COPYONLY)
configure_file(${DOXYGEN_INPUT_DIR}/doc/logo-bg.jpg ${DOXYGEN_OUTPUT_DIR}/html/logo-bg.jpg COPYONLY)
# target setup
add_custom_target(doc ALL
@@ -44,7 +42,7 @@ install(DIRECTORY ${DOXYGEN_OUTPUT_DIR}/html
DESTINATION ${INSTALL_MISC_DIR}/doc
COMPONENT doc)
if(DOXYGEN_HHC_PROGRAM)
install(FILES ${DOXYGEN_OUTPUT_DIR}/SFML.chm
install(FILES ${DOXYGEN_OUTPUT_DIR}/CSFML.chm
DESTINATION ${INSTALL_MISC_DIR}/doc
COMPONENT doc)
endif()
+1855 -890
View File
File diff suppressed because it is too large. Load diff
+1188 -419
View File
File diff suppressed because it is too large. Load diff
-8
View File
@@ -1,8 +0,0 @@
<p id="footer">
&nbsp;::&nbsp; Copyright &copy; 2007 Laurent Gomila, all rights reserved &nbsp;::&nbsp;
Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen 1.5.2</a> &nbsp;::&nbsp;
</p>
</body>
</html>
+9
View File
@@ -0,0 +1,9 @@
</div>
<div id="footer-container">
<div id="footer">
Copyright © Laurent Gomila &nbsp;::&nbsp;
Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen</a> &nbsp;::&nbsp;
</div>
</div>
</body>
</html>
-12
View File
@@ -1,12 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>SFML - Simple and Fast Multimedia Library</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="tabs.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="logo">
<img src="./logo.jpg" width="770" height="200" title="SFML home" alt="SFML logo" />
</div>
+15
View File
@@ -0,0 +1,15 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSFML - C binding of the Simple and Fast Multimedia Library</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<!--<link rel='stylesheet' type='text/css' href="http://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic"/>-->
<link rel="stylesheet" type="text/css" href="doxygen.css" title="default" media="screen,print" />
</head>
<body>
<div id="banner-container">
<div id="banner">
<span id="sfml">CSFML</span>
</div>
</div>
<div id="content">
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

+3 -4
View File
@@ -3,10 +3,9 @@
///
/// \section welcome Welcome
/// Welcome to the official SFML documentation for C. Here you will find a detailed
/// view of all the SFML <a href="./globals_func.htm">functions</a>, as well as source
/// <a href="./files.htm">files</a>. <br/>
/// view of all the SFML <a href="./globals_func.htm">functions</a>.<br/>
/// If you are looking for tutorials, you can visit the official website
/// at <a href="http://www.sfml-dev.org/tutorials/">www.sfml-dev.org</a>.
/// at <a href="http://www.sfml-dev.org/">www.sfml-dev.org</a>.
///
/// \section example Short example
/// Here is a short example, to show you how simple it is to use SFML in C :
@@ -33,7 +32,7 @@
/// return EXIT_FAILURE;
///
/// /* Load a sprite to display */
/// texture = sfTexture_createFromFile("cute_image.jpg");
/// texture = sfTexture_createFromFile("cute_image.jpg", NULL);
/// if (!texture)
/// return EXIT_FAILURE;
/// sprite = sfSprite_create();
+3 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -36,6 +36,8 @@
#include <SFML/Audio/SoundBuffer.h>
#include <SFML/Audio/SoundBufferRecorder.h>
#include <SFML/Audio/SoundRecorder.h>
#include <SFML/Audio/SoundStatus.h>
#include <SFML/Audio/SoundStream.h>
#endif // SFML_AUDIO_H
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
+35 -10
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -71,25 +71,50 @@ CSFML_AUDIO_API void sfListener_setPosition(sfVector3f position);
CSFML_AUDIO_API sfVector3f sfListener_getPosition();
////////////////////////////////////////////////////////////
/// \brief Set the orientation of the listener in the scene
/// \brief Set the orientation of the forward vector in the scene
///
/// The orientation defines the 3D axes of the listener
/// (left, up, front) in the scene. The orientation vector
/// doesn't have to be normalized.
/// The default listener's orientation is (0, 0, -1).
/// 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 position New direction of the listener
/// \param direction New listener's direction
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfListener_setDirection(sfVector3f orientation);
CSFML_AUDIO_API void sfListener_setDirection(sfVector3f direction);
////////////////////////////////////////////////////////////
/// \brief Get the current orientation of the listener in the scene
/// \brief Get the current forward vector of the listener in the scene
///
/// \return The listener's direction
/// \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
+55 -5
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -37,6 +37,17 @@
#include <stddef.h>
////////////////////////////////////////////////////////////
/// \brief Structure defining a time range
///
////////////////////////////////////////////////////////////
typedef struct
{
sfTime offset; ///< The beginning offset of the time range
sfTime length; ///< The length of the time range
} sfTimeSpan;
////////////////////////////////////////////////////////////
/// \brief Create a new music and load it from a file
///
@@ -128,6 +139,45 @@ CSFML_AUDIO_API sfBool sfMusic_getLoop(const sfMusic* music);
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfTime sfMusic_getDuration(const sfMusic* music);
////////////////////////////////////////////////////////////
/// \brief Get the positions of the of the sound's looping sequence
///
/// \return Loop Time position class.
///
/// \warning Since sfMusic_setLoopPoints() performs some adjustments on the
/// provided values and rounds them to internal samples, a call to
/// sfMusic_getLoopPoints() is not guaranteed to return the same times passed
/// into a previous call to sfMusic_setLoopPoints(). However, it is guaranteed
/// to return times that will map to the valid internal samples of
/// this Music if they are later passed to sfMusic_setLoopPoints().
///
/// \see setLoopPoints
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfTimeSpan sfMusic_getLoopPoints(const sfMusic* music);
////////////////////////////////////////////////////////////
/// \brief Sets the beginning and end of the sound's looping sequence using sf::Time
///
/// Loop points allow one to specify a pair of positions such that, when the music
/// is enabled for looping, it will seamlessly seek to the beginning whenever it
/// encounters the end. Valid ranges for timePoints.offset and timePoints.length are
/// [0, Dur) and (0, Dur-offset] respectively, where Dur is the value returned by sfMusic_getDuration().
/// Note that the EOF "loop point" from the end to the beginning of the stream is still honored,
/// in case the caller seeks to a point after the end of the loop range. This function can be
/// safely called at any point after a stream is opened, and will be applied to a playing sound
/// without affecting the current playing offset.
///
/// \warning Setting the loop points while the stream's status is Paused
/// will set its status to Stopped. The playing offset will be unaffected.
///
/// \param timePoints The definition of the loop. Can be any time points within the sound's length
///
/// \see getLoopPoints
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfMusic_setLoopPoints(sfMusic* music, sfTimeSpan timePoints);
////////////////////////////////////////////////////////////
/// \brief Start or resume playing a music
///
@@ -158,7 +208,7 @@ CSFML_AUDIO_API void sfMusic_pause(sfMusic* 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).
/// It also resets the playing position (unlike sfMusic_pause).
///
/// \param music Music object
///
@@ -246,7 +296,7 @@ CSFML_AUDIO_API void sfMusic_setVolume(sfMusic* music, float volume);
///
/// \param music Music object
/// \param position Position of the music in the scene
//
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfMusic_setPosition(sfMusic* music, sfVector3f position);
@@ -306,10 +356,10 @@ CSFML_AUDIO_API void sfMusic_setAttenuation(sfMusic* music, float attenuation);
/// either paused or playing.
///
/// \param music Music object
/// \param timeOffset New playing position, in milliseconds
/// \param timeOffset New playing position
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfMusic_setPlayingOffset(sfMusic* music, sfUint32 timeOffset);
CSFML_AUDIO_API void sfMusic_setPlayingOffset(sfMusic* music, sfTime timeOffset);
////////////////////////////////////////////////////////////
/// \brief Get the pitch of a music
+3 -3
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -51,7 +51,7 @@ CSFML_AUDIO_API sfSound* sfSound_create(void);
/// \return A new sfSound object which is a copy of \a sound
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfSound* sfSound_copy(sfSound* sound);
CSFML_AUDIO_API sfSound* sfSound_copy(const sfSound* sound);
////////////////////////////////////////////////////////////
/// \brief Destroy a sound
@@ -136,7 +136,7 @@ CSFML_AUDIO_API const sfSoundBuffer* sfSound_getBuffer(const sfSound* sound);
CSFML_AUDIO_API void sfSound_setLoop(sfSound* sound, sfBool loop);
////////////////////////////////////////////////////////////
/// \brief Tell whether or not a soud is in loop mode
/// \brief Tell whether or not a sound is in loop mode
///
/// \param sound Sound object
///
+5 -5
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -92,7 +92,7 @@ CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromStream(sfInputStream* str
/// \return A new sfSoundBuffer object (NULL if failed)
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromSamples(const sfInt16* samples, size_t sampleCount, unsigned int channelCount, unsigned int sampleRate);
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
@@ -102,7 +102,7 @@ CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_createFromSamples(const sfInt16* sa
/// \return A new sfSoundBuffer object which is a copy of \a soundBuffer
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_copy(sfSoundBuffer* soundBuffer);
CSFML_AUDIO_API sfSoundBuffer* sfSoundBuffer_copy(const sfSoundBuffer* soundBuffer);
////////////////////////////////////////////////////////////
/// \brief Destroy a sound buffer
@@ -132,7 +132,7 @@ CSFML_AUDIO_API sfBool sfSoundBuffer_saveToFile(const sfSoundBuffer* soundBuffer
///
/// 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.
/// is given by the sfSoundBuffer_getSampleCount function.
///
/// \param soundBuffer Sound buffer object
///
@@ -152,7 +152,7 @@ CSFML_AUDIO_API const sfInt16* sfSoundBuffer_getSamples(const sfSoundBuffer* sou
/// \return Number of samples
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API size_t sfSoundBuffer_getSampleCount(const sfSoundBuffer* soundBuffer);
CSFML_AUDIO_API sfUint64 sfSoundBuffer_getSampleCount(const sfSoundBuffer* soundBuffer);
////////////////////////////////////////////////////////////
/// \brief Get the sample rate of a sound buffer
+30 -2
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -61,8 +61,10 @@ CSFML_AUDIO_API void sfSoundBufferRecorder_destroy(sfSoundBufferRecorder* soundB
/// \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 void sfSoundBufferRecorder_start(sfSoundBufferRecorder* soundBufferRecorder, unsigned int sampleRate);
CSFML_AUDIO_API sfBool sfSoundBufferRecorder_start(sfSoundBufferRecorder* soundBufferRecorder, unsigned int sampleRate);
////////////////////////////////////////////////////////////
/// \brief Stop the capture of a sound recorder
@@ -101,5 +103,31 @@ CSFML_AUDIO_API unsigned int sfSoundBufferRecorder_getSampleRate(const sfSoundBu
////////////////////////////////////////////////////////////
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
+103 -2
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -30,6 +30,7 @@
////////////////////////////////////////////////////////////
#include <SFML/Audio/Export.h>
#include <SFML/Audio/Types.h>
#include <SFML/System/Time.h>
#include <stddef.h>
@@ -75,8 +76,10 @@ CSFML_AUDIO_API void sfSoundRecorder_destroy(sfSoundRecorder* soundRecorder);
/// \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 void sfSoundRecorder_start(sfSoundRecorder* soundRecorder, unsigned int sampleRate);
CSFML_AUDIO_API sfBool sfSoundRecorder_start(sfSoundRecorder* soundRecorder, unsigned int sampleRate);
////////////////////////////////////////////////////////////
/// \brief Stop the capture of a sound recorder
@@ -112,5 +115,103 @@ CSFML_AUDIO_API unsigned int sfSoundRecorder_getSampleRate(const sfSoundRecorder
////////////////////////////////////////////////////////////
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
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
+27 -27
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -61,7 +61,7 @@ typedef void (*sfSoundStreamSeekCallback)(sfTime, void*); ///<
/// \return A new sfSoundStream object
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfSoundStream* sfSoundStream_Create(sfSoundStreamGetDataCallback onGetData,
CSFML_AUDIO_API sfSoundStream* sfSoundStream_create(sfSoundStreamGetDataCallback onGetData,
sfSoundStreamSeekCallback onSeek,
unsigned int channelCount,
unsigned int sampleRate,
@@ -73,7 +73,7 @@ CSFML_AUDIO_API sfSoundStream* sfSoundStream_Create(sfSoundStreamGetDataCallback
/// \param soundStream Sound stream to destroy
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfSoundStream_Destroy(sfSoundStream* soundStream);
CSFML_AUDIO_API void sfSoundStream_destroy(sfSoundStream* soundStream);
////////////////////////////////////////////////////////////
/// \brief Start or resume playing a sound stream
@@ -87,7 +87,7 @@ CSFML_AUDIO_API void sfSoundStream_Destroy(sfSoundStream* soundStream);
/// \param soundStream Sound stream object
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfSoundStream_Play(sfSoundStream* soundStream);
CSFML_AUDIO_API void sfSoundStream_play(sfSoundStream* soundStream);
////////////////////////////////////////////////////////////
/// \brief Pause a sound stream
@@ -98,19 +98,19 @@ CSFML_AUDIO_API void sfSoundStream_Play(sfSoundStream* soundStream);
/// \param soundStream Sound stream object
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfSoundStream_Pause(sfSoundStream* soundStream);
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).
/// It also resets the playing position (unlike sfSoundStream_pause).
///
/// \param soundStream Sound stream object
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfSoundStream_Stop(sfSoundStream* soundStream);
CSFML_AUDIO_API void sfSoundStream_stop(sfSoundStream* soundStream);
////////////////////////////////////////////////////////////
/// \brief Get the current status of a sound stream (stopped, paused, playing)
@@ -120,7 +120,7 @@ CSFML_AUDIO_API void sfSoundStream_Stop(sfSoundStream* soundStream);
/// \return Current status
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfSoundStatus sfSoundStream_GetStatus(const sfSoundStream* soundStream);
CSFML_AUDIO_API sfSoundStatus sfSoundStream_getStatus(const sfSoundStream* soundStream);
////////////////////////////////////////////////////////////
/// \brief Return the number of channels of a sound stream
@@ -132,7 +132,7 @@ CSFML_AUDIO_API sfSoundStatus sfSoundStream_GetStatus(const sfSoundStream* sound
/// \return Number of channels
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API unsigned int sfSoundStream_GetChannelCount(const sfSoundStream* soundStream);
CSFML_AUDIO_API unsigned int sfSoundStream_getChannelCount(const sfSoundStream* soundStream);
////////////////////////////////////////////////////////////
/// \brief Get the sample rate of a sound stream
@@ -145,7 +145,7 @@ CSFML_AUDIO_API unsigned int sfSoundStream_GetChannelCount(const sfSoundStream*
/// \return Sample rate, in number of samples per second
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API unsigned int sfSoundStream_GetSampleRate(const sfSoundStream* soundStream);
CSFML_AUDIO_API unsigned int sfSoundStream_getSampleRate(const sfSoundStream* soundStream);
////////////////////////////////////////////////////////////
/// \brief Set the pitch of a sound stream
@@ -160,7 +160,7 @@ CSFML_AUDIO_API unsigned int sfSoundStream_GetSampleRate(const sfSoundStream* so
/// \param pitch New pitch to apply to the stream
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfSoundStream_SetPitch(sfSoundStream* soundStream, float pitch);
CSFML_AUDIO_API void sfSoundStream_setPitch(sfSoundStream* soundStream, float pitch);
////////////////////////////////////////////////////////////
/// \brief Set the volume of a sound stream
@@ -172,7 +172,7 @@ CSFML_AUDIO_API void sfSoundStream_SetPitch(sfSoundStream* soundStream, float pi
/// \param volume Volume of the stream
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfSoundStream_SetVolume(sfSoundStream* soundStream, float volume);
CSFML_AUDIO_API void sfSoundStream_setVolume(sfSoundStream* soundStream, float volume);
////////////////////////////////////////////////////////////
/// \brief Set the 3D position of a sound stream in the audio scene
@@ -185,7 +185,7 @@ CSFML_AUDIO_API void sfSoundStream_SetVolume(sfSoundStream* soundStream, float v
/// \param position Position of the stream in the scene
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfSoundStream_SetPosition(sfSoundStream* soundStream, sfVector3f position);
CSFML_AUDIO_API void sfSoundStream_setPosition(sfSoundStream* soundStream, sfVector3f position);
////////////////////////////////////////////////////////////
/// \brief Make a sound stream's position relative to the listener or absolute
@@ -200,7 +200,7 @@ CSFML_AUDIO_API void sfSoundStream_SetPosition(sfSoundStream* soundStream, sfVec
/// \param relative sfTrue to set the position relative, sfFalse to set it absolute
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfSoundStream_SetRelativeToListener(sfSoundStream* soundStream, sfBool relative);
CSFML_AUDIO_API void sfSoundStream_setRelativeToListener(sfSoundStream* soundStream, sfBool relative);
////////////////////////////////////////////////////////////
/// \brief Set the minimum distance of a sound stream
@@ -216,7 +216,7 @@ CSFML_AUDIO_API void sfSoundStream_SetRelativeToListener(sfSoundStream* soundStr
/// \param distance New minimum distance of the stream
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfSoundStream_SetMinDistance(sfSoundStream* soundStream, float distance);
CSFML_AUDIO_API void sfSoundStream_setMinDistance(sfSoundStream* soundStream, float distance);
////////////////////////////////////////////////////////////
/// \brief Set the attenuation factor of a sound stream
@@ -234,7 +234,7 @@ CSFML_AUDIO_API void sfSoundStream_SetMinDistance(sfSoundStream* soundStream, fl
/// \param attenuation New attenuation factor of the stream
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfSoundStream_SetAttenuation(sfSoundStream* soundStream, float attenuation);
CSFML_AUDIO_API void sfSoundStream_setAttenuation(sfSoundStream* soundStream, float attenuation);
////////////////////////////////////////////////////////////
/// \brief Change the current playing position of a sound stream
@@ -246,21 +246,21 @@ CSFML_AUDIO_API void sfSoundStream_SetAttenuation(sfSoundStream* soundStream, fl
/// \param timeOffset New playing position
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API void sfSoundStream_SetPlayingOffset(sfSoundStream* soundStream, sfTime timeOffset);
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.
/// 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);
CSFML_AUDIO_API void sfSoundStream_setLoop(sfSoundStream* soundStream, sfBool loop);
////////////////////////////////////////////////////////////
/// \brief Get the pitch of a sound stream
@@ -270,7 +270,7 @@ CSFML_AUDIO_API void sfSoundStream_SetLoop(sfSoundStream* soundStream, sfBool lo
/// \return Pitch of the stream
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API float sfSoundStream_GetPitch(const sfSoundStream* soundStream);
CSFML_AUDIO_API float sfSoundStream_getPitch(const sfSoundStream* soundStream);
////////////////////////////////////////////////////////////
/// \brief Get the volume of a sound stream
@@ -280,7 +280,7 @@ CSFML_AUDIO_API float sfSoundStream_GetPitch(const sfSoundStream* soundStream);
/// \return Volume of the stream, in the range [0, 100]
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API float sfSoundStream_GetVolume(const sfSoundStream* soundStream);
CSFML_AUDIO_API float sfSoundStream_getVolume(const sfSoundStream* soundStream);
////////////////////////////////////////////////////////////
/// \brief Get the 3D position of a sound stream in the audio scene
@@ -290,7 +290,7 @@ CSFML_AUDIO_API float sfSoundStream_GetVolume(const sfSoundStream* soundStream);
/// \return Position of the stream in the world
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfVector3f sfSoundStream_GetPosition(const sfSoundStream* soundStream);
CSFML_AUDIO_API sfVector3f sfSoundStream_getPosition(const sfSoundStream* soundStream);
////////////////////////////////////////////////////////////
/// \brief Tell whether a sound stream's position is relative to the
@@ -301,7 +301,7 @@ CSFML_AUDIO_API sfVector3f sfSoundStream_GetPosition(const sfSoundStream* soundS
/// \return sfTrue if the position is relative, sfFalse if it's absolute
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfBool sfSoundStream_IsRelativeToListener(const sfSoundStream* soundStream);
CSFML_AUDIO_API sfBool sfSoundStream_isRelativeToListener(const sfSoundStream* soundStream);
////////////////////////////////////////////////////////////
/// \brief Get the minimum distance of a sound stream
@@ -311,7 +311,7 @@ CSFML_AUDIO_API sfBool sfSoundStream_IsRelativeToListener(const sfSoundStream* s
/// \return Minimum distance of the stream
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API float sfSoundStream_GetMinDistance(const sfSoundStream* soundStream);
CSFML_AUDIO_API float sfSoundStream_getMinDistance(const sfSoundStream* soundStream);
////////////////////////////////////////////////////////////
/// \brief Get the attenuation factor of a sound stream
@@ -321,7 +321,7 @@ CSFML_AUDIO_API float sfSoundStream_GetMinDistance(const sfSoundStream* soundStr
/// \return Attenuation factor of the stream
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API float sfSoundStream_GetAttenuation(const sfSoundStream* soundStream);
CSFML_AUDIO_API float sfSoundStream_getAttenuation(const sfSoundStream* soundStream);
////////////////////////////////////////////////////////////
/// \brief Tell whether or not a sound stream is in loop mode
@@ -331,7 +331,7 @@ CSFML_AUDIO_API float sfSoundStream_GetAttenuation(const sfSoundStream* soundStr
/// \return sfTrue if the music is looping, sfFalse otherwise
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfBool sfSoundStream_GetLoop(const sfSoundStream* soundStream);
CSFML_AUDIO_API sfBool sfSoundStream_getLoop(const sfSoundStream* soundStream);
////////////////////////////////////////////////////////////
/// \brief Get the current playing position of a sound stream
@@ -341,7 +341,7 @@ CSFML_AUDIO_API sfBool sfSoundStream_GetLoop(const sfSoundStream* soundStream);
/// \return Current playing position
///
////////////////////////////////////////////////////////////
CSFML_AUDIO_API sfTime sfSoundStream_GetPlayingOffset(const sfSoundStream* soundStream);
CSFML_AUDIO_API sfTime sfSoundStream_getPlayingOffset(const sfSoundStream* soundStream);
#endif // SFML_SOUNDSTREAM_H
+2 -1
View File
@@ -1,7 +1,8 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)//
// Copyright (C) 2007-2018 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.
//
+52 -5
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -30,7 +30,18 @@
// Define the CSFML version
////////////////////////////////////////////////////////////
#define CSFML_VERSION_MAJOR 2
#define CSFML_VERSION_MINOR 0
#define CSFML_VERSION_MINOR 5
#define CSFML_VERSION_PATCH 1
////////////////////////////////////////////////////////////
// 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
////////////////////////////////////////////////////////////
@@ -71,7 +82,7 @@
// Windows compilers need specific (and different) keywords for export and import
#define CSFML_API_EXPORT extern "C" __declspec(dllexport)
#define CSFML_API_IMPORT extern __declspec(dllimport)
#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
@@ -87,18 +98,54 @@
// 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 extern __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 extern
#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
+74
View File
@@ -0,0 +1,74 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 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_GPUPREFERENCE_H
#define SFML_GPUPREFERENCE_H
////////////////////////////////////////////////////////////
/// Headers
////////////////////////////////////////////////////////////
#include <SFML/Config.h>
////////////////////////////////////////////////////////////
/// \file
///
/// \brief File containing SFML_DEFINE_DISCRETE_GPU_PREFERENCE
///
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
/// \def SFML_DEFINE_DISCRETE_GPU_PREFERENCE
///
/// \brief A macro to encourage usage of the discrete GPU
///
/// In order to inform the Nvidia/AMD driver that an SFML
/// application could benefit from using the more powerful
/// discrete GPU, special symbols have to be publicly
/// exported from the final executable.
///
/// SFML defines a helper macro to easily do this.
///
/// Place SFML_DEFINE_DISCRETE_GPU_PREFERENCE in the
/// global scope of a source file that will be linked into
/// the final executable. Typically it is best to place it
/// where the main function is also defined.
///
////////////////////////////////////////////////////////////
#if defined(SFML_SYSTEM_WINDOWS)
#define SFML_DEFINE_DISCRETE_GPU_PREFERENCE \
CSFML_EXTERN_C __declspec(dllexport) unsigned long NvOptimusEnablement = 1; \
CSFML_EXTERN_C __declspec(dllexport) unsigned long AmdPowerXpressRequestHighPerformance = 1;
#else
#define SFML_DEFINE_DISCRETE_GPU_PREFERENCE
#endif
#endif // SFML_GPUPREFERENCE_H
+5 -2
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -35,22 +35,25 @@
#include <SFML/Graphics/Color.h>
#include <SFML/Graphics/ConvexShape.h>
#include <SFML/Graphics/Font.h>
#include <SFML/Graphics/FontInfo.h>
#include <SFML/Graphics/Glyph.h>
#include <SFML/Graphics/Image.h>
#include <SFML/Graphics/PrimitiveType.h>
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/RectangleShape.h>
#include <SFML/Graphics/RenderStates.h>
#include <SFML/Graphics/RenderWindow.h>
#include <SFML/Graphics/RenderTexture.h>
#include <SFML/Graphics/RenderWindow.h>
#include <SFML/Graphics/Shader.h>
#include <SFML/Graphics/Shape.h>
#include <SFML/Graphics/Sprite.h>
#include <SFML/Graphics/Text.h>
#include <SFML/Graphics/Texture.h>
#include <SFML/Graphics/Transform.h>
#include <SFML/Graphics/Transformable.h>
#include <SFML/Graphics/Vertex.h>
#include <SFML/Graphics/VertexArray.h>
#include <SFML/Graphics/VertexBuffer.h>
#include <SFML/Graphics/View.h>
+46 -7
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -32,16 +32,55 @@
////////////////////////////////////////////////////////////
/// \brief Available blending modes for drawing
/// \brief Enumeration of the blending factors
///
////////////////////////////////////////////////////////////
typedef enum
typedef enum
{
sfBlendAlpha, ///< Pixel = Src * a + Dest * (1 - a)
sfBlendAdd, ///< Pixel = Src + Dest
sfBlendMultiply, ///< Pixel = Src * Dest
sfBlendNone ///< No blending
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
+12 -10
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -31,8 +31,10 @@
#include <SFML/Graphics/Export.h>
#include <SFML/Graphics/Color.h>
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/Transform.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/Vector2.h>
#include <stddef.h>
////////////////////////////////////////////////////////////
@@ -51,12 +53,12 @@ CSFML_GRAPHICS_API sfCircleShape* sfCircleShape_create(void);
/// \return Copied object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfCircleShape* sfCircleShape_copy(sfCircleShape* shape);
CSFML_GRAPHICS_API sfCircleShape* sfCircleShape_copy(const sfCircleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Destroy an existing circle Shape
///
/// \param Shape Shape to delete
/// \param shape Shape to delete
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfCircleShape_destroy(sfCircleShape* shape);
@@ -146,7 +148,7 @@ CSFML_GRAPHICS_API float sfCircleShape_getRotation(const sfCircleShape* shape);
/// \return Current scale factors
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVector2f sfCircleShape_GetScale(const sfCircleShape* shape);
CSFML_GRAPHICS_API sfVector2f sfCircleShape_getScale(const sfCircleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the local origin of a circle shape
@@ -156,7 +158,7 @@ CSFML_GRAPHICS_API sfVector2f sfCircleShape_GetScale(const sfCircleShape* shape)
/// \return Current origin
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVector2f sfCircleShape_GetOrigin(const sfCircleShape* shape);
CSFML_GRAPHICS_API sfVector2f sfCircleShape_getOrigin(const sfCircleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Move a circle shape by a given offset
@@ -202,7 +204,7 @@ CSFML_GRAPHICS_API void sfCircleShape_scale(sfCircleShape* shape, sfVector2f fac
/// \return Transform combining the position/rotation/scale/origin of the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfCircleShape_getTransform(const sfCircleShape* shape);
CSFML_GRAPHICS_API sfTransform sfCircleShape_getTransform(const sfCircleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the inverse of the combined transform of a circle shape
@@ -212,7 +214,7 @@ CSFML_GRAPHICS_API const sfTransform* sfCircleShape_getTransform(const sfCircleS
/// \return Inverse of the combined transformations applied to the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfCircleShape_getInverseTransform(const sfCircleShape* shape);
CSFML_GRAPHICS_API sfTransform sfCircleShape_getInverseTransform(const sfCircleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Change the source texture of a circle shape
@@ -351,7 +353,7 @@ CSFML_GRAPHICS_API float sfCircleShape_getOutlineThickness(const sfCircleShape*
/// \return Number of points of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API unsigned int sfCircleShape_getPointCount(const sfCircleShape* shape);
CSFML_GRAPHICS_API size_t sfCircleShape_getPointCount(const sfCircleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get a point of a circle shape
@@ -364,7 +366,7 @@ CSFML_GRAPHICS_API unsigned int sfCircleShape_getPointCount(const sfCircleShape*
/// \return Index-th point of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVector2f sfCircleShape_getPoint(const sfCircleShape* shape, unsigned int index);
CSFML_GRAPHICS_API sfVector2f sfCircleShape_getPoint(const sfCircleShape* shape, size_t index);
////////////////////////////////////////////////////////////
/// \brief Set the radius of a circle
@@ -392,7 +394,7 @@ CSFML_GRAPHICS_API float sfCircleShape_getRadius(const sfCircleShape* shape);
/// \param count New number of points of the circle
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfCircleShape_setPointCount(sfCircleShape* shape, unsigned int count);
CSFML_GRAPHICS_API void sfCircleShape_setPointCount(sfCircleShape* shape, size_t count);
////////////////////////////////////////////////////////////
/// \brief Get the local bounding rectangle of a circle shape
+30 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -80,6 +80,24 @@ CSFML_GRAPHICS_API sfColor sfColor_fromRGB(sfUint8 red, sfUint8 green, sfUint8 b
////////////////////////////////////////////////////////////
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
///
@@ -91,6 +109,17 @@ CSFML_GRAPHICS_API sfColor sfColor_fromRGBA(sfUint8 red, sfUint8 green, sfUint8
////////////////////////////////////////////////////////////
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
///
+11 -9
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -31,8 +31,10 @@
#include <SFML/Graphics/Export.h>
#include <SFML/Graphics/Color.h>
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/Transform.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/Vector2.h>
#include <stddef.h>
////////////////////////////////////////////////////////////
@@ -51,12 +53,12 @@ CSFML_GRAPHICS_API sfConvexShape* sfConvexShape_create(void);
/// \return Copied object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfConvexShape* sfConvexShape_copy(sfConvexShape* shape);
CSFML_GRAPHICS_API sfConvexShape* sfConvexShape_copy(const sfConvexShape* shape);
////////////////////////////////////////////////////////////
/// \brief Destroy an existing convex Shape
///
/// \param Shape Shape to delete
/// \param shape Shape to delete
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfConvexShape_destroy(sfConvexShape* shape);
@@ -202,7 +204,7 @@ CSFML_GRAPHICS_API void sfConvexShape_scale(sfConvexShape* shape, sfVector2f fac
/// \return Transform combining the position/rotation/scale/origin of the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfConvexShape_getTransform(const sfConvexShape* shape);
CSFML_GRAPHICS_API sfTransform sfConvexShape_getTransform(const sfConvexShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the inverse of the combined transform of a convex shape
@@ -212,7 +214,7 @@ CSFML_GRAPHICS_API const sfTransform* sfConvexShape_getTransform(const sfConvexS
/// \return Inverse of the combined transformations applied to the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfConvexShape_getInverseTransform(const sfConvexShape* shape);
CSFML_GRAPHICS_API sfTransform sfConvexShape_getInverseTransform(const sfConvexShape* shape);
////////////////////////////////////////////////////////////
/// \brief Change the source texture of a convex shape
@@ -351,7 +353,7 @@ CSFML_GRAPHICS_API float sfConvexShape_getOutlineThickness(const sfConvexShape*
/// \return Number of points of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API unsigned int sfConvexShape_getPointCount(const sfConvexShape* shape);
CSFML_GRAPHICS_API size_t sfConvexShape_getPointCount(const sfConvexShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get a point of a convex shape
@@ -364,7 +366,7 @@ CSFML_GRAPHICS_API unsigned int sfConvexShape_getPointCount(const sfConvexShape*
/// \return Index-th point of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVector2f sfConvexShape_getPoint(const sfConvexShape* shape, unsigned int index);
CSFML_GRAPHICS_API sfVector2f sfConvexShape_getPoint(const sfConvexShape* shape, size_t index);
////////////////////////////////////////////////////////////
/// \brief Set the number of points of a convex shap
@@ -375,7 +377,7 @@ CSFML_GRAPHICS_API sfVector2f sfConvexShape_getPoint(const sfConvexShape* shape,
/// \param count New number of points of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfConvexShape_setPointCount(sfConvexShape* shape, unsigned int count);
CSFML_GRAPHICS_API void sfConvexShape_setPointCount(sfConvexShape* shape, size_t count);
////////////////////////////////////////////////////////////
/// \brief Set the position of a point in a convex shape
@@ -391,7 +393,7 @@ CSFML_GRAPHICS_API void sfConvexShape_setPointCount(sfConvexShape* shape, unsign
/// \param point New point
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfConvexShape_setPoint(sfConvexShape* shape, unsigned int index, sfVector2f point);
CSFML_GRAPHICS_API void sfConvexShape_setPoint(sfConvexShape* shape, size_t index, sfVector2f point);
////////////////////////////////////////////////////////////
/// \brief Get the local bounding rectangle of a convex shape
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
+48 -14
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -29,6 +29,7 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics/Export.h>
#include <SFML/Graphics/FontInfo.h>
#include <SFML/Graphics/Glyph.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/InputStream.h>
@@ -74,7 +75,7 @@ CSFML_GRAPHICS_API sfFont* sfFont_createFromStream(sfInputStream* stream);
/// \return Copied object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfFont* sfFont_copy(sfFont* font);
CSFML_GRAPHICS_API sfFont* sfFont_copy(const sfFont* font);
////////////////////////////////////////////////////////////
/// \brief Destroy an existing font
@@ -87,15 +88,16 @@ 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 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);
CSFML_GRAPHICS_API sfGlyph sfFont_getGlyph(const 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
@@ -108,19 +110,45 @@ CSFML_GRAPHICS_API sfGlyph sfFont_getGlyph(sfFont* font, sfUint32 codePoint, uns
/// \return Kerning offset, in pixels
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API int sfFont_getKerning(sfFont* font, sfUint32 first, sfUint32 second, unsigned int characterSize);
CSFML_GRAPHICS_API float sfFont_getKerning(const sfFont* font, sfUint32 first, sfUint32 second, unsigned int characterSize);
////////////////////////////////////////////////////////////
/// \brief Get the line spacing value
///
/// \param font Source font
/// \param codePoint Unicode code point of the character to get
/// \param characterSize Character size, in pixels
///
/// \return Line spacing, in pixels
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API int sfFont_getLineSpacing(sfFont* font, unsigned int characterSize);
CSFML_GRAPHICS_API float sfFont_getLineSpacing(const 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(const 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(const sfFont* font, unsigned int characterSize);
////////////////////////////////////////////////////////////
/// \brief Get the texture containing the glyphs of a given size in a font
@@ -134,12 +162,18 @@ CSFML_GRAPHICS_API int sfFont_getLineSpacing(sfFont* font, unsigned int characte
CSFML_GRAPHICS_API const sfTexture* sfFont_getTexture(sfFont* font, unsigned int characterSize);
////////////////////////////////////////////////////////////
/// \brief Get the built-in default font (Arial)
/// \brief Get the font information
///
/// \return Pointer to the default font
/// 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 const sfFont* sfFont_getDefaultFont(void);
CSFML_GRAPHICS_API sfFontInfo sfFont_getInfo(const sfFont* font);
#endif // SFML_IMAGE_H
#endif // SFML_FONT_H
+42
View File
@@ -0,0 +1,42 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 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 <SFML/Graphics/Export.h>
////////////////////////////////////////////////////////////
/// sfFontInfo holds various information about a font
////////////////////////////////////////////////////////////
typedef struct
{
const char* family;
} sfFontInfo;
#endif // SFML_FONTINFO_H
+100
View File
@@ -0,0 +1,100 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 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 <SFML/Graphics/Transform.h>
#include <SFML/Graphics/Color.h>
#include <SFML/System/Vector2.h>
#include <SFML/System/Vector3.h>
// 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
+4 -4
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -37,9 +37,9 @@
////////////////////////////////////////////////////////////
typedef struct
{
int advance; ///< Offset to move horizontically to the next character
sfIntRect bounds; ///< Bounding rectangle of the glyph, in coordinates relative to the baseline
sfIntRect textureRect; ///< Texture coordinates of the glyph inside the font's image
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;
+3 -3
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -133,7 +133,7 @@ CSFML_GRAPHICS_API sfImage* sfImage_createFromStream(sfInputStream* stream);
/// \return Copied object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfImage* sfImage_copy(sfImage* image);
CSFML_GRAPHICS_API sfImage* sfImage_copy(const sfImage* image);
////////////////////////////////////////////////////////////
/// \brief Destroy an existing image
@@ -181,7 +181,7 @@ CSFML_GRAPHICS_API sfVector2u sfImage_getSize(const sfImage* image);
/// \param alpha Alpha value to assign to transparent pixels
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfImage_createMaskFromColor(sfColor color, sfUint8 alpha);
CSFML_GRAPHICS_API void sfImage_createMaskFromColor(sfImage* image, sfColor color, sfUint8 alpha);
////////////////////////////////////////////////////////////
/// \brief Copy pixels from an image onto another
+14 -10
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -35,19 +35,23 @@
/// \brief Types of primitives that a sf::VertexArray can render
///
/// Points and lines have no area, therefore their thickness
/// will always be 1 pixel, regarldess the current transform
/// will always be 1 pixel, regardless the current transform
/// and view.
///
////////////////////////////////////////////////////////////
typedef enum
typedef enum
{
sfPoints, ///< List of individual points
sfLines, ///< List of individual lines
sfLinesStrip, ///< List of connected lines, a point uses the previous point to form a line
sfTriangles, ///< List of individual triangles
sfTrianglesStrip, ///< List of connected triangles, a point uses the two previous points to form a triangle
sfTrianglesFan, ///< List of connected triangles, a point uses the common center and the previous point to form a triangle
sfQuads ///< List of individual quads
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;
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
+44 -42
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -31,8 +31,10 @@
#include <SFML/Graphics/Export.h>
#include <SFML/Graphics/Color.h>
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/Transform.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/Vector2.h>
#include <stddef.h>
////////////////////////////////////////////////////////////
@@ -41,7 +43,7 @@
/// \return A new sfRectangleShape object, or NULL if it failed
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfRectangleShape* sfRectangleShape_Create(void);
CSFML_GRAPHICS_API sfRectangleShape* sfRectangleShape_create(void);
////////////////////////////////////////////////////////////
/// \brief Copy an existing rectangle shape
@@ -51,54 +53,54 @@ CSFML_GRAPHICS_API sfRectangleShape* sfRectangleShape_Create(void);
/// \return Copied object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfRectangleShape* sfRectangleShape_Copy(sfRectangleShape* shape);
CSFML_GRAPHICS_API sfRectangleShape* sfRectangleShape_copy(const sfRectangleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Destroy an existing rectangle shape
///
/// \param Shape Shape to delete
/// \param shape Shape to delete
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRectangleShape_Destroy(sfRectangleShape* shape);
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.
/// 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);
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.
/// 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);
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.
/// 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);
CSFML_GRAPHICS_API void sfRectangleShape_setScale(sfRectangleShape* shape, sfVector2f scale);
////////////////////////////////////////////////////////////
/// \brief Set the local origin of a rectangle shape
@@ -114,7 +116,7 @@ CSFML_GRAPHICS_API void sfRectangleShape_SetScale(sfRectangleShape* shape, sfVec
/// \param origin New origin
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRectangleShape_SetOrigin(sfRectangleShape* shape, sfVector2f origin);
CSFML_GRAPHICS_API void sfRectangleShape_setOrigin(sfRectangleShape* shape, sfVector2f origin);
////////////////////////////////////////////////////////////
/// \brief Get the position of a rectangle shape
@@ -124,7 +126,7 @@ CSFML_GRAPHICS_API void sfRectangleShape_SetOrigin(sfRectangleShape* shape, sfVe
/// \return Current position
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_GetPosition(const sfRectangleShape* shape);
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_getPosition(const sfRectangleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the orientation of a rectangle shape
@@ -136,7 +138,7 @@ CSFML_GRAPHICS_API sfVector2f sfRectangleShape_GetPosition(const sfRectangleShap
/// \return Current rotation, in degrees
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API float sfRectangleShape_GetRotation(const sfRectangleShape* shape);
CSFML_GRAPHICS_API float sfRectangleShape_getRotation(const sfRectangleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the current scale of a rectangle shape
@@ -146,7 +148,7 @@ CSFML_GRAPHICS_API float sfRectangleShape_GetRotation(const sfRectangleShape* sh
/// \return Current scale factors
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_GetScale(const sfRectangleShape* shape);
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_getScale(const sfRectangleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the local origin of a rectangle shape
@@ -156,43 +158,43 @@ CSFML_GRAPHICS_API sfVector2f sfRectangleShape_GetScale(const sfRectangleShape*
/// \return Current origin
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_GetOrigin(const sfRectangleShape* shape);
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.
/// unlike sfRectangleShape_setPosition which overwrites it.
///
/// \param shape Shape object
/// \param offset Offset
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRectangleShape_Move(sfRectangleShape* shape, sfVector2f 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.
/// 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);
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.
/// unlike sfRectangleShape_setScale which overwrites it.
///
/// \param shape Shape object
/// \param factors Scale factors
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRectangleShape_Scale(sfRectangleShape* shape, sfVector2f factors);
CSFML_GRAPHICS_API void sfRectangleShape_scale(sfRectangleShape* shape, sfVector2f factors);
////////////////////////////////////////////////////////////
/// \brief Get the combined transform of a rectangle shape
@@ -202,7 +204,7 @@ CSFML_GRAPHICS_API void sfRectangleShape_Scale(sfRectangleShape* shape, sfVector
/// \return Transform combining the position/rotation/scale/origin of the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfRectangleShape_GetTransform(const sfRectangleShape* shape);
CSFML_GRAPHICS_API sfTransform sfRectangleShape_getTransform(const sfRectangleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the inverse of the combined transform of a rectangle shape
@@ -212,7 +214,7 @@ CSFML_GRAPHICS_API const sfTransform* sfRectangleShape_GetTransform(const sfRect
/// \return Inverse of the combined transformations applied to the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfRectangleShape_GetInverseTransform(const sfRectangleShape* shape);
CSFML_GRAPHICS_API sfTransform sfRectangleShape_getInverseTransform(const sfRectangleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Change the source texture of a rectangle shape
@@ -233,7 +235,7 @@ CSFML_GRAPHICS_API const sfTransform* sfRectangleShape_GetInverseTransform(const
/// \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);
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
@@ -246,7 +248,7 @@ CSFML_GRAPHICS_API void sfRectangleShape_SetTexture(sfRectangleShape* shape, con
/// \param rect Rectangle defining the region of the texture to display
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRectangleShape_SetTextureRect(sfRectangleShape* shape, sfIntRect rect);
CSFML_GRAPHICS_API void sfRectangleShape_setTextureRect(sfRectangleShape* shape, sfIntRect rect);
////////////////////////////////////////////////////////////
/// \brief Set the fill color of a rectangle shape
@@ -262,7 +264,7 @@ CSFML_GRAPHICS_API void sfRectangleShape_SetTextureRect(sfRectangleShape* shape,
/// \param color New color of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRectangleShape_SetFillColor(sfRectangleShape* shape, sfColor color);
CSFML_GRAPHICS_API void sfRectangleShape_setFillColor(sfRectangleShape* shape, sfColor color);
////////////////////////////////////////////////////////////
/// \brief Set the outline color of a rectangle shape
@@ -274,7 +276,7 @@ CSFML_GRAPHICS_API void sfRectangleShape_SetFillColor(sfRectangleShape* shape, s
/// \param color New outline color of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRectangleShape_SetOutlineColor(sfRectangleShape* shape, sfColor color);
CSFML_GRAPHICS_API void sfRectangleShape_setOutlineColor(sfRectangleShape* shape, sfColor color);
////////////////////////////////////////////////////////////
/// \brief Set the thickness of a rectangle shape's outline
@@ -287,7 +289,7 @@ CSFML_GRAPHICS_API void sfRectangleShape_SetOutlineColor(sfRectangleShape* shape
/// \param thickness New outline thickness
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRectangleShape_SetOutlineThickness(sfRectangleShape* shape, float thickness);
CSFML_GRAPHICS_API void sfRectangleShape_setOutlineThickness(sfRectangleShape* shape, float thickness);
////////////////////////////////////////////////////////////
/// \brief Get the source texture of a rectangle shape
@@ -301,7 +303,7 @@ CSFML_GRAPHICS_API void sfRectangleShape_SetOutlineThickness(sfRectangleShape* s
/// \return Pointer to the shape's texture
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTexture* sfRectangleShape_GetTexture(const sfRectangleShape* shape);
CSFML_GRAPHICS_API const sfTexture* sfRectangleShape_getTexture(const sfRectangleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the sub-rectangle of the texture displayed by a rectangle shape
@@ -311,7 +313,7 @@ CSFML_GRAPHICS_API const sfTexture* sfRectangleShape_GetTexture(const sfRectangl
/// \return Texture rectangle of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfIntRect sfRectangleShape_GetTextureRect(const sfRectangleShape* shape);
CSFML_GRAPHICS_API sfIntRect sfRectangleShape_getTextureRect(const sfRectangleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the fill color of a rectangle shape
@@ -321,7 +323,7 @@ CSFML_GRAPHICS_API sfIntRect sfRectangleShape_GetTextureRect(const sfRectangleSh
/// \return Fill color of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfColor sfRectangleShape_GetFillColor(const sfRectangleShape* shape);
CSFML_GRAPHICS_API sfColor sfRectangleShape_getFillColor(const sfRectangleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the outline color of a rectangle shape
@@ -331,7 +333,7 @@ CSFML_GRAPHICS_API sfColor sfRectangleShape_GetFillColor(const sfRectangleShape*
/// \return Outline color of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfColor sfRectangleShape_GetOutlineColor(const sfRectangleShape* shape);
CSFML_GRAPHICS_API sfColor sfRectangleShape_getOutlineColor(const sfRectangleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the outline thickness of a rectangle shape
@@ -341,7 +343,7 @@ CSFML_GRAPHICS_API sfColor sfRectangleShape_GetOutlineColor(const sfRectangleSha
/// \return Outline thickness of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API float sfRectangleShape_GetOutlineThickness(const sfRectangleShape* shape);
CSFML_GRAPHICS_API float sfRectangleShape_getOutlineThickness(const sfRectangleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the total number of points of a rectangle shape
@@ -351,7 +353,7 @@ CSFML_GRAPHICS_API float sfRectangleShape_GetOutlineThickness(const sfRectangleS
/// \return Number of points of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API unsigned int sfRectangleShape_GetPointCount(const sfRectangleShape* shape);
CSFML_GRAPHICS_API size_t sfRectangleShape_getPointCount(const sfRectangleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get a point of a rectangle shape
@@ -359,12 +361,12 @@ CSFML_GRAPHICS_API unsigned int sfRectangleShape_GetPointCount(const sfRectangle
/// 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]
/// \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, unsigned int index);
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_getPoint(const sfRectangleShape* shape, size_t index);
////////////////////////////////////////////////////////////
/// \brief Set the size of a rectangle shape
@@ -373,17 +375,17 @@ CSFML_GRAPHICS_API sfVector2f sfRectangleShape_GetPoint(const sfRectangleShape*
/// \param size New size of the rectangle
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRectangleShape_SetSize(sfRectangleShape* shape, sfVector2f size);
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);
CSFML_GRAPHICS_API sfVector2f sfRectangleShape_getSize(const sfRectangleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the local bounding rectangle of a rectangle shape
@@ -399,7 +401,7 @@ CSFML_GRAPHICS_API sfVector2f sfRectangleShape_GetSize(const sfRectangleShape* s
/// \return Local bounding rectangle of the entity
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfFloatRect sfRectangleShape_GetLocalBounds(const sfRectangleShape* shape);
CSFML_GRAPHICS_API sfFloatRect sfRectangleShape_getLocalBounds(const sfRectangleShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the global bounding rectangle of a rectangle shape
@@ -415,7 +417,7 @@ CSFML_GRAPHICS_API sfFloatRect sfRectangleShape_GetLocalBounds(const sfRectangle
/// \return Global bounding rectangle of the entity
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfFloatRect sfRectangleShape_GetGlobalBounds(const sfRectangleShape* shape);
CSFML_GRAPHICS_API sfFloatRect sfRectangleShape_getGlobalBounds(const sfRectangleShape* shape);
#endif // SFML_RECTANGLESHAPE_H
+3 -2
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -30,6 +30,7 @@
////////////////////////////////////////////////////////////
#include <SFML/Graphics/Export.h>
#include <SFML/Graphics/BlendMode.h>
#include <SFML/Graphics/Transform.h>
#include <SFML/Graphics/Types.h>
@@ -40,7 +41,7 @@
typedef struct
{
sfBlendMode blendMode; ///< Blending mode
sfTransform* transform; ///< Transform
sfTransform transform; ///< Transform
const sfTexture* texture; ///< Texture
const sfShader* shader; ///< Shader
} sfRenderStates;
+109 -6
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -35,7 +35,9 @@
#include <SFML/Graphics/PrimitiveType.h>
#include <SFML/Graphics/RenderStates.h>
#include <SFML/Graphics/Vertex.h>
#include <SFML/Window/Window.h>
#include <SFML/System/Vector2.h>
#include <stddef.h>
////////////////////////////////////////////////////////////
@@ -47,9 +49,24 @@
///
/// \return A new sfRenderTexture object, or NULL if it failed
///
/// \deprecated
/// Use sfRenderTexture_createWithSettings instead.
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfRenderTexture* sfRenderTexture_create(unsigned int width, unsigned int height, sfBool depthBuffer);
////////////////////////////////////////////////////////////
/// \brief Construct a new render texture
///
/// \param width Width of the render texture
/// \param height Height of the render texture
/// \param settings Settings of the render texture
///
/// \return A new sfRenderTexture object, or NULL if it failed
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfRenderTexture* sfRenderTexture_createWithSettings(unsigned int width, unsigned int height, const sfContextSettings* settings);
////////////////////////////////////////////////////////////
/// \brief Destroy an existing render texture
///
@@ -137,16 +154,57 @@ CSFML_GRAPHICS_API const sfView* sfRenderTexture_getDefaultView(const sfRenderTe
CSFML_GRAPHICS_API sfIntRect sfRenderTexture_getViewport(const sfRenderTexture* renderTexture, const sfView* view);
////////////////////////////////////////////////////////////
/// \brief Convert a point in texture coordinates into view coordinates
/// \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 Point to convert, relative to the texture
/// \param targetView Target view to convert the point to (pass NULL to use the current view)
/// \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_convertCoords(const sfRenderTexture* renderTexture, sfVector2i point, const sfView* targetView);
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
@@ -163,6 +221,7 @@ CSFML_GRAPHICS_API void sfRenderTexture_drawCircleShape(sfRenderTexture* renderT
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);
CSFML_GRAPHICS_API void sfRenderTexture_drawVertexBuffer(sfRenderTexture* renderTexture, const sfVertexBuffer* object, const sfRenderStates* states);
////////////////////////////////////////////////////////////
/// \brief Draw primitives defined by an array of vertices to a render texture
@@ -175,7 +234,7 @@ CSFML_GRAPHICS_API void sfRenderTexture_drawVertexArray(sfRenderTexture* renderT
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRenderTexture_drawPrimitives(sfRenderTexture* renderTexture,
const sfVertex* vertices, unsigned int vertexCount,
const sfVertex* vertices, size_t vertexCount,
sfPrimitiveType type, const sfRenderStates* states);
////////////////////////////////////////////////////////////
@@ -236,6 +295,15 @@ CSFML_GRAPHICS_API void sfRenderTexture_resetGLStates(sfRenderTexture* renderTex
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTexture* sfRenderTexture_getTexture(const sfRenderTexture* renderTexture);
////////////////////////////////////////////////////////////
/// \brief Get the maximum anti-aliasing level supported by the system
///
/// \return The maximum anti-aliasing level supported by the system
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API unsigned int sfRenderTexture_getMaximumAntialiasingLevel();
////////////////////////////////////////////////////////////
/// \brief Enable or disable the smooth filter on a render texture
///
@@ -255,5 +323,40 @@ CSFML_GRAPHICS_API void sfRenderTexture_setSmooth(sfRenderTexture* renderTexture
////////////////////////////////////////////////////////////
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
+214 -40
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -40,6 +40,7 @@
#include <SFML/Window/WindowHandle.h>
#include <SFML/Window/Window.h>
#include <SFML/System/Vector2.h>
#include <stddef.h>
////////////////////////////////////////////////////////////
@@ -53,6 +54,17 @@
////////////////////////////////////////////////////////////
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
///
@@ -97,12 +109,12 @@ CSFML_GRAPHICS_API sfBool sfRenderWindow_isOpen(const sfRenderWindow* renderWind
CSFML_GRAPHICS_API sfContextSettings sfRenderWindow_getSettings(const sfRenderWindow* renderWindow);
////////////////////////////////////////////////////////////
/// \brief Get the event on top of events stack of a render window, if any, and pop it
/// \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 events stack was empty
/// \return sfTrue if an event was returned, sfFalse if event queue was empty
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfBool sfRenderWindow_pollEvent(sfRenderWindow* renderWindow, sfEvent* event);
@@ -167,10 +179,19 @@ CSFML_GRAPHICS_API void sfRenderWindow_setSize(sfRenderWindow* renderWindow, sfV
////////////////////////////////////////////////////////////
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 Renderw indow object
/// \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
@@ -187,6 +208,15 @@ CSFML_GRAPHICS_API void sfRenderWindow_setIcon(sfRenderWindow* renderWindow, uns
////////////////////////////////////////////////////////////
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
///
@@ -197,13 +227,38 @@ CSFML_GRAPHICS_API void sfRenderWindow_setVisible(sfRenderWindow* renderWindow,
CSFML_GRAPHICS_API void sfRenderWindow_setMouseCursorVisible(sfRenderWindow* renderWindow, sfBool show);
////////////////////////////////////////////////////////////
/// \brief Enable / disable vertical synchronization on a render window
/// \brief Grab or release the mouse cursor
///
/// \param renderWindow Render window object
/// \param enabled sfTrue to enable v-sync, sfFalse to deactivate
/// 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_setVerticalSyncEnabled(sfRenderWindow* renderWindow, sfBool enabled);
CSFML_GRAPHICS_API void sfRenderWindow_setMouseCursorGrabbed(sfRenderWindow* renderWindow, sfBool grabbed);
////////////////////////////////////////////////////////////
/// \brief Set the displayed cursor to a native system cursor
///
/// Upon window creation, the arrow cursor is used by default.
///
/// \warning The cursor must not be destroyed while in use by
/// the window.
///
/// \warning Features related to Cursor are not supported on
/// iOS and Android.
///
/// \param cursor Native system cursor type to display
///
/// \see sfCursor_createFromSystem
/// \see sfCursor_createFromPixels
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRenderWindow_setMouseCursor(sfRenderWindow* window, const sfCursor* cursor);
////////////////////////////////////////////////////////////
/// \brief Enable or disable automatic key-repeat for keydown events
@@ -216,25 +271,6 @@ CSFML_GRAPHICS_API void sfRenderWindow_setVerticalSyncEnabled(sfRenderWindow* re
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRenderWindow_setKeyRepeatEnabled(sfRenderWindow* renderWindow, sfBool enabled);
////////////////////////////////////////////////////////////
/// \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 Display a render window on screen
///
/// \param renderWindow Render window object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRenderWindow_display(sfRenderWindow* renderWindow);
////////////////////////////////////////////////////////////
/// \brief Limit the framerate to a maximum fixed frequency for a render window
///
@@ -253,6 +289,51 @@ CSFML_GRAPHICS_API void sfRenderWindow_setFramerateLimit(sfRenderWindow* renderW
////////////////////////////////////////////////////////////
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
///
@@ -313,16 +394,60 @@ CSFML_GRAPHICS_API const sfView* sfRenderWindow_getDefaultView(const sfRenderWin
CSFML_GRAPHICS_API sfIntRect sfRenderWindow_getViewport(const sfRenderWindow* renderWindow, const sfView* view);
////////////////////////////////////////////////////////////
/// \brief Convert a point in window coordinates into view coordinates
/// \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 Point to convert, relative to the window
/// \param targetView Target view to convert the point to (pass NULL to use the current view)
/// \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_convertCoords(const sfRenderWindow* renderWindow, sfVector2i point, const sfView* targetView);
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
@@ -339,6 +464,7 @@ CSFML_GRAPHICS_API void sfRenderWindow_drawCircleShape(sfRenderWindow* renderWin
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);
CSFML_GRAPHICS_API void sfRenderWindow_drawVertexBuffer(sfRenderWindow* renderWindow, const sfVertexBuffer* object, const sfRenderStates* states);
////////////////////////////////////////////////////////////
/// \brief Draw primitives defined by an array of vertices to a render window
@@ -351,7 +477,7 @@ CSFML_GRAPHICS_API void sfRenderWindow_drawVertexArray(sfRenderWindow* renderWin
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfRenderWindow_drawPrimitives(sfRenderWindow* renderWindow,
const sfVertex* vertices, unsigned int vertexCount,
const sfVertex* vertices, size_t vertexCount,
sfPrimitiveType type, const sfRenderStates* states);
////////////////////////////////////////////////////////////
@@ -403,22 +529,70 @@ CSFML_GRAPHICS_API void sfRenderWindow_popGLStates(sfRenderWindow* renderWindow)
CSFML_GRAPHICS_API void sfRenderWindow_resetGLStates(sfRenderWindow* renderWindow);
////////////////////////////////////////////////////////////
/// \brief Copy the current contents of a render window to an image
/// \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 its
/// update(sfWindow*) function.
/// 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
/// sfRenderWindow class.
/// sfRenderTexture class.
///
/// \param renderWindow Render window object
///
/// \return New image containing the captured contents
/// \return sfImage containing the captured contents.
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfImage* sfRenderWindow_capture(const sfRenderWindow* renderWindow);
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
+369 -47
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -30,68 +30,74 @@
////////////////////////////////////////////////////////////
#include <SFML/Graphics/Export.h>
#include <SFML/Graphics/Color.h>
#include <SFML/Graphics/Glsl.h>
#include <SFML/Graphics/Transform.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/InputStream.h>
#include <SFML/System/Vector2.h>
#include <SFML/System/Vector3.h>
#include <stddef.h>
////////////////////////////////////////////////////////////
/// \brief Load both the vertex and fragment shaders from files
/// \brief Load the vertex, geometry and fragment shaders from files
///
/// This function can load both the vertex and the fragment
/// shaders, or only one of them: pass NULL if you don't want to load
/// either the vertex shader or the fragment shader.
/// 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* fragmentShaderFilename);
CSFML_GRAPHICS_API sfShader* sfShader_createFromFile(const char* vertexShaderFilename, const char* geometryShaderFilename, const char* fragmentShaderFilename);
////////////////////////////////////////////////////////////
/// \brief Load both the vertex and fragment shaders from source codes in memory
/// \brief Load the vertex, geometry and fragment shaders from source code in memory
///
/// This function can load both the vertex and the fragment
/// shaders, or only one of them: pass NULL if you don't want to load
/// either the vertex shader or the fragment shader.
/// 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* fragmentShader);
CSFML_GRAPHICS_API sfShader* sfShader_createFromMemory(const char* vertexShader, const char* geometryShader, const char* fragmentShader);
////////////////////////////////////////////////////////////
/// \brief Load both the vertex and fragment shaders from custom streams
/// \brief Load the vertex, geometry and fragment shaders from custom streams
///
/// This function can load both the vertex and the fragment
/// shaders, or only one of them: pass NULL if you don't want to load
/// either the vertex shader or the fragment shader.
/// 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* fragmentShaderStream);
CSFML_GRAPHICS_API sfShader* sfShader_createFromStream(sfInputStream* vertexShaderStream, sfInputStream* geometryShaderStream, sfInputStream* fragmentShaderStream);
////////////////////////////////////////////////////////////
/// \brief Destroy an existing shader
@@ -101,6 +107,297 @@ CSFML_GRAPHICS_API sfShader* sfShader_createFromStream(sfInputStream* vertexShad
////////////////////////////////////////////////////////////
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
///
@@ -121,7 +418,7 @@ CSFML_GRAPHICS_API void sfShader_destroy(sfShader* shader);
/// \param x Value to assign
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setFloatParameter(sfShader* shader, const char* name, float x);
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
@@ -144,7 +441,7 @@ CSFML_GRAPHICS_API void sfShader_setFloatParameter(sfShader* shader, const char*
/// \param y Second component of the value to assign
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setFloat2Parameter(sfShader* shader, const char* name, float x, float y);
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
@@ -168,7 +465,7 @@ CSFML_GRAPHICS_API void sfShader_setFloat2Parameter(sfShader* shader, const char
/// \param z Third component of the value to assign
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setFloat3Parameter(sfShader* shader, const char* name, float x, float y, float z);
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
@@ -193,7 +490,7 @@ CSFML_GRAPHICS_API void sfShader_setFloat3Parameter(sfShader* shader, const char
/// \param w Fourth component of the value to assign
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setFloat4Parameter(sfShader* shader, const char* name, float x, float y, float z, float w);
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
@@ -216,7 +513,7 @@ CSFML_GRAPHICS_API void sfShader_setFloat4Parameter(sfShader* shader, const char
/// \param vector Vector to assign
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setVector2Parameter(sfShader* shader, const char* name, sfVector2f vector);
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
@@ -239,7 +536,7 @@ CSFML_GRAPHICS_API void sfShader_setVector2Parameter(sfShader* shader, const cha
/// \param vector Vector to assign
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setVector3Parameter(sfShader* shader, const char* name, sfVector3f vector);
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setVector3Parameter(sfShader* shader, const char* name, sfVector3f vector);
////////////////////////////////////////////////////////////
/// \brief Change a color parameter of a shader
@@ -259,7 +556,7 @@ CSFML_GRAPHICS_API void sfShader_setVector3Parameter(sfShader* shader, const cha
/// uniform vec4 color; // this is the variable in the shader
/// \endcode
/// \code
/// sfShader_setColorParameter(shader, "color", sfColor_FromRGB(255, 128, 0));
/// sfShader_setColorParameter(shader, "color", sfColor_fromRGB(255, 128, 0));
/// \endcode
///
/// \param shader Shader object
@@ -267,7 +564,7 @@ CSFML_GRAPHICS_API void sfShader_setVector3Parameter(sfShader* shader, const cha
/// \param color Color to assign
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setColorParameter(sfShader* shader, const char* name, sfColor color);
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setColorParameter(sfShader* shader, const char* name, sfColor color);
////////////////////////////////////////////////////////////
/// \brief Change a matrix parameter of a shader
@@ -290,7 +587,7 @@ CSFML_GRAPHICS_API void sfShader_setColorParameter(sfShader* shader, const char*
/// \param transform Transform to assign
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setTransformParameter(sfShader* shader, const char* name, const sfTransform* transform);
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setTransformParameter(sfShader* shader, const char* name, sfTransform transform);
////////////////////////////////////////////////////////////
/// \brief Change a texture parameter of a shader
@@ -323,7 +620,7 @@ CSFML_GRAPHICS_API void sfShader_setTransformParameter(sfShader* shader, const c
/// \param texture Texture to assign
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setTextureParameter(sfShader* shader, const char* name, const sfTexture* texture);
CSFML_GRAPHICS_API CSFML_DEPRECATED void sfShader_setTextureParameter(sfShader* shader, const char* name, const sfTexture* texture);
////////////////////////////////////////////////////////////
/// \brief Change a texture parameter of a shader
@@ -346,38 +643,45 @@ CSFML_GRAPHICS_API void sfShader_setTextureParameter(sfShader* shader, const cha
/// \param name Name of the texture in the shader
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_setCurrentTextureParameter(sfShader* shader, const char* name);
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 normally for internal use only, unless
/// you want to use the shader with a custom OpenGL rendering
/// instead of a SFML drawable.
/// 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
/// sfWindow_setActive(window, sfTrue);
/// sfShader_bind(shader);
/// ... render OpenGL geometry ...
/// sfShader_unbind(shader);
/// 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
/// \param shader Shader to bind, can be null to use no shader
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_bind(const sfShader* shader);
////////////////////////////////////////////////////////////
/// \brief Unbind a shader (deactivate it)
///
/// This function is normally for internal use only, unless
/// you want to use the shader with a custom OpenGL rendering
/// instead of a SFML drawable.
///
/// \param shader Shader to unbind
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShader_unbind(const sfShader* shader);
////////////////////////////////////////////////////////////
/// \brief Tell whether or not the system supports shaders
///
@@ -390,5 +694,23 @@ CSFML_GRAPHICS_API void sfShader_unbind(const sfShader* shader);
////////////////////////////////////////////////////////////
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
+10 -8
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -31,12 +31,14 @@
#include <SFML/Graphics/Export.h>
#include <SFML/Graphics/Color.h>
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/Transform.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/Vector2.h>
#include <stddef.h>
typedef unsigned int (*sfShapeGetPointCountCallback)(void*); ///< Type of the callback used to get the number of points in a shape
typedef sfVector2f (*sfShapeGetPointCallback)(unsigned int, void*); ///< Type of the callback used to get a point of a shape
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
@@ -55,7 +57,7 @@ CSFML_GRAPHICS_API sfShape* sfShape_create(sfShapeGetPointCountCallback getPoint
////////////////////////////////////////////////////////////
/// \brief Destroy an existing shape
///
/// \param Shape Shape to delete
/// \param shape Shape to delete
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfShape_destroy(sfShape* shape);
@@ -201,7 +203,7 @@ CSFML_GRAPHICS_API void sfShape_scale(sfShape* shape, sfVector2f factors);
/// \return Transform combining the position/rotation/scale/origin of the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfShape_getTransform(const sfShape* shape);
CSFML_GRAPHICS_API sfTransform sfShape_getTransform(const sfShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get the inverse of the combined transform of a shape
@@ -211,7 +213,7 @@ CSFML_GRAPHICS_API const sfTransform* sfShape_getTransform(const sfShape* shape)
/// \return Inverse of the combined transformations applied to the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfShape_getInverseTransform(const sfShape* shape);
CSFML_GRAPHICS_API sfTransform sfShape_getInverseTransform(const sfShape* shape);
////////////////////////////////////////////////////////////
/// \brief Change the source texture of a shape
@@ -350,7 +352,7 @@ CSFML_GRAPHICS_API float sfShape_getOutlineThickness(const sfShape* shape);
/// \return Number of points of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API unsigned int sfShape_getPointCount(const sfShape* shape);
CSFML_GRAPHICS_API size_t sfShape_getPointCount(const sfShape* shape);
////////////////////////////////////////////////////////////
/// \brief Get a point of a shape
@@ -363,7 +365,7 @@ CSFML_GRAPHICS_API unsigned int sfShape_getPointCount(const sfShape* shape);
/// \return Index-th point of the shape
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVector2f sfShape_getPoint(const sfShape* shape, unsigned int index);
CSFML_GRAPHICS_API sfVector2f sfShape_getPoint(const sfShape* shape, size_t index);
////////////////////////////////////////////////////////////
/// \brief Get the local bounding rectangle of a shape
+5 -4
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -32,6 +32,7 @@
#include <SFML/Graphics/BlendMode.h>
#include <SFML/Graphics/Color.h>
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/Transform.h>
#include <SFML/Graphics/Types.h>
#include <SFML/System/Vector2.h>
@@ -52,7 +53,7 @@ CSFML_GRAPHICS_API sfSprite* sfSprite_create(void);
/// \return Copied object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfSprite* sfSprite_copy(sfSprite* sprite);
CSFML_GRAPHICS_API sfSprite* sfSprite_copy(const sfSprite* sprite);
////////////////////////////////////////////////////////////
/// \brief Destroy an existing sprite
@@ -203,7 +204,7 @@ CSFML_GRAPHICS_API void sfSprite_scale(sfSprite* sprite, sfVector2f factors);
/// \return Transform combining the position/rotation/scale/origin of the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfSprite_getTransform(const sfSprite* sprite);
CSFML_GRAPHICS_API sfTransform sfSprite_getTransform(const sfSprite* sprite);
////////////////////////////////////////////////////////////
/// \brief Get the inverse of the combined transform of a sprite
@@ -213,7 +214,7 @@ CSFML_GRAPHICS_API const sfTransform* sfSprite_getTransform(const sfSprite* spri
/// \return Inverse of the combined transformations applied to the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfSprite_getInverseTransform(const sfSprite* sprite);
CSFML_GRAPHICS_API sfTransform sfSprite_getInverseTransform(const sfSprite* sprite);
////////////////////////////////////////////////////////////
/// \brief Change the source texture of a sprite
+157 -17
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -32,6 +32,7 @@
#include <SFML/Graphics/Color.h>
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/Types.h>
#include <SFML/Graphics/Transform.h>
#include <SFML/System/Vector2.h>
#include <stddef.h>
@@ -41,10 +42,11 @@
////////////////////////////////////////////////////////////
typedef enum
{
sfTextRegular = 0, ///< Regular characters, no style
sfTextBold = 1 << 0, ///< Characters are bold
sfTextItalic = 1 << 1, ///< Characters are in italic
sfTextUnderlined = 1 << 2 ///< Characters are underlined
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;
@@ -64,7 +66,7 @@ CSFML_GRAPHICS_API sfText* sfText_create(void);
/// \return Copied object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfText* sfText_copy(sfText* text);
CSFML_GRAPHICS_API sfText* sfText_copy(const sfText* text);
////////////////////////////////////////////////////////////
/// \brief Destroy an existing text
@@ -215,7 +217,7 @@ CSFML_GRAPHICS_API void sfText_scale(sfText* text, sfVector2f factors);
/// \return Transform combining the position/rotation/scale/origin of the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfText_getTransform(const sfText* text);
CSFML_GRAPHICS_API sfTransform sfText_getTransform(const sfText* text);
////////////////////////////////////////////////////////////
/// \brief Get the inverse of the combined transform of a text
@@ -225,7 +227,7 @@ CSFML_GRAPHICS_API const sfTransform* sfText_getTransform(const sfText* text);
/// \return Inverse of the combined transformations applied to the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfText_getInverseTransform(const sfText* text);
CSFML_GRAPHICS_API sfTransform sfText_getInverseTransform(const sfText* text);
////////////////////////////////////////////////////////////
/// \brief Set the string of a text (from an ANSI string)
@@ -256,8 +258,6 @@ CSFML_GRAPHICS_API void sfText_setUnicodeString(sfText* text, const sfUint32* st
/// 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.
/// Texts have a valid font by default, which the built-in
/// sfFont_getDefaultFont().
///
/// \param text Text object
/// \param font New font
@@ -276,6 +276,41 @@ CSFML_GRAPHICS_API void sfText_setFont(sfText* text, const sfFont* font);
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfText_setCharacterSize(sfText* text, unsigned int size);
////////////////////////////////////////////////////////////
/// \brief Set the line spacing factor
///
/// The default spacing between lines is defined by the font.
/// This method enables you to set a factor for the spacing
/// between lines. By default the line spacing factor is 1.
///
/// \param text Text object
/// \param spacingFactor New line spacing factor
///
/// \see sfText_getLineSpacing
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfText_setLineSpacing(sfText* text, float spacingFactor);
////////////////////////////////////////////////////////////
/// \brief Set the letter spacing factor
///
/// The default spacing between letters is defined by the font.
/// This factor doesn't directly apply to the existing
/// spacing between each character, it rather adds a fixed
/// space between them which is calculated from the font
/// metrics and the character size.
/// Note that factors below 1 (including negative numbers) bring
/// characters closer to each other.
/// By default the letter spacing factor is 1.
///
/// \param text Text object
/// \param spacingFactor New letter spacing factor
///
/// \see sfText_getLetterSpacing
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfText_setLetterSpacing(sfText* text, float spacingFactor);
////////////////////////////////////////////////////////////
/// \brief Set the style of a text
///
@@ -290,22 +325,66 @@ CSFML_GRAPHICS_API void sfText_setCharacterSize(sfText* text, unsigned int size)
CSFML_GRAPHICS_API void sfText_setStyle(sfText* text, sfUint32 style);
////////////////////////////////////////////////////////////
/// \brief Set the global color of a text
/// \brief Set the fill color of a text
///
/// By default, the text's color is opaque white.
/// 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 color of the text
/// \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 Get the text of a text (returns an ANSI string)
/// \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 an a locale-dependant ANSI string
/// \return String as a locale-dependant ANSI string
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const char* sfText_getString(const sfText* text);
@@ -323,6 +402,10 @@ 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
@@ -340,6 +423,30 @@ CSFML_GRAPHICS_API const sfFont* sfText_getFont(const sfText* text);
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API unsigned int sfText_getCharacterSize(const sfText* text);
////////////////////////////////////////////////////////////
/// \brief Get the size of the letter spacing factor
///
/// \param text Text object
///
/// \return Size of the letter spacing factor
///
/// \see sfText_setLetterSpacing
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API float sfText_getLetterSpacing(const sfText* text);
////////////////////////////////////////////////////////////
/// \brief Get the size of the line spacing factor
///
/// \param text Text object
///
/// \return Size of the line spacing factor
///
/// \see sfText_setLineSpacing
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API float sfText_getLineSpacing(const sfText* text);
////////////////////////////////////////////////////////////
/// \brief Get the style of a text
///
@@ -351,15 +458,48 @@ CSFML_GRAPHICS_API unsigned int sfText_getCharacterSize(const sfText* text);
CSFML_GRAPHICS_API sfUint32 sfText_getStyle(const sfText* text);
////////////////////////////////////////////////////////////
/// \brief Get the global color of a text
/// \brief Get the fill color of a text
///
/// \param text Text object
///
/// \return Global color of the text
/// \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
///
+126 -10
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -101,7 +101,7 @@ CSFML_GRAPHICS_API sfTexture* sfTexture_createFromImage(const sfImage* image, co
/// \return Copied object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfTexture* sfTexture_copy(sfTexture* texture);
CSFML_GRAPHICS_API sfTexture* sfTexture_copy(const sfTexture* texture);
////////////////////////////////////////////////////////////
/// \brief Destroy an existing texture
@@ -144,6 +144,24 @@ CSFML_GRAPHICS_API sfImage* sfTexture_copyToImage(const sfTexture* texture);
////////////////////////////////////////////////////////////
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 part of this texture from another texture
///
/// No additional check is performed on the size of the texture,
/// passing an invalid combination of texture size and offset
/// will lead to an undefined behavior.
///
/// This function does nothing if either texture was not
/// previously created.
///
/// \param destination Destination texture to copy source texture to
/// \param source Source texture to copy to destination texture
/// \param x X offset in this texture where to copy the source texture
/// \param y Y offset in this texture where to copy the source texture
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfTexture_updateFromTexture(sfTexture* destination, const sfTexture* source, unsigned int x, unsigned int y);
////////////////////////////////////////////////////////////
/// \brief Update a texture from an image
///
@@ -177,14 +195,6 @@ CSFML_GRAPHICS_API void sfTexture_updateFromWindow(sfTexture* texture, const sfW
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfTexture_updateFromRenderWindow(sfTexture* texture, const sfRenderWindow* renderWindow, unsigned int x, unsigned int y);
////////////////////////////////////////////////////////////
/// \brief Activate a texture for rendering
///
/// \param texture Texture to bind
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfTexture_bind(const sfTexture* texture);
////////////////////////////////////////////////////////////
/// \brief Enable or disable the smooth filter on a texture
///
@@ -204,6 +214,41 @@ CSFML_GRAPHICS_API void sfTexture_setSmooth(sfTexture* texture, sfBool smooth);
////////////////////////////////////////////////////////////
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
///
@@ -237,6 +282,77 @@ CSFML_GRAPHICS_API void sfTexture_setRepeated(sfTexture* texture, sfBool repeate
////////////////////////////////////////////////////////////
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 Swap the contents of a texture with those of another
///
/// \param left Instance to swap from
/// \param right Instance to swap with
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfTexture_swap(sfTexture* left, sfTexture* right);
////////////////////////////////////////////////////////////
/// \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
///
+42 -39
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -34,15 +34,22 @@
#include <SFML/System/Vector2.h>
////////////////////////////////////////////////////////////
/// \brief Create a new transform
///
/// This function creates an identity transform.
///
/// \return A new sfTransform object
/// \brief Encapsulate a 3x3 transform matrix
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfTransform* sfTransform_create(void);
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
@@ -60,46 +67,29 @@ CSFML_GRAPHICS_API sfTransform* sfTransform_create(void);
/// \return A new sfTransform object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfTransform* sfTransform_createFromMatrix(float a00, float a01, float a02,
float a10, float a11, float a12,
float a20, float a21, float a22);
////////////////////////////////////////////////////////////
/// \brief Copy an existing transform
///
/// \param transform Transform to copy
///
/// \return Copied object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfTransform* sfTransform_copy(sfTransform* transform);
////////////////////////////////////////////////////////////
/// \brief Destroy an existing transform
///
/// \param transform Transform to delete
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfTransform_destroy(sfTransform* transform);
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 returns a pointer to an array of 16 floats
/// containing the transform elements as a 4x4 matrix, which
/// is directly compatible with OpenGL functions.
/// 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 = ...;
/// glLoadMatrixf(sfTransform_getMatrix(transform));
/// sfTransform transform = ...;
/// float matrix[16];
/// sfTransform_getMatrix(&transform, matrix)
/// glLoadMatrixf(matrix);
/// \endcode
///
/// \param transform Transform object
///
/// \return Pointer to a 4x4 matrix
/// \param matrix Pointer to the 16-element array to fill with the matrix
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const float* sfTransform_getMatrix(const sfTransform* transform);
CSFML_GRAPHICS_API void sfTransform_getMatrix(const sfTransform* transform, float* matrix);
////////////////////////////////////////////////////////////
/// \brief Return the inverse of a transform
@@ -108,10 +98,10 @@ CSFML_GRAPHICS_API const float* sfTransform_getMatrix(const sfTransform* transfo
/// is returned.
///
/// \param transform Transform object
/// \param result Returned inverse matrix
/// \return The inverse matrix
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfTransform_getInverse(const sfTransform* transform, sfTransform* result);
CSFML_GRAPHICS_API sfTransform sfTransform_getInverse(const sfTransform* transform);
////////////////////////////////////////////////////////////
/// \brief Apply a transform to a 2D point
@@ -149,7 +139,7 @@ CSFML_GRAPHICS_API sfFloatRect sfTransform_transformRect(const sfTransform* tran
/// equivalent to a matrix multiplication.
///
/// \param transform Transform object
/// \param right Transform to combine to \a transform
/// \param other Transform to combine to \a transform
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfTransform_combine(sfTransform* transform, const sfTransform* other);
@@ -216,5 +206,18 @@ CSFML_GRAPHICS_API void sfTransform_scale(sfTransform* transform, float scaleX,
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfTransform_scaleWithCenter(sfTransform* transform, float scaleX, float scaleY, float centerX, float centerY);
////////////////////////////////////////////////////////////
/// \brief Compare two transforms for equality
///
/// Performs an element-wise comparison of the elements of the
/// left transform with the elements of the right transform.
///
/// \param left Left operand (the first transform)
/// \param right Right operand (the second transform)
///
/// \return true if the transforms are equal, false otherwise
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfBool sfTransform_equal(sfTransform* left, sfTransform* right);
#endif // SFML_TRANSFORM_H
+5 -4
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -30,6 +30,7 @@
////////////////////////////////////////////////////////////
#include <SFML/Graphics/Export.h>
#include <SFML/Graphics/Types.h>
#include <SFML/Graphics/Transform.h>
#include <SFML/System/Vector2.h>
@@ -49,7 +50,7 @@ CSFML_GRAPHICS_API sfTransformable* sfTransformable_create(void);
/// \return Copied object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfTransformable* sfTransformable_copy(sfTransformable* transformable);
CSFML_GRAPHICS_API sfTransformable* sfTransformable_copy(const sfTransformable* transformable);
////////////////////////////////////////////////////////////
/// \brief Destroy an existing transformable
@@ -200,7 +201,7 @@ CSFML_GRAPHICS_API void sfTransformable_scale(sfTransformable* transformable, sf
/// \return Transform combining the position/rotation/scale/origin of the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfTransformable_getTransform(const sfTransformable* transformable);
CSFML_GRAPHICS_API sfTransform sfTransformable_getTransform(const sfTransformable* transformable);
////////////////////////////////////////////////////////////
/// \brief Get the inverse of the combined transform of a transformable
@@ -210,7 +211,7 @@ CSFML_GRAPHICS_API const sfTransform* sfTransformable_getTransform(const sfTrans
/// \return Inverse of the combined transformations applied to the object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API const sfTransform* sfTransformable_getInverseTransform(const sfTransformable* transformable);
CSFML_GRAPHICS_API sfTransform sfTransformable_getInverseTransform(const sfTransformable* transformable);
#endif // SFML_TRANSFORMABLE_H
+2 -2
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -38,9 +38,9 @@ typedef struct sfShape sfShape;
typedef struct sfSprite sfSprite;
typedef struct sfText sfText;
typedef struct sfTexture sfTexture;
typedef struct sfTransform sfTransform;
typedef struct sfTransformable sfTransformable;
typedef struct sfVertexArray sfVertexArray;
typedef struct sfVertexBuffer sfVertexBuffer;
typedef struct sfView sfView;
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
+6 -5
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -33,6 +33,7 @@
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/Types.h>
#include <SFML/Graphics/Vertex.h>
#include <stddef.h>
////////////////////////////////////////////////////////////
@@ -51,7 +52,7 @@ CSFML_GRAPHICS_API sfVertexArray* sfVertexArray_create(void);
/// \return Copied object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVertexArray* sfVertexArray_copy(sfVertexArray* vertexArray);
CSFML_GRAPHICS_API sfVertexArray* sfVertexArray_copy(const sfVertexArray* vertexArray);
////////////////////////////////////////////////////////////
/// \brief Destroy an existing vertex array
@@ -69,7 +70,7 @@ CSFML_GRAPHICS_API void sfVertexArray_destroy(sfVertexArray* vertexArray);
/// \return Number of vertices in the array
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API unsigned int sfVertexArray_getVertexCount(const sfVertexArray* vertexArray);
CSFML_GRAPHICS_API size_t sfVertexArray_getVertexCount(const sfVertexArray* vertexArray);
////////////////////////////////////////////////////////////
/// \brief Get access to a vertex by its index
@@ -84,7 +85,7 @@ CSFML_GRAPHICS_API unsigned int sfVertexArray_getVertexCount(const sfVertexArray
/// \return Pointer to the index-th vertex
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVertex* sfVertexArray_getVertex(sfVertexArray* vertexArray, unsigned int index);
CSFML_GRAPHICS_API sfVertex* sfVertexArray_getVertex(sfVertexArray* vertexArray, size_t index);
////////////////////////////////////////////////////////////
/// \brief Clear a vertex array
@@ -112,7 +113,7 @@ CSFML_GRAPHICS_API void sfVertexArray_clear(sfVertexArray* vertexArray);
/// \param vertexCount New size of the array (number of vertices)
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfVertexArray_resize(sfVertexArray* vertexArray, unsigned int vertexCount);
CSFML_GRAPHICS_API void sfVertexArray_resize(sfVertexArray* vertexArray, size_t vertexCount);
////////////////////////////////////////////////////////////
/// \brief Add a vertex to a vertex array array
+254
View File
@@ -0,0 +1,254 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 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_VERTEXBUFFER_H
#define SFML_VERTEXBUFFER_H
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics/Export.h>
#include <SFML/Graphics/PrimitiveType.h>
#include <SFML/Graphics/Types.h>
#include <SFML/Graphics/Vertex.h>
#include <stddef.h>
////////////////////////////////////////////////////////////
/// \brief Usage specifiers
///
/// If data is going to be updated once or more every frame,
/// set the usage to sfVertexBufferStream. If data is going
/// to be set once and used for a long time without being
/// modified, set the usage to sfVertexBufferUsageStatic.
/// For everything else sfVertexBufferUsageDynamic should
/// be a good compromise.
///
////////////////////////////////////////////////////////////
typedef enum
{
sfVertexBufferStream, ///< Constantly changing data
sfVertexBufferDynamic, ///< Occasionally changing data
sfVertexBufferStatic ///< Rarely changing data
} sfVertexBufferUsage;
////////////////////////////////////////////////////////////
/// \brief Create a new vertex buffer with a specific
/// sfPrimitiveType and usage specifier.
///
/// Creates the vertex buffer, allocating enough graphcis
/// memory to hold \p vertexCount vertices, and sets its
/// primitive type to \p type and usage to \p usage.
///
/// \param vertexCount Amount of vertices
/// \param type Type of primitive
/// \param usage Usage specifier
///
/// \return A new sfVertexBuffer object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVertexBuffer* sfVertexBuffer_create(unsigned int vertexCount, sfPrimitiveType type, sfVertexBufferUsage usage);
////////////////////////////////////////////////////////////
/// \brief Copy an existing vertex buffer
///
/// \param vertexBuffer Vertex buffer to copy
///
/// \return Copied object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVertexBuffer* sfVertexBuffer_copy(const sfVertexBuffer* vertexBuffer);
////////////////////////////////////////////////////////////
/// \brief Destroy an existing vertex buffer
///
/// \param vertexBuffer Vertex buffer to delete
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfVertexBuffer_destroy(sfVertexBuffer* vertexBuffer);
////////////////////////////////////////////////////////////
/// \brief Return the vertex count
///
/// \param vertexBuffer Vertex buffer object
///
/// \return Number of vertices in the vertex buffer
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API unsigned int sfVertexBuffer_getVertexCount(const sfVertexBuffer* vertexBuffer);
////////////////////////////////////////////////////////////
/// \brief Update a part of the buffer from an array of vertices
///
/// \p offset is specified as the number of vertices to skip
/// from the beginning of the buffer.
///
/// If \p offset is 0 and \p vertexCount is equal to the size of
/// the currently created buffer, its whole contents are replaced.
///
/// If \p offset is 0 and \p vertexCount is greater than the
/// size of the currently created buffer, a new buffer is created
/// containing the vertex data.
///
/// If \p offset is 0 and \p vertexCount is less than the size of
/// the currently created buffer, only the corresponding region
/// is updated.
///
/// If \p offset is not 0 and \p offset + \p vertexCount is greater
/// than the size of the currently created buffer, the update fails.
///
/// No additional check is performed on the size of the vertex
/// array, passing invalid arguments will lead to undefined
/// behavior.
///
/// \param vertices Array of vertices to copy to the buffer
/// \param vertexCount Number of vertices to copy
/// \param offset Offset in the buffer to copy to
///
/// \return sfTrue if the update was successful
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfBool sfVertexBuffer_update(sfVertexBuffer* vertexBuffer, const sfVertex* vertices, unsigned int vertexCount, unsigned int offset);
////////////////////////////////////////////////////////////
/// \brief Copy the contents of another buffer into this buffer
///
/// \param vertexBuffer Vertex buffer object
/// \param other Vertex buffer whose contents to copy into first vertex buffer
///
/// \return sfTrue if the copy was successful
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfBool sfVertexBuffer_updateFromVertexBuffer(sfVertexBuffer* vertexBuffer, const sfVertexBuffer* other);
////////////////////////////////////////////////////////////
/// \brief Swap the contents of this vertex buffer with those of another
///
/// \param left Instance to swap
/// \param right Instance to swap with
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfVertexBuffer_swap(sfVertexBuffer* left, sfVertexBuffer* right);
////////////////////////////////////////////////////////////
/// \brief Get the underlying OpenGL handle of the vertex buffer.
///
/// 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.
///
/// \return OpenGL handle of the vertex buffer or 0 if not yet created
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API unsigned int sfVertexBuffer_getNativeHandle(sfVertexBuffer* vertexBuffer);
////////////////////////////////////////////////////////////
/// \brief Set the type of primitives to draw
///
/// This function defines how the vertices must be interpreted
/// when it's time to draw them.
///
/// The default primitive type is sf::Points.
///
/// \param vertexBuffer Vertex buffer object
/// \param type Type of primitive
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfVertexBuffer_setPrimitiveType(sfVertexBuffer* vertexBuffer, sfPrimitiveType type);
////////////////////////////////////////////////////////////
/// \brief Get the type of primitives drawn by the vertex buffer
///
/// \param vertexBuffer Vertex buffer object
///
/// \return Primitive type
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfPrimitiveType sfVertexBuffer_getPrimitiveType(const sfVertexBuffer* vertexBuffer);
////////////////////////////////////////////////////////////
/// \brief Set the usage specifier of this vertex buffer
///
/// This function provides a hint about how this vertex buffer is
/// going to be used in terms of data update frequency.
///
/// After changing the usage specifier, the vertex buffer has
/// to be updated with new data for the usage specifier to
/// take effect.
///
/// The default primitive type is sfVertexBufferStream.
///
/// \param vertexBuffer Vertex buffer object
/// \param usage Usage specifier
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfVertexBuffer_setUsage(sfVertexBuffer* vertexBuffer, sfVertexBufferUsage usage);
////////////////////////////////////////////////////////////
/// \brief Get the usage specifier of this vertex buffer
///
/// \param vertexBuffer Vertex buffer object
///
/// \return Usage specifier
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfVertexBufferUsage sfVertexBuffer_getUsage(const sfVertexBuffer* vertexBuffer);
////////////////////////////////////////////////////////////
/// \brief Bind a vertex buffer 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 sfVertexBuffer with OpenGL code.
///
/// \code
/// sfVertexBuffer* vb1, vb2;
/// ...
/// sfVertexBuffer_bind(vb1);
/// // draw OpenGL stuff that use vb1...
/// sfVertexBuffer_bind(vb2);
/// // draw OpenGL stuff that use vb2...
/// sfVertexBuffer_bind(NULL);
/// // draw OpenGL stuff that use no vertex buffer...
/// \endcode
///
/// \param vertexBuffer Pointer to the vertex buffer to bind, can be null to use no vertex buffer
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API void sfVertexBuffer_bind(const sfVertexBuffer* vertexBuffer);
////////////////////////////////////////////////////////////
/// \brief Tell whether or not the system supports vertex buffers
///
/// This function should always be called before using
/// the vertex buffer features. If it returns false, then
/// any attempt to use sf::VertexBuffer will fail.
///
/// \return True if vertex buffers are supported, false otherwise
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfBool sfVertexBuffer_isAvailable();
#endif // SFML_VERTEXBUFFER_H
+2 -2
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -62,7 +62,7 @@ CSFML_GRAPHICS_API sfView* sfView_createFromRect(sfFloatRect rectangle);
/// \return Copied object
///
////////////////////////////////////////////////////////////
CSFML_GRAPHICS_API sfView* sfView_copy(sfView* view);
CSFML_GRAPHICS_API sfView* sfView_copy(const sfView* view);
////////////////////////////////////////////////////////////
/// \brief Destroy an existing view
+4 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -30,9 +30,12 @@
////////////////////////////////////////////////////////////
#include <SFML/System.h>
#include <SFML/Network/Ftp.h>
#include <SFML/Network/Http.h>
#include <SFML/Network/IpAddress.h>
#include <SFML/Network/Packet.h>
#include <SFML/Network/SocketSelector.h>
#include <SFML/Network/SocketStatus.h>
#include <SFML/Network/TcpListener.h>
#include <SFML/Network/TcpSocket.h>
#include <SFML/Network/UdpSocket.h>
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
+37 -16
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -38,19 +38,19 @@
/// \brief Enumeration of transfer modes
///
////////////////////////////////////////////////////////////
enum sfFtpTransferMode
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
///
////////////////////////////////////////////////////////////
enum sfFtpStatus
typedef enum
{
// 1xx: the requested action is being initiated,
// expect another reply before proceeding with a new command
@@ -110,7 +110,7 @@ enum sfFtpStatus
sfFtpConnectionFailed = 1001, ///< Connection with server failed
sfFtpConnectionClosed = 1002, ///< Connection with server closed
sfFtpInvalidFile = 1003 ///< Invalid file to upload / download
};
} sfFtpStatus;
////////////////////////////////////////////////////////////
@@ -155,25 +155,25 @@ CSFML_NETWORK_API sfFtpStatus sfFtpListingResponse_getStatus(const sfFtpListingR
CSFML_NETWORK_API const char* sfFtpListingResponse_getMessage(const sfFtpListingResponse* ftpListingResponse);
////////////////////////////////////////////////////////////
/// \brief Return the number of filenames contained in a FTP listing response
/// \brief Return the number of directory/file names contained in a FTP listing response
///
/// \param ftpListingResponse Ftp listing response
///
/// \return Total number of filenames available
/// \return Total number of names available
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API size_t sfFtpListingResponse_getCount(const sfFtpListingResponse* ftpListingResponse);
////////////////////////////////////////////////////////////
/// \brief Return a filename contained in a FTP listing response
/// \brief Return a directory/file name contained in a FTP listing response
///
/// \param ftpListingResponse Ftp listing response
/// \param index Index of the filename to get (in range [0 .. GetCount])
/// \param index Index of the name to get (in range [0 .. getCount])
///
/// \return Array containing the requested filenames
/// \return The requested name
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API const char* sfFtpListingResponse_getFilename(const sfFtpListingResponse* ftpListingResponse, size_t index);
CSFML_NETWORK_API const char* sfFtpListingResponse_getName(const sfFtpListingResponse* ftpListingResponse, size_t index);
////////////////////////////////////////////////////////////
/// \brief Destroy a FTP directory response
@@ -299,12 +299,12 @@ CSFML_NETWORK_API void sfFtp_destroy(sfFtp* ftp);
/// \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, in milliseconds
/// \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, sfUint32 timeout);
CSFML_NETWORK_API sfFtpResponse* sfFtp_connect(sfFtp* ftp, sfIpAddress server, unsigned short port, sfTime timeout);
////////////////////////////////////////////////////////////
/// \brief Log in using an anonymous account
@@ -332,7 +332,7 @@ CSFML_NETWORK_API sfFtpResponse* sfFtp_loginAnonymous(sfFtp* ftp);
/// \return Server response to the request
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfFtpResponse* sfFtp_login(sfFtp* ftp, const char* userName, const char* password);
CSFML_NETWORK_API sfFtpResponse* sfFtp_login(sfFtp* ftp, const char* name, const char* password);
////////////////////////////////////////////////////////////
/// \brief Close the connection with the server
@@ -486,7 +486,7 @@ CSFML_NETWORK_API sfFtpResponse* sfFtp_deleteFile(sfFtp* ftp, const char* name);
/// \return Server response to the request
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfFtpResponse* sfFtp_download(sfFtp* ftp, const char* distantFile, const char* destPath, sfFtpTransferMode mode);
CSFML_NETWORK_API sfFtpResponse* sfFtp_download(sfFtp* ftp, const char* remoteFile, const char* localPath, sfFtpTransferMode mode);
////////////////////////////////////////////////////////////
/// \brief Upload a file to a FTP server
@@ -500,11 +500,32 @@ CSFML_NETWORK_API sfFtpResponse* sfFtp_download(sfFtp* ftp, const char* distantF
/// \param localFile Path of the local file to upload
/// \param remotePath Where to put to file on the server
/// \param mode Transfer mode
/// \param append Pass sfTrue to append to or sfFalse to overwrite the remote file if it already exists
///
/// \return Server response to the request
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfFtpResponse* sfFtp_upload(sfFtp* ftp, const char* localFile, const char* destPath, sfFtpTransferMode mode);
CSFML_NETWORK_API sfFtpResponse* sfFtp_upload(sfFtp* ftp, const char* localFile, const char* remotePath, sfFtpTransferMode mode, sfBool append);
////////////////////////////////////////////////////////////
/// \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
+25 -18
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -37,48 +37,55 @@
/// \brief Enumerate the available HTTP methods for a request
///
////////////////////////////////////////////////////////////
enum sfHttpMethod
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
};
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
///
////////////////////////////////////////////////////////////
enum sfHttpStatus
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
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 conditionnal requests, means the requested page hasn't changed and doesn't need to be refreshed
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 authentification to be accessed
sfHttpForbidden = 403, ///< The requested page cannot be accessed at all, even with authentification
sfHttpNotFound = 404, ///< The requested page doesn't exist
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;
////////////////////////////////////////////////////////////
@@ -275,7 +282,7 @@ CSFML_NETWORK_API void sfHttp_setHost(sfHttp* http, const char* host, unsigned s
////////////////////////////////////////////////////////////
/// \brief Send a HTTP request and return the server's response.
///
/// You must have a valid host before sending a request (see sfHttp_SetHost).
/// 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
+11 -6
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -46,19 +46,25 @@ typedef struct
/// \brief Empty object that represents invalid addresses
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfIpAddress sfIpAddress_None;
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 sfIpAddress sfIpAddress_LocalHost;
CSFML_NETWORK_API const sfIpAddress sfIpAddress_LocalHost;
////////////////////////////////////////////////////////////
/// \brief UDP broadcast address (255.255.255.255)
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfIpAddress sfIpAddress_Broadcast;
CSFML_NETWORK_API const sfIpAddress sfIpAddress_Broadcast;
////////////////////////////////////////////////////////////
/// \brief Create an address from a string
@@ -114,8 +120,7 @@ CSFML_NETWORK_API sfIpAddress sfIpAddress_fromInteger(sfUint32 address);
/// from a host name.
///
/// \param address Address object
///
/// \return String representation of the address
/// \param string String where the string representation will be stored
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API void sfIpAddress_toString(sfIpAddress address, char* string);
+2 -2
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -49,7 +49,7 @@ CSFML_NETWORK_API sfPacket* sfPacket_create(void);
/// \return A new sfPacket object which is a copy of \a packet
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfPacket* sfPacket_copy(sfPacket* packet);
CSFML_NETWORK_API sfPacket* sfPacket_copy(const sfPacket* packet);
////////////////////////////////////////////////////////////
/// \brief Destroy a packet
+3 -3
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -49,7 +49,7 @@ CSFML_NETWORK_API sfSocketSelector* sfSocketSelector_create(void);
/// \return A new sfSocketSelector object which is a copy of \a selector
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSocketSelector* sfSocketSelector_copy(sfSocketSelector* selector);
CSFML_NETWORK_API sfSocketSelector* sfSocketSelector_copy(const sfSocketSelector* selector);
////////////////////////////////////////////////////////////
/// \brief Destroy a socket selector
@@ -121,7 +121,7 @@ CSFML_NETWORK_API sfBool sfSocketSelector_wait(sfSocketSelector* selector, sfTim
/// \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
/// 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,
+2 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -34,6 +34,7 @@ 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
+11 -3
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -30,6 +30,7 @@
////////////////////////////////////////////////////////////
#include <SFML/Network/Export.h>
#include <SFML/Network/SocketStatus.h>
#include <SFML/Network/IpAddress.h>
#include <SFML/Network/Types.h>
@@ -54,7 +55,7 @@ CSFML_NETWORK_API void sfTcpListener_destroy(sfTcpListener* 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
/// 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
@@ -98,13 +99,16 @@ CSFML_NETWORK_API unsigned short sfTcpListener_getLocalPort(const sfTcpListener*
/// 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);
CSFML_NETWORK_API sfSocketStatus sfTcpListener_listen(sfTcpListener* listener, unsigned short port, sfIpAddress address);
////////////////////////////////////////////////////////////
/// \brief Accept a new connection
@@ -112,6 +116,10 @@ CSFML_NETWORK_API sfSocketStatus sfTcpListener_listen(sfTcpListener* listener, u
/// 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
///
+25 -3
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -134,7 +134,7 @@ CSFML_NETWORK_API unsigned short sfTcpSocket_getRemotePort(const sfTcpSocket* so
/// \return Status code
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSocketStatus sfTcpSocket_connect(sfTcpSocket* socket, sfIpAddress host, unsigned short port, sfTime timeout);
CSFML_NETWORK_API sfSocketStatus sfTcpSocket_connect(sfTcpSocket* socket, sfIpAddress remoteAddress, unsigned short remotePort, sfTime timeout);
////////////////////////////////////////////////////////////
/// \brief Disconnect a TCP socket from its remote peer
@@ -150,6 +150,9 @@ 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
@@ -161,6 +164,21 @@ CSFML_NETWORK_API void sfTcpSocket_disconnect(sfTcpSocket* socket);
////////////////////////////////////////////////////////////
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
///
@@ -176,11 +194,15 @@ CSFML_NETWORK_API sfSocketStatus sfTcpSocket_send(sfTcpSocket* socket, const voi
/// \return Status code
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSocketStatus sfTcpSocket_receive(sfTcpSocket* socket, void* data, size_t maxSize, size_t* sizeReceived);
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
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
+12 -9
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -101,13 +101,16 @@ CSFML_NETWORK_API unsigned short sfUdpSocket_getLocalPort(const sfUdpSocket* soc
/// system to automatically pick an available port, and then
/// call sfUdpSocket_getLocalPort to retrieve the chosen port.
///
/// \param socket UDP socket object
/// \param port Port to bind the socket to
/// 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);
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
@@ -119,7 +122,7 @@ CSFML_NETWORK_API sfSocketStatus sfUdpSocket_bind(sfUdpSocket* socket, unsigned
/// \param socket UDP socket object
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API void sfUdpSocket_Unbind(sfUdpSocket* socket);
CSFML_NETWORK_API void sfUdpSocket_unbind(sfUdpSocket* socket);
////////////////////////////////////////////////////////////
/// \brief Send raw data to a remote peer with a UDP socket
@@ -137,7 +140,7 @@ CSFML_NETWORK_API void sfUdpSocket_Unbind(sfUdpSocket* socket);
/// \return Status code
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSocketStatus sfUdpSocket_send(sfUdpSocket* socket, const void* data, size_t size, sfIpAddress address, unsigned short port);
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
@@ -159,7 +162,7 @@ CSFML_NETWORK_API sfSocketStatus sfUdpSocket_send(sfUdpSocket* socket, const voi
/// \return Status code
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSocketStatus sfUdpSocket_receive(sfUdpSocket* socket, void* data, size_t maxSize, size_t* sizeReceived, sfIpAddress* address, unsigned short* port);
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
@@ -176,7 +179,7 @@ CSFML_NETWORK_API sfSocketStatus sfUdpSocket_receive(sfUdpSocket* socket, void*
/// \return Status code
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSocketStatus sfUdpSocket_sendPacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress address, unsigned short port);
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
@@ -191,7 +194,7 @@ CSFML_NETWORK_API sfSocketStatus sfUdpSocket_sendPacket(sfUdpSocket* socket, sfP
/// \return Status code
///
////////////////////////////////////////////////////////////
CSFML_NETWORK_API sfSocketStatus sfUdpSocket_receivePacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress* address, unsigned short* port);
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
+4 -4
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -27,14 +27,14 @@
////////////////////////////////////////////////////////////
/// Headers
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Config.h>
////////////////////////////////////////////////////////////
/// This file just includes the OpenGL (GL and GLU) headers,
/// which have actually different paths on each system
// This file just includes the OpenGL (GL and GLU) headers,
// which have actually different paths on each system
////////////////////////////////////////////////////////////
#if defined(CSFML_SYSTEM_WINDOWS)
+2 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -35,6 +35,7 @@
#include <SFML/System/Mutex.h>
#include <SFML/System/Sleep.h>
#include <SFML/System/Thread.h>
#include <SFML/System/Time.h>
#include <SFML/System/Vector2.h>
#include <SFML/System/Vector3.h>
+2 -2
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -49,7 +49,7 @@ CSFML_SYSTEM_API sfClock* sfClock_create(void);
/// \return A new sfClock object which is a copy of \a clock
///
////////////////////////////////////////////////////////////
CSFML_SYSTEM_API sfClock* sfClock_copy(sfClock* clock);
CSFML_SYSTEM_API sfClock* sfClock_copy(const sfClock* clock);
////////////////////////////////////////////////////////////
/// \brief Destroy a clock
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
+2 -2
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -41,7 +41,7 @@ typedef struct
} sfTime;
////////////////////////////////////////////////////////////
/// \brief Predefined "zero" time value
/// \brief Predefined "zero" time value
///
////////////////////////////////////////////////////////////
CSFML_SYSTEM_API sfTime sfTime_Zero;
+2 -1
View File
@@ -1,7 +1,8 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)//
// Copyright (C) 2007-2018 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.
//
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
+6 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -30,11 +30,16 @@
////////////////////////////////////////////////////////////
#include <SFML/System.h>
#include <SFML/Window/Clipboard.h>
#include <SFML/Window/Context.h>
#include <SFML/Window/Cursor.h>
#include <SFML/Window/Event.h>
#include <SFML/Window/Joystick.h>
#include <SFML/Window/JoystickIdentification.h>
#include <SFML/Window/Keyboard.h>
#include <SFML/Window/Mouse.h>
#include <SFML/Window/Sensor.h>
#include <SFML/Window/Touch.h>
#include <SFML/Window/VideoMode.h>
#include <SFML/Window/Window.h>
+85
View File
@@ -0,0 +1,85 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 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_CLIPBOARD_H
#define SFML_CLIPBOARD_H
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window/Export.h>
#include <SFML/Window/Types.h>
////////////////////////////////////////////////////////////
/// \brief Get the content of the clipboard as string data (returns an ANSI string)
///
/// This function returns the content of the clipboard
/// as a string. If the clipboard does not contain string
/// it returns an empty string.
///
/// \return Clipboard contents as a locale-dependent ANSI string
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API const char* sfClipboard_getString();
////////////////////////////////////////////////////////////
/// \brief Get the content of the clipboard as string data (returns a Unicode string)
///
/// This function returns the content of the clipboard
/// as a string. If the clipboard does not contain string
/// it returns an empty string.
///
/// \return Clipboard contents as UTF-32
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API const sfUint32* sfClipboard_getUnicodeString();
////////////////////////////////////////////////////////////
/// \brief Set the content of the clipboard as ANSI string data
///
/// This function sets the content of the clipboard as an
/// ANSI string.
///
/// \param text ANSI string containing the data to be sent
/// to the clipboard
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfClipboard_setString(const char* text);
////////////////////////////////////////////////////////////
/// \brief Set the content of the clipboard as Unicode string data
///
/// This function sets the content of the clipboard as a
/// Unicode string.
///
/// \param text Unicode string containing the data to be sent
/// to the clipboard
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfClipboard_setUnicodeString(const sfUint32* text);
#endif // SFML_CURSOR_H
+27 -3
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -30,7 +30,7 @@
////////////////////////////////////////////////////////////
#include <SFML/Window/Export.h>
#include <SFML/Window/Types.h>
#include <SFML/Window/Window.h>
////////////////////////////////////////////////////////////
/// \brief Create a new context
@@ -56,8 +56,32 @@ CSFML_WINDOW_API void sfContext_destroy(sfContext* context);
/// \param context Context object
/// \param active sfTrue to activate, sfFalse to deactivate
///
/// \return sfTrue on success, sfFalse on failure
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfContext_setActive(sfContext* context, sfBool active);
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);
////////////////////////////////////////////////////////////
/// \brief Get the currently active context's ID
///
/// The context ID is used to identify contexts when
/// managing unshareable OpenGL resources.
///
/// \return The active context's ID or 0 if no context is currently active
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API sfUint64 sfContext_getActiveContextId();
#endif // SFML_CONTEXT_H
+132
View File
@@ -0,0 +1,132 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 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_CURSOR_H
#define SFML_CURSOR_H
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/System/Vector2.h>
#include <SFML/Window/Export.h>
#include <SFML/Window/Types.h>
////////////////////////////////////////////////////////////
/// \brief Enumeration of the native system cursor types
///
/// Refer to the following table to determine which cursor
/// is available on which platform.
///
/// Type | Linux | Mac OS X | Windows
/// ------------------------------------|:-----:|:--------:|:--------:
/// sfCursorArrow | yes | yes | yes
/// sfCursorArrowWait | no | no | yes
/// sfCursorWait | yes | no | yes
/// sfCursorText | yes | yes | yes
/// sfCursorHand | yes | yes | yes
/// sfCursorSizeHorizontal | yes | yes | yes
/// sfCursorSizeVertical | yes | yes | yes
/// sfCursorSizeTopLeftBottomRight | no | no | yes
/// sfCursorSizeBottomLeftTopRight | no | no | yes
/// sfCursorSizeAll | yes | no | yes
/// sfCursorCross | yes | yes | yes
/// sfCursorHelp | yes | no | yes
/// sfCursorNotAllowed | yes | yes | yes
///
////////////////////////////////////////////////////////////
typedef enum
{
sfCursorArrow, ///< Arrow cursor (default)
sfCursorArrowWait, ///< Busy arrow cursor
sfCursorWait, ///< Busy cursor
sfCursorText, ///< I-beam, cursor when hovering over a field allowing text entry
sfCursorHand, ///< Pointing hand cursor
sfCursorSizeHorizontal, ///< Horizontal double arrow cursor
sfCursorSizeVertical, ///< Vertical double arrow cursor
sfCursorSizeTopLeftBottomRight, ///< Double arrow cursor going from top-left to bottom-right
sfCursorSizeBottomLeftTopRight, ///< Double arrow cursor going from bottom-left to top-right
sfCursorSizeAll, ///< Combination of SizeHorizontal and SizeVertical
sfCursorCross, ///< Crosshair cursor
sfCursorHelp, ///< Help cursor
sfCursorNotAllowed ///< Action not allowed cursor
} sfCursorType;
////////////////////////////////////////////////////////////
/// \brief Create a cursor with the provided image
///
/// \a pixels must be an array of \a width by \a height pixels
/// in 32-bit RGBA format. If not, this will cause undefined behavior.
///
/// If \a pixels is null or either \a width or \a height are 0,
/// the current cursor is left unchanged and the function will
/// return false.
///
/// In addition to specifying the pixel data, you can also
/// specify the location of the hotspot of the cursor. The
/// hotspot is the pixel coordinate within the cursor image
/// which will be located exactly where the mouse pointer
/// position is. Any mouse actions that are performed will
/// return the window/screen location of the hotspot.
///
/// \warning On Unix, the pixels are mapped into a monochrome
/// bitmap: pixels with an alpha channel to 0 are
/// transparent, black if the RGB channel are close
/// to zero, and white otherwise.
///
/// \param pixels Array of pixels of the image
/// \param size Width and height of the image
/// \param hotspot (x,y) location of the hotspot
/// \return A new sfCursor object
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API sfCursor* sfCursor_createFromPixels(const sfUint8* pixels, sfVector2u size, sfVector2u hotspot);
////////////////////////////////////////////////////////////
/// \brief Create a native system cursor
///
/// Refer to the list of cursor available on each system
/// (see sfCursorType) to know whether a given cursor is
/// expected to load successfully or is not supported by
/// the operating system.
///
/// \param type Native system cursor type
/// \return A new sfCursor object
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API sfCursor* sfCursor_createFromSystem(sfCursorType type);
////////////////////////////////////////////////////////////
/// \brief Destroy a cursor
///
/// \param cursor Cursor to destroy
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfCursor_destroy(sfCursor* cursor);
#endif // SFML_CURSOR_H
+99 -50
View File
@@ -1,7 +1,8 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)//
// Copyright (C) 2007-2018 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.
//
@@ -31,6 +32,7 @@
#include <SFML/Window/Joystick.h>
#include <SFML/Window/Keyboard.h>
#include <SFML/Window/Mouse.h>
#include <SFML/Window/Sensor.h>
////////////////////////////////////////////////////////////
@@ -39,24 +41,31 @@
////////////////////////////////////////////////////////////
typedef enum
{
sfEvtClosed,
sfEvtResized,
sfEvtLostFocus,
sfEvtGainedFocus,
sfEvtTextEntered,
sfEvtKeyPressed,
sfEvtKeyReleased,
sfEvtMouseWheelMoved,
sfEvtMouseButtonPressed,
sfEvtMouseButtonReleased,
sfEvtMouseMoved,
sfEvtMouseEntered,
sfEvtMouseLeft,
sfEvtJoystickButtonPressed,
sfEvtJoystickButtonReleased,
sfEvtJoystickMoved,
sfEvtJoystickConnected,
sfEvtJoystickDisconnected
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;
@@ -64,7 +73,7 @@ typedef enum
/// \brief Keyboard event parameters
///
////////////////////////////////////////////////////////////
struct sfKeyEvent
typedef struct
{
sfEventType type;
sfKeyCode code;
@@ -72,97 +81,137 @@ struct sfKeyEvent
sfBool control;
sfBool shift;
sfBool system;
};
} sfKeyEvent;
////////////////////////////////////////////////////////////
/// \brief Text event parameters
///
////////////////////////////////////////////////////////////
struct sfTextEvent
typedef struct
{
sfEventType type;
sfUint32 unicode;
};
} sfTextEvent;
////////////////////////////////////////////////////////////
/// \brief Mouse move event parameters
///
////////////////////////////////////////////////////////////
struct sfMouseMoveEvent
typedef struct
{
sfEventType type;
int x;
int y;
};
} sfMouseMoveEvent;
////////////////////////////////////////////////////////////
/// \brief Mouse buttons events parameters
///
////////////////////////////////////////////////////////////
struct sfMouseButtonEvent
typedef struct
{
sfEventType type;
sfMouseButton button;
int x;
int y;
};
} sfMouseButtonEvent;
////////////////////////////////////////////////////////////
/// \brief Mouse wheel events parameters
///
/// \deprecated
/// Use sfMouseWheelScrollEvent instead.
///
////////////////////////////////////////////////////////////
struct sfMouseWheelEvent
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
///
////////////////////////////////////////////////////////////
struct sfJoystickMoveEvent
typedef struct
{
sfEventType type;
unsigned int joystickId;
sfJoystickAxis axis;
float position;
};
} sfJoystickMoveEvent;
////////////////////////////////////////////////////////////
/// \brief Joystick buttons events parameters
///
////////////////////////////////////////////////////////////
struct sfJoystickButtonEvent
typedef struct
{
sfEventType type;
unsigned int joystickId;
unsigned int button;
};
} sfJoystickButtonEvent;
////////////////////////////////////////////////////////////
/// \brief Joystick connection/disconnection event parameters
///
////////////////////////////////////////////////////////////
struct sfJoystickConnectEvent
typedef struct
{
sfEventType type;
unsigned int joystickId;
};
} sfJoystickConnectEvent;
////////////////////////////////////////////////////////////
/// \brief Size events parameters
///
////////////////////////////////////////////////////////////
struct sfSizeEvent
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
@@ -170,19 +219,19 @@ struct sfSizeEvent
////////////////////////////////////////////////////////////
typedef union
{
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
sfEventType type; ///< Type of the event
struct sfSizeEvent size;
struct sfKeyEvent key;
struct sfTextEvent text;
struct sfMouseMoveEvent mouseMove;
struct sfMouseButtonEvent mouseButton;
struct sfMouseWheelEvent mouseWheel;
struct sfJoystickMoveEvent joystickMove;
struct sfJoystickButtonEvent joystickButton;
struct sfJoystickConnectEvent joystickConnect;
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;
+1 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
+16 -1
View File
@@ -1,7 +1,8 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)//
// Copyright (C) 2007-2018 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.
//
@@ -28,6 +29,7 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window/Export.h>
#include <SFML/Window/JoystickIdentification.h>
////////////////////////////////////////////////////////////
@@ -120,6 +122,19 @@ CSFML_WINDOW_API sfBool sfJoystick_isButtonPressed(unsigned int joystick, unsign
////////////////////////////////////////////////////////////
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
///
@@ -0,0 +1,45 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 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 <SFML/Window/Export.h>
////////////////////////////////////////////////////////////
/// sfJoystickIdentification holds a joystick's identification
////////////////////////////////////////////////////////////
typedef struct
{
const char* name;
unsigned int vendorId;
unsigned int productId;
} sfJoystickIdentification;
#endif // SFML_JOYSTICKIDENDIFICATION_H
+34 -11
View File
@@ -1,7 +1,8 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)//
// Copyright (C) 2007-2018 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.
//
@@ -36,6 +37,7 @@
////////////////////////////////////////////////////////////
typedef enum
{
sfKeyUnknown = -1, ///< Unhandled key
sfKeyA, ///< The A key
sfKeyB, ///< The B key
sfKeyC, ///< The C key
@@ -84,18 +86,18 @@ typedef enum
sfKeyMenu, ///< The Menu key
sfKeyLBracket, ///< The [ key
sfKeyRBracket, ///< The ] key
sfKeySemiColon, ///< The ; key
sfKeySemicolon, ///< The ; key
sfKeyComma, ///< The , key
sfKeyPeriod, ///< The . key
sfKeyQuote, ///< The ' key
sfKeySlash, ///< The / key
sfKeyBackSlash, ///< The \ key
sfKeyBackslash, ///< The \ key
sfKeyTilde, ///< The ~ key
sfKeyEqual, ///< The = key
sfKeyDash, ///< The - key
sfKeyHyphen, ///< The - key (hyphen)
sfKeySpace, ///< The Space key
sfKeyReturn, ///< The Return key
sfKeyBack, ///< The Backspace key
sfKeyEnter, ///< The Enter/Return key
sfKeyBackspace, ///< The Backspace key
sfKeyTab, ///< The Tabulation key
sfKeyPageUp, ///< The Page up key
sfKeyPageDown, ///< The Page down key
@@ -103,10 +105,10 @@ typedef enum
sfKeyHome, ///< The Home key
sfKeyInsert, ///< The Insert key
sfKeyDelete, ///< The Delete key
sfKeyAdd, ///< +
sfKeySubtract, ///< -
sfKeyMultiply, ///< *
sfKeyDivide, ///< /
sfKeyAdd, ///< The + key
sfKeySubtract, ///< The - key (minus, usually from numpad)
sfKeyMultiply, ///< The * key
sfKeyDivide, ///< The / key
sfKeyLeft, ///< Left arrow
sfKeyRight, ///< Right arrow
sfKeyUp, ///< Up arrow
@@ -138,7 +140,15 @@ typedef enum
sfKeyF15, ///< The F15 key
sfKeyPause, ///< The Pause key
sfKeyCount ///< Keep last -- the total number of keyboard keys
sfKeyCount, ///< Keep last -- the total number of keyboard keys
// Deprecated values:
sfKeyDash = sfKeyHyphen, ///< \deprecated Use Hyphen instead
sfKeyBack = sfKeyBackspace, ///< \deprecated Use Backspace instead
sfKeyBackSlash = sfKeyBackslash, ///< \deprecated Use Backslash instead
sfKeySemiColon = sfKeySemicolon, ///< \deprecated Use Semicolon instead
sfKeyReturn = sfKeyEnter ///< \deprecated Use Enter instead
} sfKeyCode;
@@ -152,5 +162,18 @@ typedef enum
////////////////////////////////////////////////////////////
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
+12 -1
View File
@@ -1,7 +1,8 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)//
// Copyright (C) 2007-2018 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.
//
@@ -47,6 +48,16 @@ typedef enum
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
+89
View File
@@ -0,0 +1,89 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 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 <SFML/Window/Export.h>
#include <SFML/Window/Types.h>
#include <SFML/System/Vector3.h>
////////////////////////////////////////////////////////////
/// \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
+61
View File
@@ -0,0 +1,61 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2018 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 <SFML/Window/Export.h>
#include <SFML/Window/Types.h>
#include <SFML/System/Vector2.h>
////////////////////////////////////////////////////////////
/// \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
+2 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -27,6 +27,7 @@
typedef struct sfContext sfContext;
typedef struct sfCursor sfCursor;
typedef struct sfWindow sfWindow;
+3 -2
View File
@@ -1,7 +1,8 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)//
// Copyright (C) 2007-2018 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.
//
@@ -69,7 +70,7 @@ CSFML_WINDOW_API sfVideoMode sfVideoMode_getDesktopMode(void);
/// \return Pointer to an array containing all the supported fullscreen modes
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API const sfVideoMode* sfVideoMode_getFullscreenModes(size_t* Count);
CSFML_WINDOW_API const sfVideoMode* sfVideoMode_getFullscreenModes(size_t* count);
////////////////////////////////////////////////////////////
/// \brief Tell whether or not a video mode is valid
+156 -48
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -40,7 +40,7 @@
/// \brief Enumeration of window creation styles
///
////////////////////////////////////////////////////////////
enum
typedef enum
{
sfNone = 0, ///< No border / title bar (this flag and all others are mutually exclusive)
sfTitlebar = 1 << 0, ///< Title bar + fixed border
@@ -48,7 +48,19 @@ enum
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;
////////////////////////////////////////////////////////////
@@ -62,6 +74,8 @@ typedef struct
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;
@@ -88,6 +102,29 @@ typedef struct
////////////////////////////////////////////////////////////
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
///
@@ -132,7 +169,7 @@ 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
/// Note that a hidden window (sfWindow_setVisible(sfFalse)) will return
/// sfTrue.
///
/// \param window Window object
@@ -158,18 +195,18 @@ CSFML_WINDOW_API sfBool sfWindow_isOpen(const sfWindow* window);
CSFML_WINDOW_API sfContextSettings sfWindow_getSettings(const sfWindow* window);
////////////////////////////////////////////////////////////
/// \brief Pop the event on top of events stack, if any, and return it
/// \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 events stack,
/// 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 events stack was empty
/// \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);
@@ -247,6 +284,15 @@ CSFML_WINDOW_API void sfWindow_setSize(sfWindow* window, sfVector2u size);
////////////////////////////////////////////////////////////
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
///
@@ -270,15 +316,6 @@ CSFML_WINDOW_API void sfWindow_setIcon(sfWindow* window, unsigned int width, uns
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfWindow_setVisible(sfWindow* window, sfBool visible);
////////////////////////////////////////////////////////////
/// \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 Enable or disable vertical synchronization
///
@@ -293,6 +330,50 @@ CSFML_WINDOW_API void sfWindow_setMouseCursorVisible(sfWindow* window, sfBool vi
////////////////////////////////////////////////////////////
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 Set the displayed cursor to a native system cursor
///
/// Upon window creation, the arrow cursor is used by default.
///
/// \warning The cursor must not be destroyed while in use by
/// the window.
///
/// \warning Features related to Cursor are not supported on
/// iOS and Android.
///
/// \param window Window object
/// \param cursor Native system cursor type to display
///
/// \see sfCursor_createFromSystem
/// \see sfCursor_createFromPixels
///
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfWindow_setMouseCursor(sfWindow* window, const sfCursor* cursor);
////////////////////////////////////////////////////////////
/// \brief Enable or disable automatic key-repeat
///
@@ -308,42 +389,11 @@ CSFML_WINDOW_API void sfWindow_setVerticalSyncEnabled(sfWindow* window, sfBool e
////////////////////////////////////////////////////////////
CSFML_WINDOW_API void sfWindow_setKeyRepeatEnabled(sfWindow* window, sfBool enabled);
////////////////////////////////////////////////////////////
/// \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.
///
/// \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 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 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
/// each call to sfWindow_display to ensure that the current frame
/// lasted long enough to match the framerate limit.
///
/// \param window Window object
@@ -364,6 +414,64 @@ CSFML_WINDOW_API void sfWindow_setFramerateLimit(sfWindow* window, unsigned int
////////////////////////////////////////////////////////////
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
///
+3 -3
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -32,8 +32,8 @@
////////////////////////////////////////////////////////////
/// Define a low-level window handle type, specific to
/// each platform
// Define a low-level window handle type, specific to
// each platform
////////////////////////////////////////////////////////////
#if defined(CSFML_SYSTEM_WINDOWS)
+1 -1
View File
@@ -1,7 +1,7 @@
CSFML
-----
CSFML - Copyright (c) 2007-2011 Laurent Gomila - laurent.gom@gmail.com
CSFML - Copyright (C) 2007-2021 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
+17 -11
View File
@@ -1,20 +1,21 @@
CSFML - 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.
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.gom@gmail.com)
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.php).
You can also get the current development version from the git repository (https://github.com/LaurentGomila/CSFML).
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
-----
@@ -22,15 +23,20 @@ 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/LaurentGomila/SFML/wiki/)
* The community forum (http://www.sfml-dev.org/forum/)
* 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 CSFM API documentation in the SDK.
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://www.sfml-dev.org/forum/),
submit patches by e-mail, or post new bugs/features requests on the task tracker (https://github.com/LaurentGomila/CSFML/issues/).
You can even fork the project on github, maintain your own version and send us pull requests periodically to merge your work.
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.
+1 -1
View File
@@ -32,4 +32,4 @@ set(SRC
# define the csfml-audio target
csfml_add_library(csfml-audio
SOURCES ${SRC}
DEPENDS ${SFML_AUDIO_LIBRARY} ${SFML_SYSTEM_LIBRARY})
DEPENDS sfml-audio)
+17 -1
View File
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2012 Laurent Gomila (laurent.gom@gmail.com)
// Copyright (C) 2007-2018 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.
@@ -74,3 +74,19 @@ sfVector3f sfListener_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;
}
Loaded 100 of 214 files, more files were not shown because too many files have changed in this diff. Show more