├── README.md ├── binding ├── CSFMLAudio.pas ├── CSFMLAudioExport.inc ├── CSFMLAudioListener.inc ├── CSFMLAudioMusic.inc ├── CSFMLAudioSound.inc ├── CSFMLAudioSoundBuffer.inc ├── CSFMLAudioSoundBufferRecorder.inc ├── CSFMLAudioSoundRecorder.inc ├── CSFMLAudioSoundStatus.inc ├── CSFMLAudioSoundStream.inc ├── CSFMLAudioTypes.inc ├── CSFMLConfig.pas ├── CSFMLGraphics.pas ├── CSFMLGraphicsBlendMode.inc ├── CSFMLGraphicsCircleShape.inc ├── CSFMLGraphicsColor.inc ├── CSFMLGraphicsConvexShape.inc ├── CSFMLGraphicsExport.inc ├── CSFMLGraphicsFont.inc ├── CSFMLGraphicsFontInfo.inc ├── CSFMLGraphicsGlsl.inc ├── CSFMLGraphicsGlyph.inc ├── CSFMLGraphicsImage.inc ├── CSFMLGraphicsPrimitiveType.inc ├── CSFMLGraphicsRect.inc ├── CSFMLGraphicsRectangleShape.inc ├── CSFMLGraphicsRenderStates.inc ├── CSFMLGraphicsRenderTexture.inc ├── CSFMLGraphicsRenderWindow.inc ├── CSFMLGraphicsShader.inc ├── CSFMLGraphicsShape.inc ├── CSFMLGraphicsSprite.inc ├── CSFMLGraphicsText.inc ├── CSFMLGraphicsTexture.inc ├── CSFMLGraphicsTransform.inc ├── CSFMLGraphicsTransformable.inc ├── CSFMLGraphicsTypes.inc ├── CSFMLGraphicsVertex.inc ├── CSFMLGraphicsVertexArray.inc ├── CSFMLGraphicsVertexBuffer.inc ├── CSFMLGraphicsView.inc ├── CSFMLNetwork.pas ├── CSFMLNetworkExport.inc ├── CSFMLNetworkFtp.inc ├── CSFMLNetworkHttp.inc ├── CSFMLNetworkIpAddress.inc ├── CSFMLNetworkPacket.inc ├── CSFMLNetworkSocketSelector.inc ├── CSFMLNetworkSocketStatus.inc ├── CSFMLNetworkTcpListener.inc ├── CSFMLNetworkTcpSocket.inc ├── CSFMLNetworkTypes.inc ├── CSFMLNetworkUdpSocket.inc ├── CSFMLOpenGL.inc ├── CSFMLSystem.pas ├── CSFMLSystemClock.inc ├── CSFMLSystemExport.inc ├── CSFMLSystemInputStream.inc ├── CSFMLSystemMutex.inc ├── CSFMLSystemSleep.inc ├── CSFMLSystemThread.inc ├── CSFMLSystemTime.inc ├── CSFMLSystemTypes.inc ├── CSFMLSystemVector2.inc ├── CSFMLSystemVector3.inc ├── CSFMLWindow.pas ├── CSFMLWindowClipboard.inc ├── CSFMLWindowContext.inc ├── CSFMLWindowCursor.inc ├── CSFMLWindowEvent.inc ├── CSFMLWindowExport.inc ├── CSFMLWindowJoystick.inc ├── CSFMLWindowJoystickIdentification.inc ├── CSFMLWindowKeyboard.inc ├── CSFMLWindowMouse.inc ├── CSFMLWindowSensor.inc ├── CSFMLWindowTouch.inc ├── CSFMLWindowTypes.inc ├── CSFMLWindowVideoMode.inc ├── CSFMLWindowWindow.inc └── CSFMLWindowWindowHandle.inc ├── demos ├── Basic.pas ├── Caleidos.pas ├── Circle.pas ├── Circles.pas ├── Colorful.pas ├── Dark.pas ├── Fire.pas ├── Ftp.pas ├── HelloWorld.pas ├── Lights.pas ├── OpenGL.pas ├── Plasma.pas ├── Pong.pas ├── Shader.pas ├── Sky.pas ├── Sockets.pas ├── Sound.pas ├── SoundCapture.pas ├── Tunnel.pas ├── Voip.pas ├── Win.pas └── Window.pas └── resources ├── admirationpains.ttf ├── background.jpg ├── ball.wav ├── billboard.frag ├── billboard.geom ├── billboard.vert ├── blink.frag ├── blur.frag ├── canary.wav ├── devices.png ├── ding.flac ├── edge.frag ├── image1.jpg ├── image2.jpg ├── ladybug.jpg ├── logo.png ├── oncapintada.jpg ├── oncapintada.ogg ├── orchestral.ogg ├── pixelate.frag ├── sansation.ttf ├── sfml.png ├── storm.vert ├── text-background.png ├── texture.jpg └── wave.vert /README.md: -------------------------------------------------------------------------------- 1 | csfml-fpc 2 | ========= 3 | [SFML/CSFML](http://www.sfml-dev.org/) headers binding for the Free Pascal Compiler aka FPC 4 | 5 | Download 6 | -------- 7 | Binaries and demos available at http://www.djmaster.com/ 8 | -------------------------------------------------------------------------------- /binding/CSFMLAudio.pas: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Audio.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | unit CSFMLAudio; 32 | 33 | {$mode objfpc}{$H+} 34 | 35 | interface 36 | 37 | uses 38 | ctypes, 39 | CSFMLConfig, 40 | CSFMLSystem; 41 | 42 | const 43 | {$ifdef WINDOWS} 44 | LIB_CSFMLAUDIO = 'csfml-audio-2.dll'; 45 | {$endif} 46 | {$ifdef LINUX} 47 | LIB_CSFMLAUDIO = 'libcsfml-audio.so'; 48 | {$endif} 49 | 50 | // #ifndef SFML_AUDIO_H 51 | // #define SFML_AUDIO_H 52 | 53 | //////////////////////////////////////////////////////////// 54 | // Headers 55 | //////////////////////////////////////////////////////////// 56 | 57 | // #include 58 | // #include 59 | // #include 60 | // #include 61 | // #include 62 | // #include 63 | // #include 64 | // #include 65 | // #include 66 | 67 | {$include CSFMLAudioExport.inc} 68 | {$include CSFMLAudioTypes.inc} 69 | {$include CSFMLAudioSoundStatus.inc} 70 | 71 | {$include CSFMLAudioListener.inc} 72 | {$include CSFMLAudioMusic.inc} 73 | {$include CSFMLAudioSound.inc} 74 | {$include CSFMLAudioSoundBuffer.inc} 75 | {$include CSFMLAudioSoundBufferRecorder.inc} 76 | {$include CSFMLAudioSoundRecorder.inc} 77 | {$include CSFMLAudioSoundStream.inc} 78 | 79 | // #endif // SFML_AUDIO_H 80 | 81 | implementation 82 | 83 | end. 84 | 85 | -------------------------------------------------------------------------------- /binding/CSFMLAudioExport.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Audio.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_AUDIO_EXPORT_H 32 | // #define SFML_AUDIO_EXPORT_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | 39 | //////////////////////////////////////////////////////////// 40 | // Define portable import / export macros 41 | //////////////////////////////////////////////////////////// 42 | // #if defined(CSFML_AUDIO_EXPORTS) 43 | // 44 | // #define function CSFML_API_EXPORT 45 | // 46 | // #else 47 | // 48 | // #define function CSFML_API_IMPORT 49 | // 50 | // #endif 51 | 52 | // #endif // SFML_AUDIO_EXPORT_H 53 | -------------------------------------------------------------------------------- /binding/CSFMLAudioListener.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Audio.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_LISTENER_H 32 | // #define SFML_LISTENER_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | // #include 39 | 40 | (* 41 | \brief Change the global volume of all the sounds and musics 42 | 43 | The volume is a number between 0 and 100; it is combined with 44 | the individual volume of each sound / music. 45 | The default value for the volume is 100 (maximum). 46 | 47 | \param volume New global volume, in the range [0, 100] 48 | *) 49 | procedure sfListener_setGlobalVolume(volume: cfloat); cdecl; external LIB_CSFMLAUDIO; 50 | 51 | (* 52 | \brief Get the current value of the global volume 53 | 54 | \return Current global volume, in the range [0, 100] 55 | *) 56 | function sfListener_getGlobalVolume(): cfloat; cdecl; external LIB_CSFMLAUDIO; 57 | 58 | (* 59 | \brief Set the position of the listener in the scene 60 | 61 | The default listener's position is (0, 0, 0). 62 | 63 | \param position New position of the listener 64 | *) 65 | procedure sfListener_setPosition(position: sfVector3f); cdecl; external LIB_CSFMLAUDIO; 66 | 67 | (* 68 | \brief Get the current position of the listener in the scene 69 | 70 | \return The listener's position 71 | *) 72 | function sfListener_getPosition(): sfVector3f; cdecl; external LIB_CSFMLAUDIO; 73 | 74 | (* 75 | \brief Set the orientation of the forward vector in the scene 76 | 77 | The direction (also called "at vector") is the vector 78 | pointing forward from the listener's perspective. Together 79 | with the up vector, it defines the 3D orientation of the 80 | listener in the scene. The direction vector doesn't 81 | have to be normalized. 82 | The default listener's direction is (0, 0, -1). 83 | 84 | \param direction New listener's direction 85 | *) 86 | procedure sfListener_setDirection(direction: sfVector3f); cdecl; external LIB_CSFMLAUDIO; 87 | 88 | (* 89 | \brief Get the current forward vector of the listener in the scene 90 | 91 | \return Listener's forward vector (not normalized) 92 | *) 93 | function sfListener_getDirection(): sfVector3f; cdecl; external LIB_CSFMLAUDIO; 94 | 95 | (* 96 | \brief Set the upward vector of the listener in the scene 97 | 98 | The up vector is the vector that points upward from the 99 | listener's perspective. Together with the direction, it 100 | defines the 3D orientation of the listener in the scene. 101 | The up vector doesn't have to be normalized. 102 | The default listener's up vector is (0, 1, 0). It is usually 103 | not necessary to change it, especially in 2D scenarios. 104 | 105 | \param upVector New listener's up vector 106 | *) 107 | procedure sfListener_setUpVector(upVector: sfVector3f); cdecl; external LIB_CSFMLAUDIO; 108 | 109 | (* 110 | \brief Get the current upward vector of the listener in the scene 111 | 112 | \return Listener's upward vector (not normalized) 113 | *) 114 | function sfListener_getUpVector(): sfVector3f; cdecl; external LIB_CSFMLAUDIO; 115 | 116 | // #endif // SFML_LISTENER_H 117 | -------------------------------------------------------------------------------- /binding/CSFMLAudioSoundBufferRecorder.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Audio.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_SOUNDBUFFERRECORDER_H 32 | // #define SFML_SOUNDBUFFERRECORDER_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | // #include 39 | 40 | (* 41 | \brief Create a new sound buffer recorder 42 | 43 | \return A new sfSoundBufferRecorder object (NULL if failed) 44 | *) 45 | function sfSoundBufferRecorder_create(): PsfSoundBufferRecorder; cdecl; external LIB_CSFMLAUDIO; 46 | 47 | (* 48 | \brief Destroy a sound buffer recorder 49 | 50 | \param soundBufferRecorder Sound buffer recorder to destroy 51 | *) 52 | procedure sfSoundBufferRecorder_destroy(soundBufferRecorder: PsfSoundBufferRecorder); cdecl; external LIB_CSFMLAUDIO; 53 | 54 | (* 55 | \brief Start the capture of a sound recorder recorder 56 | 57 | The \a sampleRate parameter defines the number of audio samples 58 | captured per second. The higher, the better the quality 59 | (for example, 44100 samples/sec is CD quality). 60 | This function uses its own thread so that it doesn't block 61 | the rest of the program while the capture runs. 62 | Please note that only one capture can happen at the same time. 63 | 64 | \param soundBufferRecorder Sound buffer recorder object 65 | \param sampleRate Desired capture rate, in number of samples per second 66 | 67 | \return sfTrue, if it was able to start recording 68 | *) 69 | function sfSoundBufferRecorder_start(soundBufferRecorder: PsfSoundBufferRecorder; sampleRate: cuint): sfBool; cdecl; external LIB_CSFMLAUDIO; 70 | 71 | (* 72 | \brief Stop the capture of a sound recorder 73 | 74 | \param soundBufferRecorder Sound buffer recorder object 75 | *) 76 | procedure sfSoundBufferRecorder_stop(soundBufferRecorder: PsfSoundBufferRecorder); cdecl; external LIB_CSFMLAUDIO; 77 | 78 | (* 79 | \brief Get the sample rate of a sound buffer recorder 80 | 81 | The sample rate defines the number of audio samples 82 | captured per second. The higher, the better the quality 83 | (for example, 44100 samples/sec is CD quality). 84 | 85 | \param soundBufferRecorder Sound buffer recorder object 86 | 87 | \return Sample rate, in samples per second 88 | *) 89 | function sfSoundBufferRecorder_getSampleRate(const soundBufferRecorder: PsfSoundBufferRecorder): cuint; cdecl; external LIB_CSFMLAUDIO; 90 | 91 | (* 92 | \brief Get the sound buffer containing the captured audio data 93 | 94 | The sound buffer is valid only after the capture has ended. 95 | This function provides a read-only access to the internal 96 | sound buffer, but it can be copied if you need to 97 | make any modification to it. 98 | 99 | \param soundBufferRecorder Sound buffer recorder object 100 | 101 | \return Read-only access to the sound buffer 102 | *) 103 | function sfSoundBufferRecorder_getBuffer(const soundBufferRecorder: PsfSoundBufferRecorder): PsfSoundBuffer; cdecl; external LIB_CSFMLAUDIO; 104 | 105 | (* 106 | \brief Set the audio capture device 107 | 108 | This function sets the audio capture device to the device 109 | with the given name. It can be called on the fly (i.e: 110 | while recording). If you do so while recording and 111 | opening the device fails, it stops the recording. 112 | 113 | \param soundBufferRecorder Sound buffer recorder object 114 | \param name The name of the audio capture device 115 | 116 | \return sfTrue, if it was able to set the requested device 117 | *) 118 | function sfSoundBufferRecorder_setDevice(soundBufferRecorder: PsfSoundBufferRecorder; const name: pchar): sfBool; cdecl; external LIB_CSFMLAUDIO; 119 | 120 | (* 121 | \brief Get the name of the current audio capture device 122 | 123 | \param soundBufferRecorder Sound buffer recorder object 124 | 125 | \return The name of the current audio capture device 126 | *) 127 | function sfSoundBufferRecorder_getDevice(soundBufferRecorder: PsfSoundBufferRecorder): pchar; cdecl; external LIB_CSFMLAUDIO; 128 | 129 | // #endif // SFML_SOUNDBUFFERRECORDER_H 130 | -------------------------------------------------------------------------------- /binding/CSFMLAudioSoundStatus.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Audio.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_SOUNDSTATUS_H 32 | // #define SFML_SOUNDSTATUS_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | 39 | (* 40 | \brief Enumeration of statuses for sounds and musics 41 | *) 42 | type 43 | sfSoundStatus = ( 44 | sfStopped, ///< Sound / music is not playing 45 | sfPaused, ///< Sound / music is paused 46 | sfPlaying ///< Sound / music is playing 47 | ); 48 | 49 | // #endif // SFML_SOUNDSTATUS_H 50 | -------------------------------------------------------------------------------- /binding/CSFMLAudioTypes.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Audio.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_AUDIO_TYPES_H 32 | // #define SFML_AUDIO_TYPES_H 33 | 34 | type 35 | PsfMusic = ^sfMusic; 36 | sfMusic = record 37 | end; 38 | 39 | PsfSound = ^sfSound; 40 | sfSound = record 41 | end; 42 | 43 | PsfSoundBuffer = ^sfSoundBuffer; 44 | sfSoundBuffer = record 45 | end; 46 | 47 | PsfSoundBufferRecorder = ^sfSoundBufferRecorder; 48 | sfSoundBufferRecorder = record 49 | end; 50 | 51 | PsfSoundRecorder = ^sfSoundRecorder; 52 | sfSoundRecorder = record 53 | end; 54 | 55 | PsfSoundStream = ^sfSoundStream; 56 | sfSoundStream = record 57 | end; 58 | 59 | // #endif // SFML_AUDIO_TYPES_H 60 | -------------------------------------------------------------------------------- /binding/CSFMLGraphics.pas: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Graphics.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | unit CSFMLGraphics; 32 | 33 | {$mode objfpc}{$H+} 34 | 35 | interface 36 | 37 | uses 38 | ctypes, 39 | CSFMLConfig, 40 | CSFMLSystem, 41 | CSFMLWindow; 42 | 43 | const 44 | {$ifdef WINDOWS} 45 | LIB_CSFMLGRAPHICS = 'csfml-graphics-2.dll'; 46 | {$endif} 47 | {$ifdef LINUX} 48 | LIB_CSFMLGRAPHICS = 'libcsfml-graphics.so'; 49 | {$endif} 50 | 51 | // #ifndef SFML_GRAPHICS_H 52 | // #define SFML_GRAPHICS_H 53 | 54 | //////////////////////////////////////////////////////////// 55 | // Headers 56 | //////////////////////////////////////////////////////////// 57 | 58 | // #include 59 | // #include 60 | // #include 61 | // #include 62 | // #include 63 | // #include 64 | // #include 65 | // #include 66 | // #include 67 | // #include 68 | // #include 69 | // #include 70 | // #include 71 | // #include 72 | // #include 73 | // #include 74 | // #include 75 | // #include 76 | // #include 77 | // #include 78 | // #include 79 | // #include 80 | // #include 81 | // #include 82 | // #include 83 | // #include 84 | // #include 85 | 86 | {$include CSFMLGraphicsTypes.inc} 87 | {$include CSFMLGraphicsRect.inc} 88 | {$include CSFMLGraphicsTransform.inc} 89 | {$include CSFMLGraphicsColor.inc} 90 | {$include CSFMLGraphicsVertex.inc} 91 | {$include CSFMLGraphicsFontInfo.inc} 92 | {$include CSFMLGraphicsGlsl.inc} 93 | {$include CSFMLGraphicsGlyph.inc} 94 | 95 | {$include CSFMLGraphicsBlendMode.inc} 96 | {$include CSFMLGraphicsCircleShape.inc} 97 | {$include CSFMLGraphicsConvexShape.inc} 98 | {$include CSFMLGraphicsFont.inc} 99 | {$include CSFMLGraphicsImage.inc} 100 | {$include CSFMLGraphicsPrimitiveType.inc} 101 | {$include CSFMLGraphicsRectangleShape.inc} 102 | {$include CSFMLGraphicsRenderStates.inc} 103 | {$include CSFMLGraphicsRenderTexture.inc} 104 | {$include CSFMLGraphicsRenderWindow.inc} 105 | {$include CSFMLGraphicsShader.inc} 106 | {$include CSFMLGraphicsShape.inc} 107 | {$include CSFMLGraphicsSprite.inc} 108 | {$include CSFMLGraphicsText.inc} 109 | {$include CSFMLGraphicsTexture.inc} 110 | {$include CSFMLGraphicsTransformable.inc} 111 | {$include CSFMLGraphicsVertexArray.inc} 112 | {$include CSFMLGraphicsVertexBuffer.inc} 113 | {$include CSFMLGraphicsView.inc} 114 | 115 | // #endif // SFML_GRAPHICS_H 116 | 117 | implementation 118 | 119 | end. 120 | 121 | -------------------------------------------------------------------------------- /binding/CSFMLGraphicsBlendMode.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Graphics.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_BLENDMODE_H 32 | // #define SFML_BLENDMODE_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | 39 | (* 40 | \brief Enumeration of the blending factors 41 | *) 42 | type 43 | sfBlendFactor = ( 44 | sfBlendFactorZero, ///< (0, 0, 0, 0) 45 | sfBlendFactorOne, ///< (1, 1, 1, 1) 46 | sfBlendFactorSrcColor, ///< (src.r, src.g, src.b, src.a) 47 | sfBlendFactorOneMinusSrcColor, ///< (1, 1, 1, 1) - (src.r, src.g, src.b, src.a) 48 | sfBlendFactorDstColor, ///< (dst.r, dst.g, dst.b, dst.a) 49 | sfBlendFactorOneMinusDstColor, ///< (1, 1, 1, 1) - (dst.r, dst.g, dst.b, dst.a) 50 | sfBlendFactorSrcAlpha, ///< (src.a, src.a, src.a, src.a) 51 | sfBlendFactorOneMinusSrcAlpha, ///< (1, 1, 1, 1) - (src.a, src.a, src.a, src.a) 52 | sfBlendFactorDstAlpha, ///< (dst.a, dst.a, dst.a, dst.a) 53 | sfBlendFactorOneMinusDstAlpha ///< (1, 1, 1, 1) - (dst.a, dst.a, dst.a, dst.a) 54 | ); 55 | 56 | (* 57 | \brief Enumeration of the blending equations 58 | *) 59 | type 60 | sfBlendEquation = ( 61 | sfBlendEquationAdd, ///< Pixel = Src * SrcFactor + Dst * DstFactor 62 | sfBlendEquationSubtract, ///< Pixel = Src * SrcFactor - Dst * DstFactor 63 | sfBlendEquationReverseSubtract ///< Pixel = Dst * DstFactor - Src * SrcFactor 64 | ); 65 | 66 | (* 67 | \brief Blending mode for drawing 68 | *) 69 | type 70 | sfBlendMode = record 71 | colorSrcFactor: sfBlendFactor; ///< Source blending factor for the color channels 72 | colorDstFactor: sfBlendFactor; ///< Destination blending factor for the color channels 73 | colorEquation: sfBlendEquation; ///< Blending equation for the color channels 74 | alphaSrcFactor: sfBlendFactor; ///< Source blending factor for the alpha channel 75 | alphaDstFactor: sfBlendFactor; ///< Destination blending factor for the alpha channel 76 | alphaEquation: sfBlendEquation; ///< Blending equation for the alpha channel 77 | end; 78 | 79 | var 80 | sfBlendAlpha: sfBlendMode; external LIB_CSFMLGRAPHICS; ///< Blend source and dest according to dest alpha 81 | sfBlendAdd: sfBlendMode; external LIB_CSFMLGRAPHICS; ///< Add source to dest 82 | sfBlendMultiply: sfBlendMode; external LIB_CSFMLGRAPHICS; ///< Multiply source and dest 83 | sfBlendNone: sfBlendMode; external LIB_CSFMLGRAPHICS; ///< Overwrite dest with source 84 | 85 | // #endif // SFML_BLENDMODE_H 86 | -------------------------------------------------------------------------------- /binding/CSFMLGraphicsColor.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Graphics.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_COLOR_H 32 | // #define SFML_COLOR_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | 39 | (* 40 | \brief Utility class for manpulating RGBA colors 41 | *) 42 | type 43 | sfColor = record 44 | r: sfUint8; 45 | g: sfUint8; 46 | b: sfUint8; 47 | a: sfUint8; 48 | end; 49 | 50 | var 51 | sfBlack: sfColor; external LIB_CSFMLGRAPHICS; ///< Black predefined color 52 | sfWhite: sfColor; external LIB_CSFMLGRAPHICS; ///< White predefined color 53 | sfRed: sfColor; external LIB_CSFMLGRAPHICS; ///< Red predefined color 54 | sfGreen: sfColor; external LIB_CSFMLGRAPHICS; ///< Green predefined color 55 | sfBlue: sfColor; external LIB_CSFMLGRAPHICS; ///< Blue predefined color 56 | sfYellow: sfColor; external LIB_CSFMLGRAPHICS; ///< Yellow predefined color 57 | sfMagenta: sfColor; external LIB_CSFMLGRAPHICS; ///< Magenta predefined color 58 | sfCyan: sfColor; external LIB_CSFMLGRAPHICS; ///< Cyan predefined color 59 | sfTransparent: sfColor; external LIB_CSFMLGRAPHICS; ///< Transparent (black) predefined color 60 | 61 | (* 62 | \brief Construct a color from its 3 RGB components 63 | 64 | \param red Red component (0 .. 255) 65 | \param green Green component (0 .. 255) 66 | \param blue Blue component (0 .. 255) 67 | 68 | \return sfColor constructed from the components 69 | *) 70 | function sfColor_fromRGB(red: sfUint8; green: sfUint8; blue: sfUint8): sfColor; cdecl; external LIB_CSFMLGRAPHICS; 71 | 72 | (* 73 | \brief Construct a color from its 4 RGBA components 74 | 75 | \param red Red component (0 .. 255) 76 | \param green Green component (0 .. 255) 77 | \param blue Blue component (0 .. 255) 78 | \param alpha Alpha component (0 .. 255) 79 | 80 | \return sfColor constructed from the components 81 | *) 82 | function sfColor_fromRGBA(red: sfUint8; green: sfUint8; blue: sfUint8; alpha: sfUint8): sfColor; cdecl; external LIB_CSFMLGRAPHICS; 83 | 84 | (* 85 | \brief Construct the color from 32-bit unsigned integer 86 | 87 | \param color Number containing the RGBA components (in that order) 88 | 89 | \return sfColor constructed from the 32-bit unsigned integer 90 | *) 91 | function sfColor_fromInteger(color: sfUint32): sfColor; cdecl; external LIB_CSFMLGRAPHICS; 92 | 93 | (* 94 | \brief Convert a color to a 32-bit unsigned integer 95 | 96 | \return Color represented as a 32-bit unsigned integer 97 | *) 98 | function sfColor_toInteger(color: sfColor): sfUint32; cdecl; external LIB_CSFMLGRAPHICS; 99 | 100 | (* 101 | \brief Add two colors 102 | 103 | \param color1 First color 104 | \param color2 Second color 105 | 106 | \return Component-wise saturated addition of the two colors 107 | *) 108 | function sfColor_add(color1: sfColor; color2: sfColor): sfColor; cdecl; external LIB_CSFMLGRAPHICS; 109 | 110 | (* 111 | \brief Subtract two colors 112 | 113 | \param color1 First color 114 | \param color2 Second color 115 | 116 | \return Component-wise saturated subtraction of the two colors 117 | *) 118 | function sfColor_subtract(color1: sfColor; color2: sfColor): sfColor; cdecl; external LIB_CSFMLGRAPHICS; 119 | 120 | (* 121 | \brief Modulate two colors 122 | 123 | \param color1 First color 124 | \param color2 Second color 125 | 126 | \return Component-wise multiplication of the two colors 127 | *) 128 | function sfColor_modulate(color1: sfColor; color2: sfColor): sfColor; cdecl; external LIB_CSFMLGRAPHICS; 129 | 130 | // #endif // SFML_COLOR_H 131 | -------------------------------------------------------------------------------- /binding/CSFMLGraphicsExport.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Graphics.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_GRAPHICS_EXPORT_H 32 | // #define SFML_GRAPHICS_EXPORT_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | 39 | //////////////////////////////////////////////////////////// 40 | // Define portable import / export macros 41 | //////////////////////////////////////////////////////////// 42 | // #if defined(CSFML_GRAPHICS_EXPORTS) 43 | // 44 | // #define function CSFML_API_EXPORT 45 | // 46 | // #else 47 | // 48 | // #define function CSFML_API_IMPORT 49 | // 50 | // #endif 51 | 52 | // #endif // SFML_GRAPHICS_EXPORT_H 53 | -------------------------------------------------------------------------------- /binding/CSFMLGraphicsFontInfo.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Graphics.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_FONTINFO_H 32 | // #define SFML_FONTINFO_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | 39 | (* 40 | sfFontInfo holds various information about a font 41 | *) 42 | type 43 | sfFontInfo = record 44 | family: pchar; 45 | end; 46 | 47 | // #endif // SFML_FONTINFO_H 48 | -------------------------------------------------------------------------------- /binding/CSFMLGraphicsGlsl.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Graphics.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_GLSL_H 32 | // #define SFML_GLSL_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | // #include 39 | // #include 40 | // #include 41 | 42 | type 43 | // 2D vectors 44 | PsfGlslVec2 = ^sfGlslVec2; 45 | sfGlslVec2 = sfVector2f; 46 | 47 | PsfGlslIvec2 = ^sfGlslIvec2; 48 | sfGlslIvec2 = sfVector2i; 49 | 50 | PsfGlslBvec2 = ^sfGlslBvec2; 51 | sfGlslBvec2 = record 52 | x: sfBool; 53 | y: sfBool; 54 | end; 55 | 56 | // 3D vectors 57 | PsfGlslVec3 = ^sfGlslVec3; 58 | sfGlslVec3 = sfVector3f; 59 | 60 | PsfGlslIvec3 = ^sfGlslIvec3; 61 | sfGlslIvec3 = record 62 | x: cint; 63 | y: cint; 64 | z: cint; 65 | end; 66 | 67 | PsfGlslBvec3 = ^sfGlslBvec3; 68 | sfGlslBvec3 = record 69 | x: sfBool; 70 | y: sfBool; 71 | z: sfBool; 72 | end; 73 | 74 | // 4D vectors 75 | PsfGlslVec4 = ^sfGlslVec4; 76 | sfGlslVec4 = record 77 | x: cfloat; 78 | y: cfloat; 79 | z: cfloat; 80 | w: cfloat; 81 | end; 82 | 83 | PsfGlslIvec4 = ^sfGlslIvec4; 84 | sfGlslIvec4 = record 85 | x: cint; 86 | y: cint; 87 | z: cint; 88 | w: cint; 89 | end; 90 | 91 | PsfGlslBvec4 = ^sfGlslBvec4; 92 | sfGlslBvec4 = record 93 | x: sfBool; 94 | y: sfBool; 95 | z: sfBool; 96 | w: sfBool; 97 | end; 98 | 99 | // matrices 100 | PsfGlslMat3 = ^sfGlslMat3; 101 | sfGlslMat3 = record 102 | elements: array[0..3*3-1] of cfloat; 103 | end; 104 | 105 | PsfGlslMat4 = ^sfGlslMat4; 106 | sfGlslMat4 = record 107 | elements: array[0..4*4-1] of cfloat; 108 | end; 109 | 110 | // #endif // SFML_GLSL_H 111 | -------------------------------------------------------------------------------- /binding/CSFMLGraphicsGlyph.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Graphics.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_GLYPH_H 32 | // #define SFML_GLYPH_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | 39 | (* 40 | \brief sfGlyph describes a glyph (a visual character) 41 | *) 42 | type 43 | sfGlyph = record 44 | advance: cfloat; ///< Offset to move horizontically to the next character 45 | bounds: sfFloatRect; ///< Bounding rectangle of the glyph, in coordinates relative to the baseline 46 | textureRect: sfIntRect; ///< Texture coordinates of the glyph inside the font's image 47 | end; 48 | 49 | // #endif // SFML_GLYPH_H 50 | -------------------------------------------------------------------------------- /binding/CSFMLGraphicsPrimitiveType.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Graphics.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_PRIMITIVETYPE_H 32 | // #define SFML_PRIMITIVETYPE_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | 39 | (* 40 | \brief Types of primitives that a sf::VertexArray can render 41 | 42 | Points and lines have no area, therefore their thickness 43 | will always be 1 pixel, regardless the current transform 44 | and view. 45 | *) 46 | type 47 | sfPrimitiveType = ( 48 | sfPoints, ///< List of individual points 49 | sfLines, ///< List of individual lines 50 | sfLineStrip, ///< List of connected lines, a point uses the previous point to form a line 51 | sfTriangles, ///< List of individual triangles 52 | sfTriangleStrip, ///< List of connected triangles, a point uses the two previous points to form a triangle 53 | sfTriangleFan, ///< List of connected triangles, a point uses the common center and the previous point to form a triangle 54 | sfQuads ///< List of individual quads 55 | ); 56 | 57 | // #endif // SFML_BLENDMODE_H 58 | -------------------------------------------------------------------------------- /binding/CSFMLGraphicsRect.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Graphics.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_RECT_H 32 | // #define SFML_RECT_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | 39 | (* 40 | sfFloatRect and sfIntRect are utility classes for 41 | manipulating rectangles. 42 | *) 43 | type 44 | PsfFloatRect = ^sfFloatRect; 45 | sfFloatRect = record 46 | left: cfloat; 47 | top: cfloat; 48 | width: cfloat; 49 | height: cfloat; 50 | end; 51 | 52 | PsfIntRect = ^sfIntRect; 53 | sfIntRect = record 54 | left: cint; 55 | top: cint; 56 | width: cint; 57 | height: cint; 58 | end; 59 | 60 | (* 61 | \brief Check if a point is inside a rectangle's area 62 | 63 | \param rect Rectangle to test 64 | \param x X coordinate of the point to test 65 | \param y Y coordinate of the point to test 66 | 67 | \return sfTrue if the point is inside 68 | *) 69 | function sfFloatRect_contains(const rect: PsfFloatRect; x: cfloat; y: cfloat): sfBool; cdecl; external LIB_CSFMLGRAPHICS; 70 | function sfIntRect_contains(const rect: PsfIntRect; x: cint; y: cint): sfBool; cdecl; external LIB_CSFMLGRAPHICS; 71 | 72 | (* 73 | \brief Check intersection between two rectangles 74 | 75 | \param rect1 First rectangle to test 76 | \param rect2 Second rectangle to test 77 | \param intersection Rectangle to be filled with overlapping rect (can be NULL) 78 | 79 | \return sfTrue if rectangles overlap 80 | *) 81 | function sfFloatRect_intersects(const rect1: PsfFloatRect; const rect2: PsfFloatRect; intersection: PsfFloatRect): sfBool; cdecl; external LIB_CSFMLGRAPHICS; 82 | function sfIntRect_intersects(const rect1: PsfIntRect; const rect2: PsfIntRect; intersection: PsfIntRect): sfBool; cdecl; external LIB_CSFMLGRAPHICS; 83 | 84 | // #endif // SFML_RECT_H 85 | -------------------------------------------------------------------------------- /binding/CSFMLGraphicsRenderStates.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Graphics.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_RENDERSTATES_H 32 | // #define SFML_RENDERSTATES_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | // #include 39 | // #include 40 | // #include 41 | 42 | (* 43 | \brief Define the states used for drawing to a RenderTarget 44 | *) 45 | type 46 | PsfRenderStates = ^sfRenderStates; 47 | sfRenderStates = record 48 | blendMode: sfBlendMode; ///< Blending mode 49 | transform: sfTransform; ///< Transform 50 | texture: PsfTexture; ///< Texture 51 | shader: PsfShader; ///< Shader 52 | end; 53 | 54 | // #endif // SFML_RENDERSTATES_H 55 | -------------------------------------------------------------------------------- /binding/CSFMLGraphicsTypes.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Graphics.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_GRAPHICS_TYPES_H 32 | // #define SFML_GRAPHICS_TYPES_H 33 | 34 | type 35 | PsfCircleShape = ^sfCircleShape; 36 | sfCircleShape = record 37 | end; 38 | 39 | PsfConvexShape = ^sfConvexShape; 40 | sfConvexShape = record 41 | end; 42 | 43 | PsfFont = ^sfFont; 44 | sfFont = record 45 | end; 46 | 47 | PsfImage = ^sfImage; 48 | sfImage = record 49 | end; 50 | 51 | PsfShader = ^sfShader; 52 | sfShader = record 53 | end; 54 | 55 | PsfRectangleShape = ^sfRectangleShape; 56 | sfRectangleShape = record 57 | end; 58 | 59 | PsfRenderTexture = ^sfRenderTexture; 60 | sfRenderTexture = record 61 | end; 62 | 63 | PsfRenderWindow = ^sfRenderWindow; 64 | sfRenderWindow = record 65 | end; 66 | 67 | PsfShape = ^sfShape; 68 | sfShape = record 69 | end; 70 | 71 | PsfSprite = ^sfSprite; 72 | sfSprite = record 73 | end; 74 | 75 | PsfText = ^sfText; 76 | sfText = record 77 | end; 78 | 79 | PsfTexture = ^sfTexture; 80 | sfTexture = record 81 | end; 82 | 83 | PsfTransformable = ^sfTransformable; 84 | sfTransformable = record 85 | end; 86 | 87 | PsfVertexArray = ^sfVertexArray; 88 | sfVertexArray = record 89 | end; 90 | 91 | PsfVertexBuffer = ^sfVertexBuffer; 92 | sfVertexBuffer = record 93 | end; 94 | 95 | PsfView = ^sfView; 96 | sfView = record 97 | end; 98 | 99 | // #endif // SFML_GRAPHICS_TYPES_H 100 | -------------------------------------------------------------------------------- /binding/CSFMLGraphicsVertex.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Graphics.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_VERTEX_H 32 | // #define SFML_VERTEX_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | // #include 39 | // #include 40 | 41 | (* 42 | Define a point with color and texture coordinates 43 | *) 44 | type 45 | PsfVertex = ^sfVertex; 46 | sfVertex = record 47 | position: sfVector2f; ///< Position of the vertex 48 | color: sfColor; ///< Color of the vertex 49 | texCoords: sfVector2f; ///< Coordinates of the texture's pixel to map to the vertex 50 | end; 51 | 52 | // #endif // SFML_VERTEX_H 53 | -------------------------------------------------------------------------------- /binding/CSFMLGraphicsVertexArray.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Graphics.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_VERTEXARRAY_H 32 | // #define SFML_VERTEXARRAY_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | // #include 39 | // #include 40 | // #include 41 | // #include 42 | // #include 43 | 44 | (* 45 | \brief Create a new vertex array 46 | 47 | \return A new sfVertexArray object 48 | *) 49 | function sfVertexArray_create(): PsfVertexArray; cdecl; external LIB_CSFMLGRAPHICS; 50 | 51 | (* 52 | \brief Copy an existing vertex array 53 | 54 | \param vertexArray Vertex array to copy 55 | 56 | \return Copied object 57 | *) 58 | function sfVertexArray_copy(const vertexArray: PsfVertexArray): PsfVertexArray; cdecl; external LIB_CSFMLGRAPHICS; 59 | 60 | (* 61 | \brief Destroy an existing vertex array 62 | 63 | \param vertexArray Vertex array to delete 64 | *) 65 | procedure sfVertexArray_destroy(vertexArray: PsfVertexArray); cdecl; external LIB_CSFMLGRAPHICS; 66 | 67 | (* 68 | \brief Return the vertex count of a vertex array 69 | 70 | \param vertexArray Vertex array object 71 | 72 | \return Number of vertices in the array 73 | *) 74 | function sfVertexArray_getVertexCount(const vertexArray: PsfVertexArray): csize_t; cdecl; external LIB_CSFMLGRAPHICS; 75 | 76 | (* 77 | \brief Get access to a vertex by its index 78 | 79 | This function doesn't check \a index, it must be in range 80 | [0, vertex count - 1]. The behaviour is undefined 81 | otherwise. 82 | 83 | \param vertexArray Vertex array object 84 | \param index Index of the vertex to get 85 | 86 | \return Pointer to the index-th vertex 87 | *) 88 | function sfVertexArray_getVertex(vertexArray: PsfVertexArray; index: csize_t): PsfVertex; cdecl; external LIB_CSFMLGRAPHICS; 89 | 90 | (* 91 | \brief Clear a vertex array 92 | 93 | This function removes all the vertices from the array. 94 | It doesn't deallocate the corresponding memory, so that 95 | adding new vertices after clearing doesn't involve 96 | reallocating all the memory. 97 | 98 | \param vertexArray Vertex array object 99 | *) 100 | procedure sfVertexArray_clear(vertexArray: PsfVertexArray); cdecl; external LIB_CSFMLGRAPHICS; 101 | 102 | (* 103 | \brief Resize the vertex array 104 | 105 | If \a vertexCount is greater than the current size, the previous 106 | vertices are kept and new (default-constructed) vertices are 107 | added. 108 | If \a vertexCount is less than the current size, existing vertices 109 | are removed from the array. 110 | 111 | \param vertexArray Vertex array objet 112 | \param vertexCount New size of the array (number of vertices) 113 | *) 114 | procedure sfVertexArray_resize(vertexArray: PsfVertexArray; vertexCount: csize_t); cdecl; external LIB_CSFMLGRAPHICS; 115 | 116 | (* 117 | \brief Add a vertex to a vertex array array 118 | 119 | \param vertexArray Vertex array objet 120 | \param vertex Vertex to add 121 | *) 122 | procedure sfVertexArray_append(vertexArray: PsfVertexArray; vertex: sfVertex); cdecl; external LIB_CSFMLGRAPHICS; 123 | 124 | (* 125 | \brief Set the type of primitives of a vertex array 126 | 127 | This function defines how the vertices must be interpreted 128 | when it's time to draw them: 129 | \li As points 130 | \li As lines 131 | \li As triangles 132 | \li As quads 133 | The default primitive type is sfPoints. 134 | 135 | \param vertexArray Vertex array objet 136 | \param type Type of primitive 137 | *) 138 | procedure sfVertexArray_setPrimitiveType(vertexArray: PsfVertexArray; type_: sfPrimitiveType); cdecl; external LIB_CSFMLGRAPHICS; 139 | 140 | (* 141 | \brief Get the type of primitives drawn by a vertex array 142 | 143 | \param vertexArray Vertex array objet 144 | 145 | \return Primitive type 146 | *) 147 | function sfVertexArray_getPrimitiveType(vertexArray: PsfVertexArray): sfPrimitiveType; cdecl; external LIB_CSFMLGRAPHICS; 148 | 149 | (* 150 | \brief Compute the bounding rectangle of a vertex array 151 | 152 | This function returns the axis-aligned rectangle that 153 | contains all the vertices of the array. 154 | 155 | \param vertexArray Vertex array objet 156 | 157 | \return Bounding rectangle of the vertex array 158 | *) 159 | function sfVertexArray_getBounds(vertexArray: PsfVertexArray): sfFloatRect; cdecl; external LIB_CSFMLGRAPHICS; 160 | 161 | // #endif // SFML_VERTEXARRAY_H 162 | -------------------------------------------------------------------------------- /binding/CSFMLNetwork.pas: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Network.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | unit CSFMLNetwork; 32 | 33 | {$mode objfpc}{$H+} 34 | 35 | interface 36 | 37 | uses 38 | ctypes, 39 | CSFMLConfig, 40 | CSFMLSystem; 41 | 42 | const 43 | {$ifdef WINDOWS} 44 | LIB_CSFMLNETWORK = 'csfml-network-2.dll'; 45 | {$endif} 46 | {$ifdef LINUX} 47 | LIB_CSFMLNETWORK = 'libcsfml-network.so'; 48 | {$endif} 49 | 50 | // #ifndef SFML_NETWORK_H 51 | // #define SFML_NETWORK_H 52 | 53 | //////////////////////////////////////////////////////////// 54 | // Headers 55 | //////////////////////////////////////////////////////////// 56 | 57 | // #include 58 | // #include 59 | // #include 60 | // #include 61 | // #include 62 | // #include 63 | // #include 64 | // #include 65 | // #include 66 | // #include 67 | 68 | {$include CSFMLNetworkTypes.inc} 69 | {$include CSFMLNetworkIpAddress.inc} 70 | 71 | {$include CSFMLNetworkFtp.inc} 72 | {$include CSFMLNetworkHttp.inc} 73 | {$include CSFMLNetworkPacket.inc} 74 | {$include CSFMLNetworkSocketSelector.inc} 75 | {$include CSFMLNetworkSocketStatus.inc} 76 | {$include CSFMLNetworkTcpListener.inc} 77 | {$include CSFMLNetworkTcpSocket.inc} 78 | {$include CSFMLNetworkUdpSocket.inc} 79 | 80 | // #endif // SFML_NETWORK_H 81 | 82 | implementation 83 | 84 | end. 85 | 86 | -------------------------------------------------------------------------------- /binding/CSFMLNetworkExport.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Network.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_NETWORK_EXPORT_H 32 | // #define SFML_NETWORK_EXPORT_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | 39 | //////////////////////////////////////////////////////////// 40 | // Define portable import / export macros 41 | //////////////////////////////////////////////////////////// 42 | // #if defined(CSFML_NETWORK_EXPORTS) 43 | // 44 | // #define function CSFML_API_EXPORT 45 | // 46 | // #else 47 | // 48 | // #define function CSFML_API_IMPORT 49 | // 50 | // #endif 51 | 52 | // #endif // SFML_NETWORK_EXPORT_H 53 | -------------------------------------------------------------------------------- /binding/CSFMLNetworkSocketStatus.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Network.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_SOCKETSTATUS_H 32 | // #define SFML_SOCKETSTATUS_H 33 | 34 | (* 35 | \brief Define the status that can be returned by the socket functions 36 | *) 37 | type 38 | sfSocketStatus = ( 39 | sfSocketDone, ///< The socket has sent / received the data 40 | sfSocketNotReady, ///< The socket is not ready to send / receive data yet 41 | sfSocketPartial, ///< The socket sent a part of the data 42 | sfSocketDisconnected, ///< The TCP socket has been disconnected 43 | sfSocketError ///< An unexpected error happened 44 | 45 | ); 46 | 47 | // #endif // SFML_SOCKETSTATUS_H 48 | -------------------------------------------------------------------------------- /binding/CSFMLNetworkTcpListener.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Network.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_TCPLISTENER_H 32 | // #define SFML_TCPLISTENER_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | // #include 39 | // #include 40 | // #include 41 | 42 | (* 43 | \brief Create a new TCP listener 44 | 45 | \return A new sfTcpListener object 46 | *) 47 | function sfTcpListener_create(): PsfTcpListener; cdecl; external LIB_CSFMLNETWORK; 48 | 49 | (* 50 | \brief Destroy a TCP listener 51 | 52 | \param listener TCP listener to destroy 53 | *) 54 | procedure sfTcpListener_destroy(listener: PsfTcpListener); cdecl; external LIB_CSFMLNETWORK; 55 | 56 | (* 57 | \brief Set the blocking state of a TCP listener 58 | 59 | In blocking mode, calls will not return until they have 60 | completed their task. For example, a call to 61 | sfTcpListener_accept in blocking mode won't return until 62 | a new connection was actually received. 63 | In non-blocking mode, calls will always return immediately, 64 | using the return code to signal whether there was data 65 | available or not. 66 | By default, all sockets are blocking. 67 | 68 | \param listener TCP listener object 69 | \param blocking sfTrue to set the socket as blocking, sfFalse for non-blocking 70 | *) 71 | procedure sfTcpListener_setBlocking(listener: PsfTcpListener; blocking: sfBool); cdecl; external LIB_CSFMLNETWORK; 72 | 73 | (* 74 | \brief Tell whether a TCP listener is in blocking or non-blocking mode 75 | 76 | \param listener TCP listener object 77 | 78 | \return sfTrue if the socket is blocking, sfFalse otherwise 79 | *) 80 | function sfTcpListener_isBlocking(const listener: PsfTcpListener): sfBool; cdecl; external LIB_CSFMLNETWORK; 81 | 82 | (* 83 | \brief Get the port to which a TCP listener is bound locally 84 | 85 | If the socket is not listening to a port, this function 86 | returns 0. 87 | 88 | \param listener TCP listener object 89 | 90 | \return Port to which the TCP listener is bound 91 | *) 92 | function sfTcpListener_getLocalPort(const listener: PsfTcpListener): cushort; cdecl; external LIB_CSFMLNETWORK; 93 | 94 | (* 95 | \brief Start listening for connections 96 | 97 | This functions makes the socket listen to the specified 98 | port, waiting for new connections. 99 | If the socket was previously listening to another port, 100 | it will be stopped first and bound to the new port. 101 | 102 | If there is no specific address to listen to, pass sfIpAddress_Any 103 | 104 | \param listener TCP listener object 105 | \param port Port to listen for new connections 106 | \param address Address of the interface to listen on 107 | 108 | \return Status code 109 | *) 110 | function sfTcpListener_listen(listener: PsfTcpListener; port: cushort; address: sfIpAddress): sfSocketStatus; cdecl; external LIB_CSFMLNETWORK; 111 | 112 | (* 113 | \brief Accept a new connection 114 | 115 | If the socket is in blocking mode, this function will 116 | not return until a connection is actually received. 117 | 118 | The \a connected argument points to a valid sfTcpSocket pointer 119 | in case of success (the function returns sfSocketDone), it points 120 | to a NULL pointer otherwise. 121 | 122 | \param listener TCP listener object 123 | \param connected Socket that will hold the new connection 124 | 125 | \return Status code 126 | *) 127 | function sfTcpListener_accept(listener: PsfTcpListener; connected: PPsfTcpSocket): sfSocketStatus; cdecl; external LIB_CSFMLNETWORK; 128 | 129 | // #endif // SFML_TCPLISTENER_H 130 | -------------------------------------------------------------------------------- /binding/CSFMLNetworkTypes.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Network.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_NETWORK_TYPES_H 32 | // #define SFML_NETWORK_TYPES_H 33 | 34 | type 35 | PsfFtpDirectoryResponse = ^sfFtpDirectoryResponse; 36 | sfFtpDirectoryResponse = record 37 | end; 38 | 39 | PsfFtpListingResponse = ^sfFtpListingResponse; 40 | sfFtpListingResponse = record 41 | end; 42 | 43 | PsfFtpResponse = ^sfFtpResponse; 44 | sfFtpResponse = record 45 | end; 46 | 47 | PsfFtp = ^sfFtp; 48 | sfFtp = record 49 | end; 50 | 51 | PsfHttpRequest = ^sfHttpRequest; 52 | sfHttpRequest = record 53 | end; 54 | 55 | PsfHttpResponse = ^sfHttpResponse; 56 | sfHttpResponse = record 57 | end; 58 | 59 | PsfHttp = ^sfHttp; 60 | sfHttp = record 61 | end; 62 | 63 | PsfPacket = ^sfPacket; 64 | sfPacket = record 65 | end; 66 | 67 | PsfSocketSelector = ^sfSocketSelector; 68 | sfSocketSelector = record 69 | end; 70 | 71 | PsfTcpListener = ^sfTcpListener; 72 | sfTcpListener = record 73 | end; 74 | 75 | PPsfTcpSocket = ^PsfTcpSocket; 76 | PsfTcpSocket = ^sfTcpSocket; 77 | sfTcpSocket = record 78 | end; 79 | 80 | PsfUdpSocket = ^sfUdpSocket; 81 | sfUdpSocket = record 82 | end; 83 | 84 | // #endif // SFML_NETWORK_TYPES_H 85 | -------------------------------------------------------------------------------- /binding/CSFMLOpenGL.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML OpenGL.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_OPENGL_H 32 | // #define SFML_OPENGL_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | 39 | //////////////////////////////////////////////////////////// 40 | // This file just includes the OpenGL (GL and GLU) headers, 41 | // which have actually different paths on each system 42 | //////////////////////////////////////////////////////////// 43 | // #if defined(CSFML_SYSTEM_WINDOWS) 44 | // 45 | // {$include 56 | // #include 57 | // #include 58 | // #include 59 | // #include 60 | // #include 61 | // #include 62 | // #include 63 | // #include 64 | 65 | {$include CSFMLSystemExport.inc} 66 | {$include CSFMLSystemTypes.inc} 67 | {$include CSFMLSystemTime.inc} 68 | 69 | {$include CSFMLSystemClock.inc} 70 | {$include CSFMLSystemInputStream.inc} 71 | {$include CSFMLSystemMutex.inc} 72 | {$include CSFMLSystemSleep.inc} 73 | {$include CSFMLSystemThread.inc} 74 | {$include CSFMLSystemVector2.inc} 75 | {$include CSFMLSystemVector3.inc} 76 | 77 | // #endif // SFML_SYSTEM_H 78 | 79 | implementation 80 | 81 | end. 82 | 83 | -------------------------------------------------------------------------------- /binding/CSFMLSystemClock.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML System.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_CLOCK_H 32 | // #define SFML_CLOCK_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | // #include 39 | // #include 40 | 41 | (* 42 | \brief Create a new clock and start it 43 | 44 | \return A new sfClock object 45 | *) 46 | function sfClock_create(): PsfClock; cdecl; external LIB_CSFMLSYSTEM; 47 | 48 | (* 49 | \brief Create a new clock by copying an existing one 50 | 51 | \param clock Clock to copy 52 | 53 | \return A new sfClock object which is a copy of \a clock 54 | *) 55 | function sfClock_copy(const clock: PsfClock): PsfClock; cdecl; external LIB_CSFMLSYSTEM; 56 | 57 | (* 58 | \brief Destroy a clock 59 | 60 | \param clock Clock to destroy 61 | *) 62 | procedure sfClock_destroy(clock: PsfClock); cdecl; external LIB_CSFMLSYSTEM; 63 | 64 | (* 65 | \brief Get the time elapsed in a clock 66 | 67 | This function returns the time elapsed since the last call 68 | to sfClock_restart (or the construction of the object if 69 | sfClock_restart has not been called). 70 | 71 | \param clock Clock object 72 | 73 | \return Time elapsed 74 | *) 75 | function sfClock_getElapsedTime(const clock: PsfClock): sfTime; cdecl; external LIB_CSFMLSYSTEM; 76 | 77 | (* 78 | \brief Restart a clock 79 | 80 | This function puts the time counter back to zero. 81 | It also returns the time elapsed since the clock was started. 82 | 83 | \param clock Clock object 84 | 85 | \return Time elapsed 86 | *) 87 | function sfClock_restart(clock: PsfClock): sfTime; cdecl; external LIB_CSFMLSYSTEM; 88 | 89 | // #endif // SFML_CLOCK_H 90 | -------------------------------------------------------------------------------- /binding/CSFMLSystemExport.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML System.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_SYSTEM_EXPORT_H 32 | // #define SFML_SYSTEM_EXPORT_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | 39 | //////////////////////////////////////////////////////////// 40 | // Define portable import / export macros 41 | //////////////////////////////////////////////////////////// 42 | // #if defined(CSFML_SYSTEM_EXPORTS) 43 | // 44 | // #define function CSFML_API_EXPORT 45 | // 46 | // #else 47 | // 48 | // #define function CSFML_API_IMPORT 49 | // 50 | // #endif 51 | 52 | // #endif // SFML_SYSTEM_EXPORT_H 53 | -------------------------------------------------------------------------------- /binding/CSFMLSystemInputStream.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML System.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_INPUTSTREAM_H 32 | // #define SFML_INPUTSTREAM_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | 39 | type 40 | sfInputStreamReadFunc = function (data: pointer; size: sfInt64; userData: pointer): sfInt64; cdecl; 41 | sfInputStreamSeekFunc = function (position: sfInt64; userData: pointer): sfInt64; cdecl; 42 | sfInputStreamTellFunc = function (userData: pointer): sfInt64; cdecl; 43 | sfInputStreamGetSizeFunc = function (userData: pointer): sfInt64; cdecl; 44 | 45 | (* 46 | \brief Set of callbacks that allow users to define custom file streams 47 | *) 48 | type 49 | PsfInputStream = ^sfInputStream; 50 | sfInputStream = record 51 | read: sfInputStreamReadFunc; ///< Function to read data from the stream 52 | seek: sfInputStreamSeekFunc; ///< Function to set the current read position 53 | tell: sfInputStreamTellFunc; ///< Function to get the current read position 54 | getSize: sfInputStreamGetSizeFunc; ///< Function to get the total number of bytes in the stream 55 | userData: pointer; ///< User data that will be passed to the callbacks 56 | end; 57 | 58 | // #endif // SFML_INPUTSTREAM_H 59 | -------------------------------------------------------------------------------- /binding/CSFMLSystemMutex.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML System.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_MUTEX_H 32 | // #define SFML_MUTEX_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | // #include 39 | 40 | (* 41 | \brief Create a new mutex 42 | 43 | \return A new sfMutex object 44 | *) 45 | function sfMutex_create(): PsfMutex; cdecl; external LIB_CSFMLSYSTEM; 46 | 47 | (* 48 | \brief Destroy a mutex 49 | 50 | \param mutex Mutex to destroy 51 | *) 52 | procedure sfMutex_destroy(mutex: PsfMutex); cdecl; external LIB_CSFMLSYSTEM; 53 | 54 | (* 55 | \brief Lock a mutex 56 | 57 | \param mutex Mutex object 58 | *) 59 | procedure sfMutex_lock(mutex: PsfMutex); cdecl; external LIB_CSFMLSYSTEM; 60 | 61 | (* 62 | \brief Unlock a mutex 63 | 64 | \param mutex Mutex object 65 | *) 66 | procedure sfMutex_unlock(mutex: PsfMutex); cdecl; external LIB_CSFMLSYSTEM; 67 | 68 | // #endif // SFML_MUTEX_H 69 | -------------------------------------------------------------------------------- /binding/CSFMLSystemSleep.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML System.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_SLEEP_H 32 | // #define SFML_SLEEP_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | // #include 39 | 40 | (* 41 | \brief Make the current thread sleep for a given duration 42 | 43 | sfSleep is the best way to block a program or one of its 44 | threads, as it doesn't consume any CPU power. 45 | 46 | \param duration Time to sleep 47 | *) 48 | procedure sfSleep(duration: sfTime); cdecl; external LIB_CSFMLSYSTEM; 49 | 50 | // #endif // SFML_SLEEP_H 51 | -------------------------------------------------------------------------------- /binding/CSFMLSystemThread.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML System.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_THREAD_H 32 | // #define SFML_THREAD_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | // #include 39 | 40 | (* 41 | \brief Create a new thread from a function pointer 42 | 43 | Note: this does *not* run the thread, use sfThread_launch. 44 | 45 | \param function Entry point of the thread 46 | \param userData Custom data to pass to the thread function 47 | 48 | \return A new sfThread object 49 | *) 50 | type 51 | sfThreadEntryPoint = procedure(UserData: Pointer); cdecl; 52 | 53 | function sfThread_create(proc: sfThreadEntryPoint; userData: pointer): PsfThread; cdecl; external LIB_CSFMLSYSTEM; 54 | 55 | (* 56 | \brief Destroy a thread 57 | 58 | This function calls sfThread_wait, so that the internal thread 59 | cannot survive after the sfThread object is destroyed. 60 | 61 | \param thread Thread to destroy 62 | *) 63 | procedure sfThread_destroy(thread: PsfThread); cdecl; external LIB_CSFMLSYSTEM; 64 | 65 | (* 66 | \brief Run a thread 67 | 68 | This function starts the entry point passed to the 69 | thread's constructor, and returns immediately. 70 | After this function returns, the thread's function is 71 | running in parallel to the calling code. 72 | 73 | \param thread Thread object 74 | *) 75 | procedure sfThread_launch(thread: PsfThread); cdecl; external LIB_CSFMLSYSTEM; 76 | 77 | (* 78 | \brief Wait until a thread finishes 79 | 80 | This function will block the execution until the 81 | thread's function ends. 82 | Warning: if the thread function never ends, the calling 83 | thread will block forever. 84 | If this function is called from its owner thread, it 85 | returns without doing anything. 86 | 87 | \param thread Thread object 88 | *) 89 | procedure sfThread_wait(thread: PsfThread); cdecl; external LIB_CSFMLSYSTEM; 90 | 91 | (* 92 | \brief Terminate a thread 93 | 94 | This function immediately stops the thread, without waiting 95 | for its function to finish. 96 | Terminating a thread with this function is not safe, 97 | and can lead to local variables not being destroyed 98 | on some operating systems. You should rather try to make 99 | the thread function terminate by itself. 100 | 101 | \param thread Thread object 102 | *) 103 | procedure sfThread_terminate(thread: PsfThread); cdecl; external LIB_CSFMLSYSTEM; 104 | 105 | // #endif // SFML_THREAD_H 106 | -------------------------------------------------------------------------------- /binding/CSFMLSystemTime.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML System.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_TIME_H 32 | // #define SFML_TIME_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | 39 | (* 40 | \brief Represents a time value 41 | *) 42 | type 43 | PsfTime = ^sfTime; 44 | sfTime = record 45 | microseconds: sfInt64; 46 | end; 47 | 48 | (* 49 | \brief Predefined "zero" time value 50 | *) 51 | var 52 | sfTime_Zero: sfTime; external LIB_CSFMLSYSTEM; 53 | 54 | (* 55 | \brief Return a time value as a number of seconds 56 | 57 | \param time Time value 58 | 59 | \return Time in seconds 60 | *) 61 | function sfTime_asSeconds(time: sfTime): cfloat; cdecl; external LIB_CSFMLSYSTEM; 62 | 63 | (* 64 | \brief Return a time value as a number of milliseconds 65 | 66 | \param time Time value 67 | 68 | \return Time in milliseconds 69 | *) 70 | function sfTime_asMilliseconds(time: sfTime): sfInt32; cdecl; external LIB_CSFMLSYSTEM; 71 | 72 | (* 73 | \brief Return a time value as a number of microseconds 74 | 75 | \param time Time value 76 | 77 | \return Time in microseconds 78 | *) 79 | function sfTime_asMicroseconds(time: sfTime): sfInt64; cdecl; external LIB_CSFMLSYSTEM; 80 | 81 | (* 82 | \brief Construct a time value from a number of seconds 83 | 84 | \param amount Number of seconds 85 | 86 | \return Time value constructed from the amount of seconds 87 | *) 88 | function sfSeconds(amount: cfloat): sfTime; cdecl; external LIB_CSFMLSYSTEM; 89 | 90 | (* 91 | \brief Construct a time value from a number of milliseconds 92 | 93 | \param amount Number of milliseconds 94 | 95 | \return Time value constructed from the amount of milliseconds 96 | *) 97 | function sfMilliseconds(amount: sfInt32): sfTime; cdecl; external LIB_CSFMLSYSTEM; 98 | 99 | (* 100 | \brief Construct a time value from a number of microseconds 101 | 102 | \param amount Number of microseconds 103 | 104 | \return Time value constructed from the amount of microseconds 105 | *) 106 | function sfMicroseconds(amount: sfInt64): sfTime; cdecl; external LIB_CSFMLSYSTEM; 107 | 108 | // #endif // SFML_TIME_H 109 | -------------------------------------------------------------------------------- /binding/CSFMLSystemTypes.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML System.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_SYSTEM_TYPES_H 32 | // #define SFML_SYSTEM_TYPES_H 33 | 34 | type 35 | PsfClock = ^sfClock; 36 | sfClock = record 37 | end; 38 | 39 | PsfMutex = ^sfMutex; 40 | sfMutex = record 41 | end; 42 | 43 | PsfThread = ^sfThread; 44 | sfThread = record 45 | end; 46 | 47 | // #endif // SFML_SYSTEM_TYPES_H 48 | -------------------------------------------------------------------------------- /binding/CSFMLSystemVector2.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML System.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_VECTOR2_H 32 | // #define SFML_VECTOR2_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | 39 | (* 40 | \brief 2-component vector of integers 41 | *) 42 | type 43 | sfVector2i = record 44 | x: cint; 45 | y: cint; 46 | end; 47 | 48 | (* 49 | \brief 2-component vector of unsigned integers 50 | *) 51 | type 52 | sfVector2u = record 53 | x: cuint; 54 | y: cuint; 55 | end; 56 | 57 | (* 58 | \brief 2-component vector of floats 59 | *) 60 | type 61 | sfVector2f = record 62 | x: cfloat; 63 | y: cfloat; 64 | end; 65 | 66 | // #endif // SFML_VECTOR2_H 67 | -------------------------------------------------------------------------------- /binding/CSFMLSystemVector3.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML System.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_VECTOR3_H 32 | // #define SFML_VECTOR3_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | 39 | (* 40 | \brief 3-component vector of floats 41 | *) 42 | type 43 | sfVector3f = record 44 | x: cfloat; 45 | y: cfloat; 46 | z: cfloat; 47 | end; 48 | 49 | // #endif // SFML_VECTOR3_H 50 | -------------------------------------------------------------------------------- /binding/CSFMLWindow.pas: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Window.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | unit CSFMLWindow; 32 | 33 | {$mode objfpc}{$H+} 34 | 35 | interface 36 | 37 | uses 38 | ctypes, 39 | CSFMLConfig, 40 | CSFMLSystem; 41 | 42 | const 43 | {$ifdef WINDOWS} 44 | LIB_CSFMLWINDOW = 'csfml-window-2.dll'; 45 | {$endif} 46 | {$ifdef LINUX} 47 | LIB_CSFMLWINDOW = 'libcsfml-window.so'; 48 | {$endif} 49 | 50 | // #ifndef SFML_SFML_WINDOW_H 51 | // #define SFML_SFML_WINDOW_H 52 | 53 | //////////////////////////////////////////////////////////// 54 | // Headers 55 | //////////////////////////////////////////////////////////// 56 | // #include 57 | // #include 58 | // #include 59 | // #include 60 | // #include 61 | // #include 62 | // #include 63 | // #include 64 | // #include 65 | // #include 66 | // #include 67 | // #include 68 | // #include 69 | 70 | {$include CSFMLWindowTypes.inc} 71 | {$include CSFMLWindowJoystickIdentification.inc} 72 | {$include CSFMLWindowKeyboard.inc} 73 | {$include CSFMLWindowMouse.inc} 74 | {$include CSFMLWindowJoystick.inc} 75 | {$include CSFMLWindowSensor.inc} 76 | {$include CSFMLWindowWindowHandle.inc} 77 | {$include CSFMLWindowEvent.inc} 78 | {$include CSFMLWindowVideoMode.inc} 79 | {$include CSFMLWindowWindow.inc} 80 | 81 | {$include CSFMLWindowClipboard.inc} 82 | {$include CSFMLWindowContext.inc} 83 | {$include CSFMLWindowCursor.inc} 84 | {$include CSFMLWindowTouch.inc} 85 | 86 | // #endif // SFML_SFML_WINDOW_H 87 | 88 | implementation 89 | 90 | end. 91 | 92 | -------------------------------------------------------------------------------- /binding/CSFMLWindowClipboard.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Window.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_CLIPBOARD_H 32 | // #define SFML_CLIPBOARD_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | // #include 39 | 40 | (* 41 | \brief Get the content of the clipboard as string data (returns an ANSI string) 42 | 43 | This function returns the content of the clipboard 44 | as a string. If the clipboard does not contain string 45 | it returns an empty string. 46 | 47 | \return Clipboard contents as a locale-dependent ANSI string 48 | *) 49 | function sfClipboard_getString(): pchar; cdecl; external LIB_CSFMLWINDOW; 50 | 51 | (* 52 | \brief Get the content of the clipboard as string data (returns a Unicode string) 53 | 54 | This function returns the content of the clipboard 55 | as a string. If the clipboard does not contain string 56 | it returns an empty string. 57 | 58 | \return Clipboard contents as UTF-32 59 | *) 60 | function sfClipboard_getUnicodeString(): PsfUint32; cdecl; external LIB_CSFMLWINDOW; 61 | 62 | (* 63 | \brief Set the content of the clipboard as ANSI string data 64 | 65 | This function sets the content of the clipboard as an 66 | ANSI string. 67 | 68 | \param text ANSI string containing the data to be sent 69 | to the clipboard 70 | *) 71 | procedure sfClipboard_setString(const text: pchar); cdecl; external LIB_CSFMLWINDOW; 72 | 73 | (* 74 | \brief Set the content of the clipboard as Unicode string data 75 | 76 | This function sets the content of the clipboard as a 77 | Unicode string. 78 | 79 | \param text Unicode string containing the data to be sent 80 | to the clipboard 81 | *) 82 | procedure sfClipboard_setUnicodeString(const text: PsfUint32); cdecl; external LIB_CSFMLWINDOW; 83 | 84 | // #endif // SFML_CURSOR_H 85 | -------------------------------------------------------------------------------- /binding/CSFMLWindowContext.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Window.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_CONTEXT_H 32 | // #define SFML_CONTEXT_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | // #include 39 | 40 | (* 41 | \brief Create a new context 42 | 43 | This function activates the new context. 44 | 45 | \return New sfContext object 46 | *) 47 | function sfContext_create(): PsfContext; cdecl; external LIB_CSFMLWINDOW; 48 | 49 | (* 50 | \brief Destroy a context 51 | 52 | \param context Context to destroy 53 | *) 54 | procedure sfContext_destroy(context: PsfContext); cdecl; external LIB_CSFMLWINDOW; 55 | 56 | (* 57 | \brief Activate or deactivate explicitely a context 58 | 59 | \param context Context object 60 | \param active sfTrue to activate, sfFalse to deactivate 61 | 62 | \return sfTrue on success, sfFalse on failure 63 | *) 64 | function sfContext_setActive(context: PsfContext; active: sfBool): sfBool; cdecl; external LIB_CSFMLWINDOW; 65 | 66 | (* 67 | \brief Get the settings of the context. 68 | 69 | Note that these settings may be different than the ones passed to the 70 | constructor; they are indeed adjusted if the original settings are not 71 | directly supported by the system. 72 | 73 | \return Structure containing the settings 74 | *) 75 | function sfContext_getSettings(const context: PsfContext): sfContextSettings; cdecl; external LIB_CSFMLWINDOW; 76 | 77 | (* 78 | \brief Get the currently active context's ID 79 | 80 | The context ID is used to identify contexts when 81 | managing unshareable OpenGL resources. 82 | 83 | \return The active context's ID or 0 if no context is currently active 84 | *) 85 | function sfContext_getActiveContextId(): sfUint64; cdecl; external LIB_CSFMLWINDOW; 86 | 87 | // #endif // SFML_CONTEXT_H 88 | -------------------------------------------------------------------------------- /binding/CSFMLWindowCursor.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Window.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_CURSOR_H 32 | // #define SFML_CURSOR_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | // #include 39 | // #include 40 | 41 | (* 42 | \brief Enumeration of the native system cursor types 43 | 44 | Refer to the following table to determine which cursor 45 | is available on which platform. 46 | 47 | Type | Linux | Mac OS X | Windows 48 | ------------------------------------|:-----:|:--------:|:--------: 49 | sfCursorArrow | yes | yes | yes 50 | sfCursorArrowWait | no | no | yes 51 | sfCursorWait | yes | no | yes 52 | sfCursorText | yes | yes | yes 53 | sfCursorHand | yes | yes | yes 54 | sfCursorSizeHorizontal | yes | yes | yes 55 | sfCursorSizeVertical | yes | yes | yes 56 | sfCursorSizeTopLeftBottomRight | no | no | yes 57 | sfCursorSizeBottomLeftTopRight | no | no | yes 58 | sfCursorSizeAll | yes | no | yes 59 | sfCursorCross | yes | yes | yes 60 | sfCursorHelp | yes | no | yes 61 | sfCursorNotAllowed | yes | yes | yes 62 | *) 63 | type 64 | sfCursorType = ( 65 | sfCursorArrow, ///< Arrow cursor (default) 66 | sfCursorArrowWait, ///< Busy arrow cursor 67 | sfCursorWait, ///< Busy cursor 68 | sfCursorText, ///< I-beam, cursor when hovering over a field allowing text entry 69 | sfCursorHand, ///< Pointing hand cursor 70 | sfCursorSizeHorizontal, ///< Horizontal double arrow cursor 71 | sfCursorSizeVertical, ///< Vertical double arrow cursor 72 | sfCursorSizeTopLeftBottomRight, ///< Double arrow cursor going from top-left to bottom-right 73 | sfCursorSizeBottomLeftTopRight, ///< Double arrow cursor going from bottom-left to top-right 74 | sfCursorSizeAll, ///< Combination of SizeHorizontal and SizeVertical 75 | sfCursorCross, ///< Crosshair cursor 76 | sfCursorHelp, ///< Help cursor 77 | sfCursorNotAllowed ///< Action not allowed cursor 78 | ); 79 | 80 | (* 81 | \brief Create a cursor with the provided image 82 | 83 | \a pixels must be an array of \a width by \a height pixels 84 | in 32-bit RGBA format. If not, this will cause undefined behavior. 85 | 86 | If \a pixels is null or either \a width or \a height are 0, 87 | the current cursor is left unchanged and the function will 88 | return false. 89 | 90 | In addition to specifying the pixel data, you can also 91 | specify the location of the hotspot of the cursor. The 92 | hotspot is the pixel coordinate within the cursor image 93 | which will be located exactly where the mouse pointer 94 | position is. Any mouse actions that are performed will 95 | return the window/screen location of the hotspot. 96 | 97 | \warning On Unix, the pixels are mapped into a monochrome 98 | bitmap: pixels with an alpha channel to 0 are 99 | transparent, black if the RGB channel are close 100 | to zero, and white otherwise. 101 | 102 | \param pixels Array of pixels of the image 103 | \param size Width and height of the image 104 | \param hotspot (x,y) location of the hotspot 105 | \return A new sfCursor object 106 | *) 107 | function sfCursor_createFromPixels(const pixels: PsfUint8; size: sfVector2u; hotspot: sfVector2u): PsfCursor; cdecl; external LIB_CSFMLWINDOW; 108 | 109 | (* 110 | \brief Create a native system cursor 111 | 112 | Refer to the list of cursor available on each system 113 | (see sfCursorType) to know whether a given cursor is 114 | expected to load successfully or is not supported by 115 | the operating system. 116 | 117 | \param type Native system cursor type 118 | \return A new sfCursor object 119 | *) 120 | function sfCursor_createFromSystem(type_: sfCursorType): PsfCursor; cdecl; external LIB_CSFMLWINDOW; 121 | 122 | (* 123 | \brief Destroy a cursor 124 | 125 | \param cursor Cursor to destroy 126 | *) 127 | procedure sfCursor_destroy(cursor: PsfCursor); cdecl; external LIB_CSFMLWINDOW; 128 | 129 | // #endif // SFML_CURSOR_H 130 | -------------------------------------------------------------------------------- /binding/CSFMLWindowExport.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Window.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_WINDOW_EXPORT_H 32 | // #define SFML_WINDOW_EXPORT_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | 39 | //////////////////////////////////////////////////////////// 40 | // Define portable import / export macros 41 | //////////////////////////////////////////////////////////// 42 | // #if defined(CSFML_WINDOW_EXPORTS) 43 | // 44 | // #define function CSFML_API_EXPORT 45 | // 46 | // #else 47 | // 48 | // #define function CSFML_API_IMPORT 49 | // 50 | // #endif 51 | 52 | // #endif // SFML_WINDOW_EXPORT_H 53 | -------------------------------------------------------------------------------- /binding/CSFMLWindowJoystick.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Window.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_JOYSTICK_H 32 | // #define SFML_JOYSTICK_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | // #include 39 | 40 | (* 41 | \brief Global joysticks capabilities 42 | *) 43 | type 44 | sfJoystickCapabilities = cuint; 45 | const 46 | sfJoystickCount = 8; ///< Maximum number of supported joysticks 47 | sfJoystickButtonCount = 32; ///< Maximum number of supported buttons 48 | sfJoystickAxisCount = 8; ///< Maximum number of supported axes 49 | 50 | (* 51 | \brief Axes supported by SFML joysticks 52 | *) 53 | type 54 | sfJoystickAxis = ( 55 | sfJoystickX, ///< The X axis 56 | sfJoystickY, ///< The Y axis 57 | sfJoystickZ, ///< The Z axis 58 | sfJoystickR, ///< The R axis 59 | sfJoystickU, ///< The U axis 60 | sfJoystickV, ///< The V axis 61 | sfJoystickPovX, ///< The X axis of the point-of-view hat 62 | sfJoystickPovY ///< The Y axis of the point-of-view hat 63 | ); 64 | 65 | (* 66 | \brief Check if a joystick is connected 67 | 68 | \param joystick Index of the joystick to check 69 | 70 | \return sfTrue if the joystick is connected, sfFalse otherwise 71 | *) 72 | function sfJoystick_isConnected(joystick: cuint): sfBool; cdecl; external LIB_CSFMLWINDOW; 73 | 74 | (* 75 | \brief Return the number of buttons supported by a joystick 76 | 77 | If the joystick is not connected, this function returns 0. 78 | 79 | \param joystick Index of the joystick 80 | 81 | \return Number of buttons supported by the joystick 82 | *) 83 | function sfJoystick_getButtonCount(joystick: cuint): cuint; cdecl; external LIB_CSFMLWINDOW; 84 | 85 | (* 86 | \brief Check if a joystick supports a given axis 87 | 88 | If the joystick is not connected, this function returns false. 89 | 90 | \param joystick Index of the joystick 91 | \param axis Axis to check 92 | 93 | \return sfTrue if the joystick supports the axis, sfFalse otherwise 94 | *) 95 | function sfJoystick_hasAxis(joystick: cuint; axis: sfJoystickAxis): sfBool; cdecl; external LIB_CSFMLWINDOW; 96 | 97 | (* 98 | \brief Check if a joystick button is pressed 99 | 100 | If the joystick is not connected, this function returns false. 101 | 102 | \param joystick Index of the joystick 103 | \param button Button to check 104 | 105 | \return sfTrue if the button is pressed, sfFalse otherwise 106 | *) 107 | function sfJoystick_isButtonPressed(joystick: cuint; button: cuint): sfBool; cdecl; external LIB_CSFMLWINDOW; 108 | 109 | (* 110 | \brief Get the current position of a joystick axis 111 | 112 | If the joystick is not connected, this function returns 0. 113 | 114 | \param joystick Index of the joystick 115 | \param axis Axis to check 116 | 117 | \return Current position of the axis, in range [-100 .. 100] 118 | *) 119 | function sfJoystick_getAxisPosition(joystick: cuint; axis: sfJoystickAxis): cfloat; cdecl; external LIB_CSFMLWINDOW; 120 | 121 | (* 122 | \brief Get the joystick information 123 | 124 | The result of this function will only remain valid until 125 | the next time the function is called. 126 | 127 | \param joystick Index of the joystick 128 | 129 | \return Structure containing joystick information. 130 | *) 131 | function sfJoystick_getIdentification(joystick: cuint): sfJoystickIdentification; cdecl; external LIB_CSFMLWINDOW; 132 | 133 | (* 134 | \brief Update the states of all joysticks 135 | 136 | This function is used internally by SFML, so you normally 137 | don't have to call it explicitely. However, you may need to 138 | call it if you have no window yet (or no window at all): 139 | in this case the joysticks states are not updated automatically. 140 | *) 141 | procedure sfJoystick_update(); cdecl; external LIB_CSFMLWINDOW; 142 | 143 | // #endif // SFML_JOYSTICK_H 144 | -------------------------------------------------------------------------------- /binding/CSFMLWindowJoystickIdentification.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Window.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_JOYSTICKIDENDIFICATION_H 32 | // #define SFML_JOYSTICKIDENDIFICATION_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | 39 | (* 40 | sfJoystickIdentification holds a joystick's identification 41 | *) 42 | type 43 | sfJoystickIdentification = record 44 | name: pchar; 45 | vendorId: cuint; 46 | productId: cuint; 47 | end; 48 | 49 | // #endif // SFML_JOYSTICKIDENDIFICATION_H 50 | -------------------------------------------------------------------------------- /binding/CSFMLWindowMouse.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Window.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_MOUSE_H 32 | // #define SFML_MOUSE_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | // #include 39 | // #include 40 | 41 | (* 42 | \brief Mouse buttons 43 | *) 44 | type 45 | sfMouseButton = ( 46 | sfMouseLeft, ///< The left mouse button 47 | sfMouseRight, ///< The right mouse button 48 | sfMouseMiddle, ///< The middle (wheel) mouse button 49 | sfMouseXButton1, ///< The first extra mouse button 50 | sfMouseXButton2, ///< The second extra mouse button 51 | 52 | sfMouseButtonCount ///< Keep last -- the total number of mouse buttons 53 | ); 54 | 55 | (* 56 | \brief Mouse wheels 57 | *) 58 | type 59 | sfMouseWheel = ( 60 | sfMouseVerticalWheel, ///< The vertical mouse wheel 61 | sfMouseHorizontalWheel ///< The horizontal mouse wheel 62 | ); 63 | 64 | (* 65 | \brief Check if a mouse button is pressed 66 | 67 | \param button Button to check 68 | 69 | \return sfTrue if the button is pressed, sfFalse otherwise 70 | *) 71 | function sfMouse_isButtonPressed(button: sfMouseButton): sfBool; cdecl; external LIB_CSFMLWINDOW; 72 | 73 | (* 74 | \brief Get the current position of the mouse 75 | 76 | This function returns the current position of the mouse 77 | cursor relative to the given window, or desktop if NULL is passed. 78 | 79 | \param relativeTo Reference window 80 | 81 | \return Position of the mouse cursor, relative to the given window 82 | *) 83 | function sfMouse_getPosition(const relativeTo: PsfWindow): sfVector2i; cdecl; external LIB_CSFMLWINDOW; 84 | 85 | (* 86 | \brief Set the current position of the mouse 87 | 88 | This function sets the current position of the mouse 89 | cursor relative to the given window, or desktop if NULL is passed. 90 | 91 | \param position New position of the mouse 92 | \param relativeTo Reference window 93 | *) 94 | procedure sfMouse_setPosition(position: sfVector2i; const relativeTo: PsfWindow); cdecl; external LIB_CSFMLWINDOW; 95 | 96 | // #endif // SFML_MOUSE_H 97 | -------------------------------------------------------------------------------- /binding/CSFMLWindowSensor.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Window.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_SENSOR_H 32 | // #define SFML_SENSOR_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | // #include 39 | // #include 40 | 41 | (* 42 | \brief Sensor Types 43 | *) 44 | type 45 | sfSensorType = ( 46 | sfSensorAccelerometer, ///< Measures the raw acceleration (m/s^2) 47 | sfSensorGyroscope, ///< Measures the raw rotation rates (degrees/s) 48 | sfSensorMagnetometer, ///< Measures the ambient magnetic field (micro-teslas) 49 | sfSensorGravity, ///< Measures the direction and intensity of gravity, independent of device acceleration (m/s^2) 50 | sfSensorUserAcceleration, ///< Measures the direction and intensity of device acceleration, independent of the gravity (m/s^2) 51 | sfSensorOrientation, ///< Measures the absolute 3D orientation (degrees) 52 | 53 | sfSensorCount ///< Keep last -- the total number of sensor types 54 | ); 55 | 56 | (* 57 | \brief Check if a sensor is available on the underlying platform 58 | 59 | \param sensor Sensor to check 60 | 61 | \return sfTrue if the sensor is available, sfFalse otherwise 62 | *) 63 | function sfSensor_isAvailable(sensor: sfSensorType): sfBool; cdecl; external LIB_CSFMLWINDOW; 64 | 65 | (* 66 | \brief Enable or disable a sensor 67 | 68 | All sensors are disabled by default, to avoid consuming too 69 | much battery power. Once a sensor is enabled, it starts 70 | sending events of the corresponding type. 71 | 72 | This function does nothing if the sensor is unavailable. 73 | 74 | \param sensor Sensor to enable 75 | \param enabled sfTrue to enable, sfFalse to disable 76 | *) 77 | procedure sfSensor_setEnabled(sensor: sfSensorType; enabled: sfBool); cdecl; external LIB_CSFMLWINDOW; 78 | 79 | (* 80 | \brief Get the current sensor value 81 | 82 | \param sensor Sensor to read 83 | 84 | \return The current sensor value 85 | *) 86 | function sfSensor_getValue(sensor: sfSensorType): sfVector3f; cdecl; external LIB_CSFMLWINDOW; 87 | 88 | // #endif // SFML_SENSOR_H 89 | -------------------------------------------------------------------------------- /binding/CSFMLWindowTouch.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Window.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_TOUCH_H 32 | // #define SFML_TOUCH_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | // #include 39 | // #include 40 | 41 | (* 42 | \brief Check if a touch event is currently down 43 | 44 | \param finger Finger index 45 | 46 | \return sfTrue if \a finger is currently touching the screen, sfFalse otherwise 47 | *) 48 | function sfTouch_isDown(finger: cuint): sfBool; cdecl; external LIB_CSFMLWINDOW; 49 | 50 | (* 51 | \brief Get the current position of a touch in window coordinates 52 | 53 | This function returns the current touch position 54 | relative to the given window, or desktop if NULL is passed. 55 | 56 | \param finger Finger index 57 | \param relativeTo Reference window 58 | 59 | \return Current position of \a finger, or undefined if it's not down 60 | *) 61 | function sfTouch_getPosition(finger: cuint; const relativeTo: PsfWindow): sfVector2i; cdecl; external LIB_CSFMLWINDOW; 62 | 63 | // #endif // SFML_TOUCH_H 64 | -------------------------------------------------------------------------------- /binding/CSFMLWindowTypes.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Window.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_WINDOW_TYPES_H 32 | // #define SFML_WINDOW_TYPES_H 33 | 34 | type 35 | PsfContext = ^sfContext; 36 | sfContext = record 37 | end; 38 | 39 | PsfCursor = ^sfCursor; 40 | sfCursor = record 41 | end; 42 | 43 | PsfWindow = ^sfWindow; 44 | sfWindow = record 45 | end; 46 | 47 | // #endif // SFML_WINDOW_TYPES_H 48 | -------------------------------------------------------------------------------- /binding/CSFMLWindowVideoMode.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Window.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_VIDEOMODE_H 32 | // #define SFML_VIDEOMODE_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | // #include 39 | 40 | (* 41 | \brief sfVideoMode defines a video mode (width, height, bpp, frequency) 42 | and provides functions for getting modes supported 43 | by the display device 44 | *) 45 | type 46 | PsfVideoMode = ^sfVideoMode; 47 | sfVideoMode = record 48 | width: cuint; ///< Video mode width, in pixels 49 | height: cuint; ///< Video mode height, in pixels 50 | bitsPerPixel: cuint ; ///< Video mode pixel depth, in bits per pixels 51 | end; 52 | 53 | (* 54 | \brief Get the current desktop video mode 55 | 56 | \return Current desktop video mode 57 | *) 58 | function sfVideoMode_getDesktopMode(): sfVideoMode; cdecl; external LIB_CSFMLWINDOW; 59 | 60 | (* 61 | \brief Retrieve all the video modes supported in fullscreen mode 62 | 63 | When creating a fullscreen window, the video mode is restricted 64 | to be compatible with what the graphics driver and monitor 65 | support. This function returns the complete list of all video 66 | modes that can be used in fullscreen mode. 67 | The returned array is sorted from best to worst, so that 68 | the first element will always give the best mode (higher 69 | width, height and bits-per-pixel). 70 | 71 | \param count Pointer to a variable that will be filled with the number of modes in the array 72 | 73 | \return Pointer to an array containing all the supported fullscreen modes 74 | *) 75 | function sfVideoMode_getFullscreenModes(count: pcsize_t): PsfVideoMode; cdecl; external LIB_CSFMLWINDOW; 76 | 77 | (* 78 | \brief Tell whether or not a video mode is valid 79 | 80 | The validity of video modes is only relevant when using 81 | fullscreen windows; otherwise any video mode can be used 82 | with no restriction. 83 | 84 | \param mode Video mode 85 | 86 | \return sfTrue if the video mode is valid for fullscreen mode 87 | *) 88 | function sfVideoMode_isValid(mode: sfVideoMode): sfBool; cdecl; external LIB_CSFMLWINDOW; 89 | 90 | // #endif // SFML_VIDEOMODE_H 91 | -------------------------------------------------------------------------------- /binding/CSFMLWindowWindowHandle.inc: -------------------------------------------------------------------------------- 1 | // 2 | // SFML/CSFML Window.h header binding for the Free Pascal Compiler aka FPC 3 | // 4 | // Binaries and demos available at https://www.djmaster.com/ 5 | // 6 | 7 | //////////////////////////////////////////////////////////// 8 | // 9 | // SFML - Simple and Fast Multimedia Library 10 | // Copyright (C) 2007-2018 Laurent Gomila (laurent@sfml-dev.org) 11 | // 12 | // This software is provided 'as-is', without any express or implied warranty. 13 | // In no event will the authors be held liable for any damages arising from the use of this software. 14 | // 15 | // Permission is granted to anyone to use this software for any purpose, 16 | // including commercial applications, and to alter it and redistribute it freely, 17 | // subject to the following restrictions: 18 | // 19 | // 1. The origin of this software must not be misrepresented; 20 | // you must not claim that you wrote the original software. 21 | // If you use this software in a product, an acknowledgment 22 | // in the product documentation would be appreciated but is not required. 23 | // 24 | // 2. Altered source versions must be plainly marked as such, 25 | // and must not be misrepresented as being the original software. 26 | // 27 | // 3. This notice may not be removed or altered from any source distribution. 28 | // 29 | //////////////////////////////////////////////////////////// 30 | 31 | // #ifndef SFML_WINDOWHANDLE_H 32 | // #define SFML_WINDOWHANDLE_H 33 | 34 | //////////////////////////////////////////////////////////// 35 | // Headers 36 | //////////////////////////////////////////////////////////// 37 | // #include 38 | 39 | //////////////////////////////////////////////////////////// 40 | // Define a low-level window handle type, specific to 41 | // each platform 42 | //////////////////////////////////////////////////////////// 43 | // #if defined(CSFML_SYSTEM_WINDOWS) 44 | // 45 | // // Window handle is HWND (HWND__*) on Windows 46 | // struct HWND__; 47 | // typedef struct HWND__* sfWindowHandle; 48 | // 49 | // #elif defined(CSFML_SYSTEM_LINUX) || defined(CSFML_SYSTEM_FREEBSD) 50 | // 51 | // // Window handle is Window (unsigned long) on Unix - X11 52 | // typedef unsigned long sfWindowHandle; 53 | // 54 | // #elif defined(CSFML_SYSTEM_MACOS) 55 | // 56 | // // Window handle is NSWindow (void*) on Mac OS X - Cocoa 57 | // typedef void* sfWindowHandle; 58 | // 59 | // #endif 60 | type 61 | sfWindowHandle = pointer; 62 | 63 | // #endif // SFML_WINDOWHANDLE_H 64 | -------------------------------------------------------------------------------- /demos/Basic.pas: -------------------------------------------------------------------------------- 1 | program Basic; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses 6 | SysUtils, 7 | {$ifdef LINUX} 8 | Math, 9 | {$endif} 10 | ctypes, 11 | CSFMLConfig, 12 | CSFMLAudio, 13 | CSFMLGraphics, 14 | CSFMLNetwork, 15 | CSFMLSystem, 16 | CSFMLWindow; 17 | 18 | var 19 | Mode: sfVideoMode; 20 | Window: PsfRenderWindow; 21 | Title: string; 22 | Text: PsfText; 23 | Font: PsfFont; 24 | TextPos: sfVector2f; 25 | Event: sfEvent; 26 | begin 27 | {$ifdef LINUX} 28 | SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow, exPrecision]); 29 | 30 | {$endif} 31 | Mode.Width := 800; 32 | Mode.Height := 600; 33 | Mode.BitsPerPixel := 32; 34 | 35 | Title := 'SFML Basic Window - ' + lowerCase({$I %FPCTARGETCPU%}) + '-' + lowerCase({$I %FPCTARGETOS%}); 36 | Window := sfRenderWindow_Create(Mode, PChar(Title), sfUint32(sfResize) or sfUint32(sfClose), nil); 37 | if not Assigned(Window) then 38 | raise Exception.Create('Window error'); 39 | 40 | // Create a graphical text to display 41 | Font := sfFont_createFromFile('../resources/admirationpains.ttf'); 42 | if not Assigned(Font) then 43 | raise Exception.Create('Font error'); 44 | 45 | Text := sfText_Create(); 46 | sfText_setString(Text, 'Basic Window'); 47 | sfText_setFont(Text, Font); 48 | sfText_setCharacterSize(Text, 50); 49 | sfText_setColor(Text, sfWhite); 50 | TextPos.X := 250; 51 | TextPos.Y := 250; 52 | sfText_setPosition(Text, TextPos); 53 | 54 | // Start the game loop 55 | while (sfRenderWindow_IsOpen(Window) = sfTrue) do 56 | begin 57 | // Process events 58 | while (sfRenderWindow_PollEvent(Window, @Event) = sfTrue) do 59 | begin 60 | // Close window : exit 61 | if (Event.type_ = sfEvtClosed) then 62 | sfRenderWindow_Close(Window); 63 | end; 64 | 65 | // Clear the screen 66 | sfRenderWindow_clear(Window, sfBlue); 67 | 68 | // Draw the text 69 | sfRenderWindow_drawText(Window, Text, nil); 70 | 71 | // Update the window 72 | sfRenderWindow_display(Window); 73 | end; 74 | 75 | // Cleanup resources 76 | sfRenderWindow_Destroy(Window); 77 | end. 78 | -------------------------------------------------------------------------------- /demos/Caleidos.pas: -------------------------------------------------------------------------------- 1 | program Caleidos; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses 6 | SysUtils, 7 | {$ifdef LINUX} 8 | Math, 9 | {$endif} 10 | ctypes, 11 | CSFMLConfig, 12 | CSFMLAudio, 13 | CSFMLGraphics, 14 | CSFMLNetwork, 15 | CSFMLSystem, 16 | CSFMLWindow; 17 | 18 | var 19 | FragmentShader: PChar; 20 | RenderTargetHandle: PsfRenderTexture; 21 | TextureHandle: PsfTexture; 22 | Mode: sfVideoMode; 23 | WindowHandle: PsfRenderWindow; 24 | Title: string; 25 | Event: sfEvent; 26 | States: sfRenderStates; 27 | ShaderHandle: PsfShader; 28 | SpriteHandle: PsfSprite; 29 | Clock: PsfClock; 30 | MousePos: sfVector2i; 31 | begin 32 | {$ifdef LINUX} 33 | SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow, exPrecision]); 34 | 35 | {$endif} 36 | States.BlendMode := sfBlendAlpha; 37 | States.Transform := sfTransform_identity; 38 | 39 | FragmentShader := 40 | '#ifdef GL_ES'#10+ 41 | 'precision mediump float;'#10+ 42 | '#endif'#10+ 43 | ''#10+ 44 | '#extension GL_OES_standard_derivatives : enable'#10+ 45 | ''#10+ 46 | 'uniform float time;'#10+ 47 | 'uniform vec2 resolution;'#10+ 48 | ''#10+ 49 | 'const float PI = 3.14159;'#10+ 50 | ''#10+ 51 | 'vec3 hsv(float h, float s, float v) {'#10+ 52 | ' float c = s * v;'#10+ 53 | ' float _ = mod(h * 6.0, 6.0);'#10+ 54 | ' vec3 C = vec3(c, c*(1.0 - abs(mod(_, 2.0) - 1.0)), 0.0);'#10+ 55 | ' if (_ < 1.0) {'#10+ 56 | ' C = vec3(C.x, C.y, C.z);'#10+ 57 | ' } else if (_ < 2.0) {'#10+ 58 | ' C = vec3(C.y, C.x, C.z);'#10+ 59 | ' } else if (_ < 3.0) {'#10+ 60 | ' C = vec3(C.z, C.x, C.y);'#10+ 61 | ' } else if (_ < 4.0) {'#10+ 62 | ' C = vec3(C.z, C.y, C.x);'#10+ 63 | ' } else if (_ < 5.0) {'#10+ 64 | ' C = vec3(C.y, C.z, C.x);'#10+ 65 | ' } else {'#10+ 66 | ' C = vec3(C.x, C.z, C.y);'#10+ 67 | ' }'#10+ 68 | ' return C + (v - c);'#10+ 69 | '}'#10+ 70 | ''#10+ 71 | 'float map(vec3 p) {'#10+ 72 | ' return 2.0 - length(p.xz);'#10+ 73 | '}'#10+ 74 | ''#10+ 75 | 'float noise(vec2 co){'#10+ 76 | ' return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);'#10+ 77 | '}'#10+ 78 | ''#10+ 79 | 'void main( void ) {'#10+ 80 | ' vec2 p = (2.0 * gl_FragCoord.xy - resolution) / resolution.y;'#10+ 81 | ' vec3 cp = vec3(cos(time * 0.2), 0.0, sin(time * 0.45)) * 0.5;'#10+ 82 | ' vec3 cl = vec3(-sin(time), 10.0, cos(time));'#10+ 83 | ' vec3 cf = normalize(cl - cp);'#10+ 84 | ' vec3 cs = normalize(cross(cf, vec3(sin(time * 0.1), 0.0, cos(time * 0.1))));'#10+ 85 | ' vec3 cu = normalize(cross(cs, cf));'#10+ 86 | ' float focus = 0.5;'#10+ 87 | ' vec3 rd = normalize(cs * p.x + cu * p.y + cf * focus);'#10+ 88 | ' vec3 rp = cp;'#10+ 89 | ' for (int i = 0; i < 64; ++i) {'#10+ 90 | ' float d = map(rp);'#10+ 91 | ' if (d < 0.001)'#10+ 92 | ' break;'#10+ 93 | ' rp += rd * d;'#10+ 94 | ' }'#10+ 95 | ' float a = (atan(rp.z, rp.x)) * 16.0 / PI;'#10+ 96 | ' float ai = floor(a);'#10+ 97 | ' float af = fract(a);'#10+ 98 | ' float d = (rp.y + 0.5 * time) * 10.0;'#10+ 99 | ' float di = floor(d);'#10+ 100 | ' float df = fract(d);'#10+ 101 | ' float v = 32.0 * af * (1.0 - af) * df * (1.0 - df) * exp(-rp.y * 0.8);'#10+ 102 | ' gl_FragColor = vec4(hsv(noise(vec2(ai, di) * 0.01), 1.0, v), 1.0);'#10+ 103 | '}'; 104 | ShaderHandle := sfShader_createFromMemory(nil, nil, FragmentShader); 105 | States.Shader := ShaderHandle; 106 | 107 | RenderTargetHandle := sfRenderTexture_create(800, 600, sfFalse); 108 | TextureHandle := sfRenderTexture_getTexture(RenderTargetHandle); 109 | 110 | SpriteHandle := sfSprite_create(); 111 | sfSprite_setTexture(SpriteHandle, TextureHandle, sfFalse); 112 | 113 | // Create the main Window 114 | Mode.Width := 800; 115 | Mode.Height := 600; 116 | Mode.BitsPerPixel := 32; 117 | Title := 'SFML Shader - ' + lowerCase({$I %FPCTARGETCPU%}) + '-' + lowerCase({$I %FPCTARGETOS%}); 118 | WindowHandle := sfRenderWindow_create(Mode, PChar(Title), sfUint32(sfTitleBar) or sfUint32(sfClose), nil); 119 | 120 | sfShader_setFloat2Parameter(ShaderHandle, 'resolution', Mode.Width, Mode.Height); 121 | 122 | Clock := sfClock_create(); 123 | sfClock_restart(Clock); 124 | 125 | // Start the loop 126 | while (sfRenderWindow_isOpen(WindowHandle) = sfTrue) do 127 | begin 128 | // Process events 129 | while (sfRenderWindow_pollEvent(WindowHandle, @Event) = sfTrue) do 130 | begin 131 | if Event.type_ = sfEvtClosed then 132 | sfRenderWindow_close(WindowHandle); 133 | end; 134 | 135 | MousePos := sfMouse_getPositionRenderWindow(WindowHandle); 136 | sfShader_setFloat2Parameter(ShaderHandle, 'mouse', MousePos.x / Mode.Width, 1 - MousePos.y / Mode.Height); 137 | 138 | sfShader_setFloatParameter(ShaderHandle, 'time', sfTime_asSeconds(sfClock_getElapsedTime(Clock)) ); 139 | 140 | // Draw the sprite with the shader on it 141 | sfRenderWindow_drawSprite(WindowHandle, SpriteHandle, @States); 142 | 143 | // Finally, display the rendered frame on screen 144 | sfRenderWindow_display(WindowHandle); 145 | end; 146 | 147 | sfSprite_destroy(SpriteHandle); 148 | sfRenderWindow_Destroy(WindowHandle); 149 | end. 150 | -------------------------------------------------------------------------------- /demos/Circle.pas: -------------------------------------------------------------------------------- 1 | program Circle; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses 6 | SysUtils, 7 | {$ifdef LINUX} 8 | Math, 9 | {$endif} 10 | ctypes, 11 | CSFMLConfig, 12 | CSFMLAudio, 13 | CSFMLGraphics, 14 | CSFMLNetwork, 15 | CSFMLSystem, 16 | CSFMLWindow; 17 | const 18 | Radius = 200; 19 | 20 | var 21 | VideoMode: sfVideoMode; 22 | RenderWindow: PsfRenderWindow; 23 | Title: string; 24 | Event: sfEvent; 25 | CircleShape: PsfCircleShape; 26 | Origin: sfVector2f; 27 | begin 28 | {$ifdef LINUX} 29 | SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow, exPrecision]); 30 | 31 | {$endif} 32 | // Create the main Window 33 | VideoMode.Width := 2 * Radius; 34 | VideoMode.Height := 2 * Radius; 35 | VideoMode.BitsPerPixel := 32; 36 | Title := 'SFML Circle - ' + lowerCase({$I %FPCTARGETCPU%}) + '-' + lowerCase({$I %FPCTARGETOS%}); 37 | RenderWindow := sfRenderWindow_create(VideoMode, PChar(Title), sfUint32(sfTitleBar) or sfUint32(sfResize) or sfUint32(sfClose), nil); 38 | 39 | CircleShape := sfCircleShape_create(); 40 | Origin.X := Radius; 41 | Origin.Y := Radius; 42 | sfCircleShape_setOrigin(CircleShape, Origin); 43 | sfCircleShape_setRadius(CircleShape, Radius); 44 | sfCircleShape_setOutlineThickness(CircleShape, Radius); 45 | sfCircleShape_setOutlineColor(CircleShape, sfWhite); 46 | sfCircleShape_setFillColor(CircleShape, sfGreen); 47 | 48 | // Start the loop 49 | while (sfRenderWindow_isOpen(RenderWindow) = sfTrue) do 50 | begin 51 | // Process events 52 | while (sfRenderWindow_pollEvent(RenderWindow, @Event) = sfTrue) do 53 | begin 54 | if Event.type_ = sfEvtClosed then 55 | sfRenderWindow_close(RenderWindow); 56 | end; 57 | 58 | // Clear the screen 59 | sfRenderWindow_clear(RenderWindow, sfRed); 60 | 61 | // Draw the circle 62 | sfRenderWindow_drawCircleShape(RenderWindow, CircleShape, nil); 63 | 64 | // Finally, display the rendered frame on screen 65 | sfRenderWindow_display(RenderWindow); 66 | end; 67 | 68 | // Cleanup resources 69 | sfCircleShape_destroy(CircleShape); 70 | sfRenderWindow_Destroy(RenderWindow); 71 | end. 72 | -------------------------------------------------------------------------------- /demos/Circles.pas: -------------------------------------------------------------------------------- 1 | program Circles; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses 6 | SysUtils, 7 | ctypes, 8 | CSFMLConfig, 9 | CSFMLAudio, 10 | CSFMLGraphics, 11 | CSFMLNetwork, 12 | CSFMLSystem, 13 | CSFMLWindow; 14 | 15 | var 16 | VertexShader, FragmentShader: PChar; 17 | RenderTargetHandle: PsfRenderTexture; 18 | TextureHandle: PsfTexture; 19 | Mode: sfVideoMode; 20 | WindowHandle: PsfRenderWindow; 21 | Title: string; 22 | Event: sfEvent; 23 | States: sfRenderStates; 24 | CircleShaderHandle: PsfShader; 25 | SpriteHandle: PsfSprite; 26 | begin 27 | States.BlendMode := sfBlendAlpha; 28 | States.Transform := sfTransform_identity; 29 | 30 | VertexShader := 31 | '#version 110'#10 + 32 | '#ifdef GL_ES'#10 + 33 | 'precision lowp float;'#10 + 34 | '#endif'#10 + 35 | ''#10 + 36 | 'varying vec2 uv;'#10 + 37 | ''#10 + 38 | 'void'#10 + 39 | 'main() {'#10 + 40 | ' gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;'#10 + 41 | ' uv = vec2(gl_MultiTexCoord0);'#10 + 42 | '}'; 43 | FragmentShader := 44 | '#version 110'#10 + 45 | '#ifdef GL_ES'#10 + 46 | 'precision lowp float;'#10 + 47 | '#endif'#10 + 48 | ''#10 + 49 | 'varying vec2 uv;'#10 + 50 | 'uniform float Radius;'#10 + 51 | 'uniform vec2 Position;'#10 + 52 | 'uniform vec4 CircleColor;'#10 + 53 | ''#10 + 54 | 'void'#10 + 55 | 'main() {'#10 + 56 | ' vec4 color0 = CircleColor;'#10 + 57 | ''#10 + 58 | ' vec2 m = uv - Position;'#10 + 59 | ' float dist = Radius - sqrt(m.x * m.x + m.y * m.y);'#10 + 60 | ''#10 + 61 | ' float t = 0.0;'#10 + 62 | ' if (dist > 2.0)'#10 + 63 | ' t = 1.0;'#10 + 64 | ' else if (dist > 0.0)'#10 + 65 | ' t = 0.5 * dist;'#10 + 66 | ''#10 + 67 | ' color0.a = t * color0.a;'#10 + 68 | ' gl_FragColor = color0;'#10 + 69 | '}'; 70 | CircleShaderHandle := sfShader_createFromMemory(VertexShader, nil, FragmentShader); 71 | States.Shader := CircleShaderHandle; 72 | 73 | RenderTargetHandle := sfRenderTexture_create(800, 600, sfFalse); 74 | TextureHandle := sfRenderTexture_getTexture(RenderTargetHandle); 75 | 76 | SpriteHandle := sfSprite_create(); 77 | sfSprite_setTexture(SpriteHandle, TextureHandle, sfFalse); 78 | 79 | // Create the main Window 80 | Mode.Width := 800; 81 | Mode.Height := 600; 82 | Mode.BitsPerPixel := 32; 83 | Title := 'SFML Shader - ' + lowerCase({$I %FPCTARGETCPU%}) + '-' + lowerCase({$I %FPCTARGETOS%}); 84 | WindowHandle := sfRenderWindow_create(Mode, PChar(Title), sfUint32(sfTitleBar) or sfUint32(sfClose), nil); 85 | 86 | // Start the loop 87 | while (sfRenderWindow_isOpen(WindowHandle) = sfTrue) do 88 | begin 89 | // Process events 90 | while (sfRenderWindow_pollEvent(WindowHandle, @Event) = sfTrue) do 91 | begin 92 | if Event.type_ = sfEvtClosed then 93 | sfRenderWindow_close(WindowHandle); 94 | end; 95 | 96 | sfShader_setColorParameter(CircleShaderHandle, 'CircleColor', sfColor_fromRGBA(Random($FF), Random($FF), Random($FF), Random($FF))); 97 | sfShader_setFloatParameter(CircleShaderHandle, 'Radius', 200 * Random); 98 | sfShader_setFloat2Parameter(CircleShaderHandle, 'Position', 800 * Random, 600 * Random); 99 | 100 | sfRenderWindow_drawSprite(WindowHandle, SpriteHandle, @States); 101 | 102 | // Finally, display the rendered frame on screen 103 | sfRenderWindow_display(WindowHandle); 104 | end; 105 | 106 | sfSprite_destroy(SpriteHandle); 107 | sfRenderWindow_Destroy(WindowHandle); 108 | end. 109 | -------------------------------------------------------------------------------- /demos/Colorful.pas: -------------------------------------------------------------------------------- 1 | program Colorful; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses 6 | SysUtils, 7 | {$ifdef LINUX} 8 | Math, 9 | {$endif} 10 | ctypes, 11 | CSFMLConfig, 12 | CSFMLAudio, 13 | CSFMLGraphics, 14 | CSFMLNetwork, 15 | CSFMLSystem, 16 | CSFMLWindow; 17 | 18 | var 19 | FragmentShader: PChar; 20 | RenderTargetHandle: PsfRenderTexture; 21 | TextureHandle: PsfTexture; 22 | Mode: sfVideoMode; 23 | WindowHandle: PsfRenderWindow; 24 | Title: string; 25 | Event: sfEvent; 26 | States: sfRenderStates; 27 | ShaderHandle: PsfShader; 28 | SpriteHandle: PsfSprite; 29 | Clock: PsfClock; 30 | begin 31 | {$ifdef LINUX} 32 | SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow, exPrecision]); 33 | 34 | {$endif} 35 | States.BlendMode := sfBlendAlpha; 36 | States.Transform := sfTransform_identity; 37 | 38 | FragmentShader := 39 | '// Colorful Voronoi'#10 + 40 | '// By: Brandon Fogerty'#10 + 41 | '// bfogerty at gmail dot com'#10 + 42 | '// xdpixel.com'#10 + 43 | ''#10 + 44 | '#ifdef GL_ES'#10 + 45 | 'precision mediump float;'#10 + 46 | '#endif'#10 + 47 | ''#10 + 48 | 'uniform float time;'#10 + 49 | 'uniform vec2 resolution;'#10 + 50 | ''#10 + 51 | 'vec2 hash(vec2 p)'#10 + 52 | '{'#10 + 53 | ' mat2 m = mat2( 13.85, 47.77,'#10 + 54 | ' 99.41, 88.48'#10 + 55 | ' );'#10 + 56 | ''#10 + 57 | ' return fract(tan(m*p*p*p*p*p*p) * 46727.29);'#10 + 58 | '}'#10 + 59 | ''#10 + 60 | 'float voronoi(vec2 p)'#10 + 61 | '{'#10 + 62 | ' vec2 g = floor(p);'#10 + 63 | ' vec2 f = fract(p);'#10 + 64 | ''#10 + 65 | ' float distanceToClosestFeaturePoint = 1.0;'#10 + 66 | ' for(int y = -1; y <= 1; y++)'#10 + 67 | ' {'#10 + 68 | ' for(int x = -1; x <= 1; x++)'#10 + 69 | ' {'#10 + 70 | ' vec2 latticePoint = vec2(x, y);'#10 + 71 | ' float currentDistance = distance(latticePoint + hash(g+latticePoint), f);'#10 + 72 | ' distanceToClosestFeaturePoint = min(distanceToClosestFeaturePoint, currentDistance);'#10 + 73 | ' }'#10 + 74 | ' }'#10 + 75 | ''#10 + 76 | ' return distanceToClosestFeaturePoint;'#10 + 77 | '}'#10 + 78 | ''#10 + 79 | 'void main( void )'#10 + 80 | '{'#10 + 81 | ' vec2 uv = ( gl_FragCoord.xy / resolution.xy ) * 2.0 - 1.0;'#10 + 82 | ' uv.x *= resolution.x / resolution.y;'#10 + 83 | ''#10 + 84 | ' float offset = voronoi(uv*10.0 + vec2(time));'#10 + 85 | ' float t = 1.0/abs(((uv.x + sin(uv.y + time)) + offset) * 30.0);'#10 + 86 | ''#10 + 87 | ' float r = voronoi( uv * 1.0 ) * 10.0;'#10 + 88 | ' vec3 finalColor = vec3(10.0 * uv.y, 2.0, 1.0 * r) * t;'#10 + 89 | ''#10 + 90 | ' gl_FragColor = vec4(finalColor, 1.0 );'#10 + 91 | '}'; 92 | ShaderHandle := sfShader_createFromMemory(nil, nil, FragmentShader); 93 | States.Shader := ShaderHandle; 94 | 95 | RenderTargetHandle := sfRenderTexture_create(800, 600, sfFalse); 96 | TextureHandle := sfRenderTexture_getTexture(RenderTargetHandle); 97 | 98 | SpriteHandle := sfSprite_create(); 99 | sfSprite_setTexture(SpriteHandle, TextureHandle, sfFalse); 100 | 101 | // Create the main Window 102 | Mode.Width := 800; 103 | Mode.Height := 600; 104 | Mode.BitsPerPixel := 32; 105 | Title := 'SFML Shader - ' + lowerCase({$I %FPCTARGETCPU%}) + '-' + lowerCase({$I %FPCTARGETOS%}); 106 | WindowHandle := sfRenderWindow_create(Mode, PChar(Title), sfUint32(sfTitleBar) or sfUint32(sfClose), nil); 107 | 108 | sfShader_setFloat2Parameter(ShaderHandle, 'resolution', Mode.Width, Mode.Height); 109 | 110 | Clock := sfClock_create(); 111 | sfClock_restart(Clock); 112 | 113 | // Start the loop 114 | while (sfRenderWindow_isOpen(WindowHandle) = sfTrue) do 115 | begin 116 | // Process events 117 | while (sfRenderWindow_pollEvent(WindowHandle, @Event) = sfTrue) do 118 | begin 119 | if Event.type_ = sfEvtClosed then 120 | sfRenderWindow_close(WindowHandle); 121 | end; 122 | 123 | sfShader_setFloatParameter(ShaderHandle, 'time', sfTime_asSeconds(sfClock_getElapsedTime(Clock)) ); 124 | 125 | // Draw the sprite with the shader on it 126 | sfRenderWindow_drawSprite(WindowHandle, SpriteHandle, @States); 127 | 128 | // Finally, display the rendered frame on screen 129 | sfRenderWindow_display(WindowHandle); 130 | end; 131 | 132 | sfSprite_destroy(SpriteHandle); 133 | sfRenderWindow_Destroy(WindowHandle); 134 | end. 135 | -------------------------------------------------------------------------------- /demos/Dark.pas: -------------------------------------------------------------------------------- 1 | program Dark; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses 6 | SysUtils, 7 | {$ifdef LINUX} 8 | Math, 9 | {$endif} 10 | ctypes, 11 | CSFMLConfig, 12 | CSFMLAudio, 13 | CSFMLGraphics, 14 | CSFMLNetwork, 15 | CSFMLSystem, 16 | CSFMLWindow; 17 | 18 | var 19 | FragmentShader: PChar; 20 | RenderTargetHandle: PsfRenderTexture; 21 | TextureHandle: PsfTexture; 22 | Mode: sfVideoMode; 23 | WindowHandle: PsfRenderWindow; 24 | Title: string; 25 | Event: sfEvent; 26 | States: sfRenderStates; 27 | ShaderHandle: PsfShader; 28 | SpriteHandle: PsfSprite; 29 | Clock: PsfClock; 30 | MousePos: sfVector2i; 31 | begin 32 | {$ifdef LINUX} 33 | SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow, exPrecision]); 34 | 35 | {$endif} 36 | States.BlendMode := sfBlendAlpha; 37 | States.Transform := sfTransform_identity; 38 | 39 | // Create the main Window 40 | Mode.width := 800; 41 | Mode.height := 600; 42 | Mode.bitsPerPixel := 32; 43 | Title := 'SFML Shader - ' + lowerCase({$I %FPCTARGETCPU%}) + '-' + lowerCase({$I %FPCTARGETOS%}); 44 | WindowHandle := sfRenderWindow_create(Mode, PChar(Title), sfUint32(sfTitleBar) or sfUint32(sfClose), nil); 45 | sfRenderWindow_setMouseCursorVisible(WindowHandle, sfFalse); // hide the cursor 46 | 47 | RenderTargetHandle := sfRenderTexture_create(Mode.width, Mode.height, sfFalse); 48 | TextureHandle := sfRenderTexture_getTexture(RenderTargetHandle); 49 | 50 | SpriteHandle := sfSprite_create(); 51 | sfSprite_setTexture(SpriteHandle, TextureHandle, sfFalse); 52 | 53 | FragmentShader := 54 | '// made by darkstalker'#10 + 55 | '#ifdef GL_ES'#10 + 56 | 'precision mediump float;'#10 + 57 | '#endif'#10 + 58 | ''#10 + 59 | 'uniform float time;'#10 + 60 | 'uniform vec2 mouse;'#10 + 61 | 'uniform vec2 resolution;'#10 + 62 | ''#10 + 63 | '#define M_Pi 3.14159265358979'#10 + 64 | ''#10 + 65 | 'mat2 calcRotationMat3(float ang)'#10 + 66 | '{'#10 + 67 | ' return mat2(cos(ang), -sin(ang), sin(ang), cos(ang));'#10 + 68 | '}'#10 + 69 | ''#10 + 70 | ''#10 + 71 | 'void main(void)'#10 + 72 | '{'#10 + 73 | ' mat2 rotMatrix = calcRotationMat3(M_Pi*0.25*time*0.1);'#10 + 74 | ''#10 + 75 | ' vec2 screen_pos = gl_FragCoord.xy;'#10 + 76 | ' vec2 mouse_pos = mouse*resolution;'#10 + 77 | ''#10 + 78 | ' vec2 p = rotMatrix*screen_pos * 0.2;'#10 + 79 | ' float value = clamp((cos(p.x) + cos(p.y)) * 10., .1, 1.);'#10 + 80 | ' float light = 0.08 + clamp(1. - distance(screen_pos, mouse_pos) / 150., 0., 1.);'#10 + 81 | ''#10 + 82 | ' gl_FragColor = vec4(vec3(value*light), 1.);'#10 + 83 | '}'; 84 | ShaderHandle := sfShader_createFromMemory(nil, nil, FragmentShader); 85 | States.Shader := ShaderHandle; 86 | 87 | sfShader_setFloat2Parameter(ShaderHandle, 'resolution', Mode.width, Mode.height); 88 | 89 | Clock := sfClock_create(); 90 | sfClock_restart(Clock); 91 | 92 | // Start the loop 93 | while (sfRenderWindow_isOpen(WindowHandle) = sfTrue) do 94 | begin 95 | // Process events 96 | while (sfRenderWindow_pollEvent(WindowHandle, @Event) = sfTrue) do 97 | begin 98 | if Event.type_ = sfEvtClosed then 99 | sfRenderWindow_close(WindowHandle); 100 | end; 101 | 102 | sfShader_setFloatParameter(ShaderHandle, 'time', sfTime_asSeconds(sfClock_getElapsedTime(Clock)) ); 103 | 104 | MousePos := sfMouse_getPositionRenderWindow(WindowHandle); 105 | sfShader_setFloat2Parameter(ShaderHandle, 'mouse', MousePos.x / Mode.Width, 1 - MousePos.y / Mode.Height); 106 | 107 | // Draw the sprite with the shader on it 108 | sfRenderWindow_drawSprite(WindowHandle, SpriteHandle, @States); 109 | 110 | // Finally, display the rendered frame on screen 111 | sfRenderWindow_display(WindowHandle); 112 | end; 113 | 114 | sfSprite_destroy(SpriteHandle); 115 | sfRenderWindow_Destroy(WindowHandle); 116 | end. 117 | -------------------------------------------------------------------------------- /demos/Fire.pas: -------------------------------------------------------------------------------- 1 | program Fire; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses 6 | SysUtils, 7 | {$ifdef LINUX} 8 | Math, 9 | {$endif} 10 | ctypes, 11 | CSFMLConfig, 12 | CSFMLAudio, 13 | CSFMLGraphics, 14 | CSFMLNetwork, 15 | CSFMLSystem, 16 | CSFMLWindow; 17 | 18 | var 19 | FragmentShader: PChar; 20 | RenderTargetHandle: PsfRenderTexture; 21 | TextureHandle: PsfTexture; 22 | Mode: sfVideoMode; 23 | WindowHandle: PsfRenderWindow; 24 | Title: string; 25 | Event: sfEvent; 26 | States: sfRenderStates; 27 | ShaderHandle: PsfShader; 28 | SpriteHandle: PsfSprite; 29 | Clock: PsfClock; 30 | MousePos: sfVector2i; 31 | begin 32 | {$ifdef LINUX} 33 | SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow, exPrecision]); 34 | 35 | {$endif} 36 | States.BlendMode := sfBlendAlpha; 37 | States.Transform := sfTransform_identity; 38 | 39 | // Create the main Window 40 | Mode.width := 800; 41 | Mode.height := 600; 42 | Mode.bitsPerPixel := 32; 43 | Title := 'SFML Shader - ' + lowerCase({$I %FPCTARGETCPU%}) + '-' + lowerCase({$I %FPCTARGETOS%}); 44 | WindowHandle := sfRenderWindow_create(Mode, PChar(Title), sfUint32(sfTitleBar) or sfUint32(sfClose), nil); 45 | sfRenderWindow_setMouseCursorVisible(WindowHandle, sfFalse); // hide the cursor 46 | 47 | RenderTargetHandle := sfRenderTexture_create(Mode.width, Mode.height, sfFalse); 48 | TextureHandle := sfRenderTexture_getTexture(RenderTargetHandle); 49 | 50 | SpriteHandle := sfSprite_create(); 51 | sfSprite_setTexture(SpriteHandle, TextureHandle, sfFalse); 52 | 53 | FragmentShader := 54 | '#ifdef GL_ES'#10 + 55 | 'precision mediump float;'#10 + 56 | '#endif'#10 + 57 | ''#10 + 58 | 'uniform float time;'#10 + 59 | 'uniform vec2 mouse;'#10 + 60 | 'uniform vec2 resolution;'#10 + 61 | ''#10 + 62 | 'float snoise(vec3 uv, float res)'#10 + 63 | '{'#10 + 64 | ' const vec3 s = vec3(1e0, 1e2, 1e3);'#10 + 65 | ''#10 + 66 | ' uv *= res;'#10 + 67 | ''#10 + 68 | ' vec3 uv0 = floor(mod(uv, res))*s;'#10 + 69 | ' vec3 uv1 = floor(mod(uv+vec3(1.), res))*s;'#10 + 70 | ''#10 + 71 | ' vec3 f = fract(uv); f = f*f*(3.0-2.0*f);'#10 + 72 | ''#10 + 73 | ' vec4 v = vec4(uv0.x+uv0.y+uv0.z, uv1.x+uv0.y+uv0.z,'#10 + 74 | ' uv0.x+uv1.y+uv0.z, uv1.x+uv1.y+uv0.z);'#10 + 75 | ''#10 + 76 | ' vec4 r = fract(sin(v*1e-1)*1e3);'#10 + 77 | ' float r0 = mix(mix(r.x, r.y, f.x), mix(r.z, r.w, f.x), f.y);'#10 + 78 | ''#10 + 79 | ' r = fract(sin((v + uv1.z - uv0.z)*1e-1)*1e3);'#10 + 80 | ' float r1 = mix(mix(r.x, r.y, f.x), mix(r.z, r.w, f.x), f.y);'#10 + 81 | ' return mix(r0, r1, f.z)*2.-1.;'#10 + 82 | '}'#10 + 83 | ''#10 + 84 | 'void main( void ) {'#10 + 85 | ' vec2 p = gl_FragCoord.xy / resolution.xy;'#10 + 86 | ' p.x = p.x - mouse.x / resolution.x;'#10 + 87 | ' p.y = p.y + mouse.y / resolution.y;'#10 + 88 | ' p.y = p.y - 1.0;'#10 + 89 | ''#10 + 90 | ' p.x*=resolution.x/resolution.y;'#10 + 91 | ''#10 + 92 | ' float color = 3.0 - (6.*length(p));'#10 + 93 | ''#10 + 94 | ' vec3 coord = vec3(atan(p.x,p.y)/6.2832, length(p)*0.4, .5);'#10 + 95 | ''#10 + 96 | ' for(int i = 1; i <= 7; i++){'#10 + 97 | ' float power = pow(2.0, float(i));'#10 + 98 | ' color += (1.5 / power) * snoise(coord + vec3(0.,-time*.05, time*.01), power*16.);'#10 + 99 | ' }'#10 + 100 | ''#10 + 101 | ' gl_FragColor = vec4( color, pow(max(color,0.),2.)*0.4, pow(max(color,0.),3.)*0.15 , 1.0);'#10 + 102 | ''#10 + 103 | '}'; 104 | ShaderHandle := sfShader_createFromMemory(nil, nil, FragmentShader); 105 | States.Shader := ShaderHandle; 106 | 107 | sfShader_setFloat2Parameter(ShaderHandle, 'resolution', Mode.width, Mode.height); 108 | 109 | Clock := sfClock_create(); 110 | sfClock_restart(Clock); 111 | 112 | // Start the loop 113 | while (sfRenderWindow_isOpen(WindowHandle) = sfTrue) do 114 | begin 115 | // Process events 116 | while (sfRenderWindow_pollEvent(WindowHandle, @Event) = sfTrue) do 117 | begin 118 | if Event.type_ = sfEvtClosed then 119 | sfRenderWindow_close(WindowHandle); 120 | end; 121 | 122 | sfShader_setFloatParameter(ShaderHandle, 'time', sfTime_asSeconds(sfClock_getElapsedTime(Clock)) ); 123 | 124 | MousePos := sfMouse_getPositionRenderWindow(WindowHandle); 125 | sfShader_setFloat2Parameter(ShaderHandle, 'mouse', MousePos.x, MousePos.y); 126 | 127 | // Draw the sprite with the shader on it 128 | sfRenderWindow_drawSprite(WindowHandle, SpriteHandle, @States); 129 | 130 | // Finally, display the rendered frame on screen 131 | sfRenderWindow_display(WindowHandle); 132 | end; 133 | 134 | sfSprite_destroy(SpriteHandle); 135 | sfRenderWindow_Destroy(WindowHandle); 136 | end. 137 | -------------------------------------------------------------------------------- /demos/Ftp.pas: -------------------------------------------------------------------------------- 1 | program Ftp; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses 6 | SysUtils, 7 | ctypes, 8 | CSFMLConfig, 9 | CSFMLAudio, 10 | CSFMLGraphics, 11 | CSFMLNetwork, 12 | CSFMLSystem, 13 | CSFMLWindow; 14 | 15 | var 16 | Address: sfIpAddress; 17 | Server: PsfFtp; 18 | Response: PsfFtpResponse; 19 | DirectoryResponse: PsfFtpDirectoryResponse; 20 | ListingResponse: PsfFtpListingResponse; 21 | User, Password, FileName, Directory, Source, Destination: string; 22 | Index, Choice: cint; 23 | begin 24 | // Choose the server address 25 | repeat 26 | Write('Enter the FTP server address [127.0.0.1]: '); 27 | ReadLn(Address.address); 28 | if (Address.address = '') then Address.address := '127.0.0.1'; 29 | until (Address.address <> sfIpAddress_None.address); 30 | 31 | Server := sfFtp_create(); 32 | 33 | // Connect to the server 34 | Response := sfFtp_connect(Server, Address, 21, sfTime_Zero); 35 | if not (sfFtpResponse_isOk(Response) = sfTrue) then exit; 36 | WriteLn(string(sfFtpResponse_getMessage(Response))); 37 | WriteLn(''); 38 | 39 | // Ask for user name and password 40 | Write('User name: '); 41 | ReadLn(User); 42 | Write('Password: '); 43 | ReadLn(Password); 44 | 45 | // Login to the server 46 | Response := sfFtp_login(Server, PChar(User), PChar(Password)); 47 | if not (sfFtpResponse_isOk(Response) = sfTrue) then exit; 48 | WriteLn(string(sfFtpResponse_getMessage(Response))); 49 | WriteLn(''); 50 | 51 | // Main menu 52 | repeat 53 | // Main FTP menu 54 | WriteLn('Choose an action:'); 55 | WriteLn('1. Print working directory'); 56 | WriteLn('2. Print contents of working directory'); 57 | WriteLn('3. Change directory'); 58 | WriteLn('4. Create directory'); 59 | WriteLn('5. Delete directory'); 60 | WriteLn('6. Rename file'); 61 | WriteLn('7. Remove file'); 62 | WriteLn('8. Download file'); 63 | WriteLn('9. Upload file'); 64 | WriteLn('0. Disconnect'); 65 | WriteLn(''); 66 | Write('Your choice: '); 67 | ReadLn(Choice); 68 | WriteLn(''); 69 | 70 | case Choice of 71 | 0:; 72 | 1: 73 | begin 74 | // Print the current server directory 75 | DirectoryResponse := sfFtp_getWorkingDirectory(Server); 76 | WriteLn(string(sfFtpDirectoryResponse_getMessage(DirectoryResponse))); 77 | WriteLn('Current directory is ', string(sfFtpDirectoryResponse_getDirectory(DirectoryResponse))); 78 | sfFtpDirectoryResponse_destroy(DirectoryResponse); 79 | end; 80 | 2: 81 | begin 82 | // Print the contents of the current server directory 83 | ListingResponse := sfFtp_getDirectoryListing(Server, nil); 84 | for Index := 0 to sfFtpListingResponse_getCount(ListingResponse) - 1 do 85 | WriteLn(string(sfFtpListingResponse_getName(ListingResponse, Index))); 86 | sfFtpListingResponse_destroy(ListingResponse); 87 | end; 88 | 3: 89 | begin 90 | // Change the current directory 91 | Write('Choose a directory: '); 92 | ReadLn(Directory); 93 | Response := sfFtp_changeDirectory(Server, PChar(Directory)); 94 | WriteLn(string(sfFtpResponse_getMessage(Response))); 95 | end; 96 | 4: 97 | begin 98 | // Create a new directory 99 | Write('Name of the directory to create: '); 100 | ReadLn(Directory); 101 | Response := sfFtp_createDirectory(Server, PChar(Directory)); 102 | WriteLn(string(sfFtpResponse_getMessage(Response))); 103 | end; 104 | 5: 105 | begin 106 | // Remove an existing directory 107 | Write('Name of the directory to remove: '); 108 | ReadLn(Directory); 109 | Response := sfFtp_deleteDirectory(Server, PChar(Directory)); 110 | WriteLn(string(sfFtpResponse_getMessage(Response))); 111 | end; 112 | 6: 113 | begin 114 | // Rename a file 115 | Write('Name of the file to rename: '); 116 | ReadLn(Source); 117 | Write('New name: '); 118 | ReadLn(Destination); 119 | Response := sfFtp_renameFile(Server, PChar(Source), PChar(Destination)); 120 | WriteLn(string(sfFtpResponse_getMessage(Response))); 121 | end; 122 | 7: 123 | begin 124 | // Remove an existing directory 125 | Write('Name of the file to remove: '); 126 | ReadLn(Filename); 127 | Response := sfFtp_deleteFile(Server, PChar(Filename)); 128 | WriteLn(string(sfFtpResponse_getMessage(Response))); 129 | end; 130 | 8: 131 | begin 132 | // Download a file from server 133 | Write('Filename of the file to download (relative to current directory): '); 134 | ReadLn(Filename); 135 | Write('Directory to download the file to: '); 136 | ReadLn(Directory); 137 | Response := sfFtp_download(Server, PChar(Filename), PChar(Directory), sfFtpBinary); 138 | WriteLn(string(sfFtpResponse_getMessage(Response))); 139 | end; 140 | 9: 141 | begin 142 | // Upload a file to server 143 | Write('Path of the file to upload (absolute or relative to working directory): '); 144 | ReadLn(Filename); 145 | Write('Directory to upload the file to (relative to current directory): '); 146 | ReadLn(Directory); 147 | Response := sfFtp_upload(Server, PChar(Filename), PChar(Directory), sfFtpBinary, sfFalse); 148 | WriteLn(string(sfFtpResponse_getMessage(Response))); 149 | end; 150 | else 151 | begin 152 | // Wrong choice 153 | WriteLn('Invalid choice!'); 154 | end; 155 | end; 156 | until Choice = 0; 157 | 158 | // Disconnect from the server 159 | WriteLn('Disconnecting from server...'); 160 | Response := sfFtp_disconnect(Server); 161 | WriteLn(string(sfFtpResponse_getMessage(Response))); 162 | 163 | // Wait until the user presses 'enter' key 164 | Write('Press enter to exit...'); 165 | ReadLn; 166 | end. 167 | -------------------------------------------------------------------------------- /demos/HelloWorld.pas: -------------------------------------------------------------------------------- 1 | program HelloWorld; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses 6 | SysUtils, 7 | {$ifdef LINUX} 8 | Math, 9 | {$endif} 10 | ctypes, 11 | CSFMLConfig, 12 | CSFMLAudio, 13 | CSFMLGraphics, 14 | CSFMLNetwork, 15 | CSFMLSystem, 16 | CSFMLWindow; 17 | 18 | var 19 | Mode: sfVideoMode; 20 | Window: PsfRenderWindow; 21 | Title: string; 22 | Texture: PsfTexture; 23 | Sprite: PsfSprite; 24 | Font: PsfFont; 25 | Text: PsfText; 26 | Music: PsfMusic; 27 | Event: sfEvent; 28 | TextPos: sfVector2f; 29 | begin 30 | {$ifdef LINUX} 31 | SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow, exPrecision]); 32 | 33 | {$endif} 34 | Mode.Width := 800; 35 | Mode.Height := 600; 36 | Mode.BitsPerPixel := 32; 37 | 38 | Title := 'SFML Window - ' + lowerCase({$I %FPCTARGETCPU%}) + '-' + lowerCase({$I %FPCTARGETOS%}); 39 | Window := sfRenderWindow_Create(Mode, PChar(Title), sfUint32(sfResize) or sfUint32(sfClose), nil); 40 | if not Assigned(Window) then 41 | raise Exception.Create('Window error'); 42 | 43 | // Load a sprite to display 44 | Texture := sfTexture_CreateFromFile('../resources/oncapintada.jpg', nil); 45 | if not Assigned(Texture) then 46 | raise Exception.Create('Texture error'); 47 | Sprite := sfSprite_Create(); 48 | sfSprite_SetTexture(Sprite, Texture, sfTrue); 49 | 50 | // Create a graphical text to display 51 | Font := sfFont_createFromFile('../resources/admirationpains.ttf'); 52 | if not Assigned(Font) then 53 | raise Exception.Create('Font error'); 54 | Text := sfText_Create(); 55 | 56 | sfText_SetString(Text, 'Hello World'); 57 | sfText_SetFont(Text, Font); 58 | sfText_SetCharacterSize(Text, 50); 59 | sfText_SetColor(Text, sfBlack); 60 | TextPos.X := 300; 61 | TextPos.Y := 20; 62 | sfText_SetPosition(Text, TextPos); 63 | 64 | // Load a music to play 65 | Music := sfMusic_CreateFromFile('../resources/oncapintada.ogg'); 66 | if not Assigned(Music) then 67 | raise Exception.Create('Music error'); 68 | 69 | // Play the music 70 | sfMusic_Play(Music); 71 | 72 | // Start the game loop 73 | while (sfRenderWindow_IsOpen(Window) = sfTrue) do 74 | begin 75 | // Process events 76 | while (sfRenderWindow_PollEvent(Window, @Event) = sfTrue) do 77 | begin 78 | // Close window : exit 79 | if (Event.type_ = sfEvtClosed) then 80 | sfRenderWindow_Close(Window); 81 | end; 82 | 83 | // Clear the screen 84 | sfRenderWindow_clear(Window, sfWhite); 85 | 86 | // Draw the sprite 87 | sfRenderWindow_drawSprite(Window, Sprite, nil); 88 | 89 | // Draw the text 90 | sfRenderWindow_drawText(Window, Text, nil); 91 | 92 | // Update the window 93 | sfRenderWindow_display(Window); 94 | end; 95 | 96 | // Cleanup resources 97 | sfMusic_Destroy(Music); 98 | sfText_Destroy(Text); 99 | sfFont_Destroy(Font); 100 | sfSprite_Destroy(Sprite); 101 | sfTexture_Destroy(Texture); 102 | sfRenderWindow_Destroy(Window); 103 | end. 104 | -------------------------------------------------------------------------------- /demos/Lights.pas: -------------------------------------------------------------------------------- 1 | program Lights; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses 6 | SysUtils, 7 | {$ifdef LINUX} 8 | Math, 9 | {$endif} 10 | ctypes, 11 | CSFMLConfig, 12 | CSFMLAudio, 13 | CSFMLGraphics, 14 | CSFMLNetwork, 15 | CSFMLSystem, 16 | CSFMLWindow; 17 | 18 | var 19 | FragmentShader: PChar; 20 | RenderTargetHandle: PsfRenderTexture; 21 | TextureHandle: PsfTexture; 22 | Mode: sfVideoMode; 23 | WindowHandle: PsfRenderWindow; 24 | Title: string; 25 | Event: sfEvent; 26 | States: sfRenderStates; 27 | ShaderHandle: PsfShader; 28 | SpriteHandle: PsfSprite; 29 | Clock: PsfClock; 30 | MousePos: sfVector2i; 31 | begin 32 | {$ifdef LINUX} 33 | SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow, exPrecision]); 34 | 35 | {$endif} 36 | States.BlendMode := sfBlendAlpha; 37 | States.Transform := sfTransform_identity; 38 | 39 | FragmentShader := 40 | '#ifdef GL_ES'#10 + 41 | 'precision mediump float;'#10 + 42 | '#endif'#10 + 43 | ''#10 + 44 | 'uniform float time;'#10 + 45 | 'uniform vec2 mouse;'#10 + 46 | 'uniform vec2 resolution;'#10 + 47 | ''#10 + 48 | 'vec2 position;'#10 + 49 | ''#10 + 50 | 'vec3 ball(vec3 colour, float sizec, float xc, float yc){'#10 + 51 | ' return colour * (sizec / distance(position, vec2(xc, yc)));'#10 + 52 | '}'#10 + 53 | ''#10 + 54 | 'vec3 red = vec3(2, 1, 1);'#10 + 55 | 'vec3 green = vec3(1, 2, 1);'#10 + 56 | 'vec3 blue = vec3(2, 2, 3);'#10 + 57 | 'void main( void ) {'#10 + 58 | ''#10 + 59 | ' position = ( gl_FragCoord.xy / resolution.xy );'#10 + 60 | ' position.y = position.y * resolution.y/resolution.x + 0.25;'#10 + 61 | ' vec2 mousepos = mouse;'#10 + 62 | ' mousepos.y = mouse.y * resolution.y/resolution.x + 0.25;'#10 + 63 | ''#10 + 64 | ' vec3 color = vec3(0.0);'#10 + 65 | ' float ratio = resolution.x / resolution.y;'#10 + 66 | ' color += ball(red, 0.01, sin(time*4.0) / 12.0 + 0.5, cos(time*4.0) / 6.0 + 0.5);'#10 + 67 | ' color += ball(green, 0.01, sin(time*4.0) / 6.0 + 0.5, cos(time*4.0) / 12.0 + 0.5);'#10 + 68 | ' color += ball(blue, 0.01, mousepos.x, mousepos.y);'#10 + 69 | ' gl_FragColor = vec4(color, 1.0 );'#10 + 70 | ''#10 + 71 | '}'; 72 | ShaderHandle := sfShader_createFromMemory(nil, nil, FragmentShader); 73 | States.Shader := ShaderHandle; 74 | 75 | RenderTargetHandle := sfRenderTexture_create(800, 600, sfFalse); 76 | TextureHandle := sfRenderTexture_getTexture(RenderTargetHandle); 77 | 78 | SpriteHandle := sfSprite_create(); 79 | sfSprite_setTexture(SpriteHandle, TextureHandle, sfFalse); 80 | 81 | // Create the main Window 82 | Mode.Width := 800; 83 | Mode.Height := 600; 84 | Mode.BitsPerPixel := 32; 85 | Title := 'SFML Shader - ' + lowerCase({$I %FPCTARGETCPU%}) + '-' + lowerCase({$I %FPCTARGETOS%}); 86 | WindowHandle := sfRenderWindow_create(Mode, PChar(Title), sfUint32(sfTitleBar) or sfUint32(sfClose), nil); 87 | 88 | sfShader_setFloat2Parameter(ShaderHandle, 'resolution', Mode.Width, Mode.Height); 89 | 90 | Clock := sfClock_create(); 91 | sfClock_restart(Clock); 92 | 93 | // Start the loop 94 | while (sfRenderWindow_isOpen(WindowHandle) = sfTrue) do 95 | begin 96 | // Process events 97 | while (sfRenderWindow_pollEvent(WindowHandle, @Event) = sfTrue) do 98 | begin 99 | if Event.type_ = sfEvtClosed then 100 | sfRenderWindow_close(WindowHandle); 101 | end; 102 | 103 | MousePos := sfMouse_getPositionRenderWindow(WindowHandle); 104 | sfShader_setFloat2Parameter(ShaderHandle, 'mouse', MousePos.x / Mode.Width, 1 - MousePos.y / Mode.Height); 105 | 106 | sfShader_setFloatParameter(ShaderHandle, 'time', sfTime_asSeconds(sfClock_getElapsedTime(Clock)) ); 107 | 108 | // Draw the sprite with the shader on it 109 | sfRenderWindow_drawSprite(WindowHandle, SpriteHandle, @States); 110 | 111 | // Finally, display the rendered frame on screen 112 | sfRenderWindow_display(WindowHandle); 113 | end; 114 | 115 | sfSprite_destroy(SpriteHandle); 116 | sfRenderWindow_Destroy(WindowHandle); 117 | end. 118 | -------------------------------------------------------------------------------- /demos/Plasma.pas: -------------------------------------------------------------------------------- 1 | program Plasma; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses 6 | SysUtils, 7 | {$ifdef LINUX} 8 | Math, 9 | {$endif} 10 | ctypes, 11 | CSFMLConfig, 12 | CSFMLAudio, 13 | CSFMLGraphics, 14 | CSFMLNetwork, 15 | CSFMLSystem, 16 | CSFMLWindow; 17 | 18 | var 19 | FragmentShader: PChar; 20 | RenderTargetHandle: PsfRenderTexture; 21 | TextureHandle: PsfTexture; 22 | Mode: sfVideoMode; 23 | WindowHandle: PsfRenderWindow; 24 | Title: string; 25 | Event: sfEvent; 26 | States: sfRenderStates; 27 | ShaderHandle: PsfShader; 28 | SpriteHandle: PsfSprite; 29 | Clock: PsfClock; 30 | MousePos: sfVector2i; 31 | begin 32 | {$ifdef LINUX} 33 | SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow, exPrecision]); 34 | 35 | {$endif} 36 | States.BlendMode := sfBlendAlpha; 37 | States.Transform := sfTransform_identity; 38 | 39 | FragmentShader := 40 | '#ifdef GL_ES'#10 + 41 | 'precision mediump float;'#10 + 42 | '#endif'#10 + 43 | ''#10 + 44 | '#extension GL_OES_standard_derivatives : enable'#10 + 45 | ''#10 + 46 | 'uniform float time;'#10 + 47 | 'uniform vec2 mouse;'#10 + 48 | 'uniform vec2 resolution;'#10 + 49 | ''#10 + 50 | 'void main( void ) {'#10 + 51 | ''#10 + 52 | ' vec2 position = ( gl_FragCoord.xy / resolution.xy ) + mouse / 4.0;'#10 + 53 | ''#10 + 54 | ' float color = 0.0;'#10 + 55 | ' color += sin( position.x * cos( time / 15.0 ) * 4.0 ) + cos( position.y * cos( time / 15.0 ) * 10.0 );'#10 + 56 | ' color += sin( position.y * sin( time / 10.0 ) * 40.0 ) + cos( position.x * sin( time / 25.0 ) * 40.0 );'#10 + 57 | ' color += sin( position.x * sin( time / 5.0 ) * 10.0 ) + sin( position.y * sin( time / 35.0 ) * 80.0 );'#10 + 58 | ' color *= sin( time / 10.0 ) * 0.5;'#10 + 59 | ''#10 + 60 | ' gl_FragColor = vec4( vec3( color, color * 0.8, sin( color + time / 3.0 ) * 0.75 ), 1.0 );'#10 + 61 | ''#10 + 62 | '}'; 63 | ShaderHandle := sfShader_createFromMemory(nil, nil, FragmentShader); 64 | States.Shader := ShaderHandle; 65 | 66 | RenderTargetHandle := sfRenderTexture_create(800, 600, sfFalse); 67 | TextureHandle := sfRenderTexture_getTexture(RenderTargetHandle); 68 | 69 | SpriteHandle := sfSprite_create(); 70 | sfSprite_setTexture(SpriteHandle, TextureHandle, sfFalse); 71 | 72 | // Create the main Window 73 | Mode.Width := 800; 74 | Mode.Height := 600; 75 | Mode.BitsPerPixel := 32; 76 | Title := 'SFML Shader - ' + lowerCase({$I %FPCTARGETCPU%}) + '-' + lowerCase({$I %FPCTARGETOS%}); 77 | WindowHandle := sfRenderWindow_create(Mode, PChar(Title), sfUint32(sfTitleBar) or sfUint32(sfClose), nil); 78 | 79 | sfShader_setFloat2Parameter(ShaderHandle, 'resolution', Mode.Width, Mode.Height); 80 | 81 | Clock := sfClock_create(); 82 | sfClock_restart(Clock); 83 | 84 | // Start the loop 85 | while (sfRenderWindow_isOpen(WindowHandle) = sfTrue) do 86 | begin 87 | // Process events 88 | while (sfRenderWindow_pollEvent(WindowHandle, @Event) = sfTrue) do 89 | begin 90 | if Event.type_ = sfEvtClosed then 91 | sfRenderWindow_close(WindowHandle); 92 | end; 93 | 94 | MousePos := sfMouse_getPositionRenderWindow(WindowHandle); 95 | sfShader_setFloat2Parameter(ShaderHandle, 'mouse', MousePos.x / Mode.Width, 1 - MousePos.y / Mode.Height); 96 | 97 | sfShader_setFloatParameter(ShaderHandle, 'time', sfTime_asSeconds(sfClock_getElapsedTime(Clock)) ); 98 | 99 | // Draw the sprite with the shader on it 100 | sfRenderWindow_drawSprite(WindowHandle, SpriteHandle, @States); 101 | 102 | // Finally, display the rendered frame on screen 103 | sfRenderWindow_display(WindowHandle); 104 | end; 105 | 106 | sfSprite_destroy(SpriteHandle); 107 | sfRenderWindow_Destroy(WindowHandle); 108 | end. 109 | -------------------------------------------------------------------------------- /demos/Sky.pas: -------------------------------------------------------------------------------- 1 | program Sky; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses 6 | SysUtils, 7 | {$ifdef LINUX} 8 | Math, 9 | {$endif} 10 | ctypes, 11 | CSFMLConfig, 12 | CSFMLAudio, 13 | CSFMLGraphics, 14 | CSFMLNetwork, 15 | CSFMLSystem, 16 | CSFMLWindow; 17 | 18 | var 19 | FragmentShader: PChar; 20 | RenderTargetHandle: PsfRenderTexture; 21 | TextureHandle: PsfTexture; 22 | Mode: sfVideoMode; 23 | WindowHandle: PsfRenderWindow; 24 | Title: string; 25 | Event: sfEvent; 26 | States: sfRenderStates; 27 | ShaderHandle: PsfShader; 28 | SpriteHandle: PsfSprite; 29 | Clock: PsfClock; 30 | begin 31 | {$ifdef LINUX} 32 | SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow, exPrecision]); 33 | 34 | {$endif} 35 | States.BlendMode := sfBlendAlpha; 36 | States.Transform := sfTransform_identity; 37 | 38 | FragmentShader := 39 | '#ifdef GL_ES'#10 + 40 | 'precision mediump float;'#10 + 41 | '#endif'#10 + 42 | '/// Compack code for a 1K demo // Harley'#10 + 43 | 'uniform float time;'#10 + 44 | 'uniform vec2 resolution;'#10 + 45 | ''#10 + 46 | 'mat2 m = mat2( 0.90, 0.110, -0.70, 1.00 );'#10 + 47 | ''#10 + 48 | 'float ha( float n ) {return fract(sin(n)*758.5453);}'#10 + 49 | ''#10 + 50 | 'float no( in vec3 x )'#10 + 51 | '{ vec3 p = floor(x); vec3 f = fract(x);'#10 + 52 | ' float n = p.x + p.y*57.0 + p.z*800.0;float res = mix(mix(mix( ha(n+ 0.0), ha(n+ 1.0),f.x), mix( ha(n+ 57.0), ha(n+ 58.0),f.x),f.y),'#10 + 53 | ' mix(mix( ha(n+800.0), ha(n+801.0),f.x), mix( ha(n+857.0), ha(n+858.0),f.x),f.y),f.z);'#10 + 54 | ' return res;}'#10 + 55 | ''#10 + 56 | 'float fbm( vec3 p )'#10 + 57 | '{ float f = 0.3*cos(time*0.03);'#10 + 58 | ' f += 0.50000*no( p ); p = p*2.02; f -= 0.25000*no( p ); p = p*2.03;'#10 + 59 | ' f += 0.12500*no( p ); p = p*2.01; f += 0.06250*no( p ); p = p*2.04;'#10 + 60 | ' f -= 0.03125*no( p ); return f/0.984375;}'#10 + 61 | ''#10 + 62 | 'float cloud(vec3 p)'#10 + 63 | '{ p-=fbm(vec3(p.x,p.y,0.0)*0.5)*2.25;float a =0.0; a-=fbm(p*3.0)*2.2-1.1;'#10 + 64 | ' if (a<0.0) a=0.0;a=a*a; return a;}'#10 + 65 | ''#10 + 66 | 'vec3 f2(vec3 c)'#10 + 67 | '{ c+=ha(gl_FragCoord.x+gl_FragCoord.y*.9)*0.01;'#10 + 68 | ' c*=0.7-length(gl_FragCoord.xy / resolution.xy -0.5)*0.7;'#10 + 69 | ' float w=length(c);'#10 + 70 | ' c=mix(c*vec3(1.0,1.0,1.6),vec3(w,w,w)*vec3(1.4,1.2,1.0),w*1.1-0.2);'#10 + 71 | ' return c;}'#10 + 72 | 'void main( void ) {'#10 + 73 | ' vec2 position = ( gl_FragCoord.xy / resolution.xy ) ;'#10 + 74 | ' position.y+=0.2; vec2 coord= vec2((position.x-0.5)/position.y,1.0/(position.y+0.2));'#10 + 75 | ' coord+=time*0.1; float q = cloud(vec3(coord*1.0,0.222));'#10 + 76 | 'vec3 col =vec3(0.2,0.4,0.5) + vec3(q*vec3(0.2,0.4,0.1));'#10 + 77 | ' gl_FragColor = vec4( f2(col), 1.0 );'#10 + 78 | '}'; 79 | ShaderHandle := sfShader_createFromMemory(nil, nil, FragmentShader); 80 | States.Shader := ShaderHandle; 81 | 82 | RenderTargetHandle := sfRenderTexture_create(800, 600, sfFalse); 83 | TextureHandle := sfRenderTexture_getTexture(RenderTargetHandle); 84 | 85 | SpriteHandle := sfSprite_create(); 86 | sfSprite_setTexture(SpriteHandle, TextureHandle, sfFalse); 87 | 88 | // Create the main Window 89 | Mode.Width := 800; 90 | Mode.Height := 600; 91 | Mode.BitsPerPixel := 32; 92 | Title := 'SFML Shader - ' + lowerCase({$I %FPCTARGETCPU%}) + '-' + lowerCase({$I %FPCTARGETOS%}); 93 | WindowHandle := sfRenderWindow_create(Mode, PChar(Title), sfUint32(sfTitleBar) or sfUint32(sfClose), nil); 94 | 95 | sfShader_setFloat2Parameter(ShaderHandle, 'resolution', Mode.Width, Mode.Height); 96 | 97 | Clock := sfClock_create(); 98 | sfClock_restart(Clock); 99 | 100 | // Start the loop 101 | while (sfRenderWindow_isOpen(WindowHandle) = sfTrue) do 102 | begin 103 | // Process events 104 | while (sfRenderWindow_pollEvent(WindowHandle, @Event) = sfTrue) do 105 | begin 106 | if Event.type_ = sfEvtClosed then 107 | sfRenderWindow_close(WindowHandle); 108 | end; 109 | 110 | sfShader_setFloatParameter(ShaderHandle, 'time', sfTime_asSeconds(sfClock_getElapsedTime(Clock)) ); 111 | 112 | // Draw the sprite with the shader on it 113 | sfRenderWindow_drawSprite(WindowHandle, SpriteHandle, @States); 114 | 115 | // Finally, display the rendered frame on screen 116 | sfRenderWindow_display(WindowHandle); 117 | end; 118 | 119 | sfSprite_destroy(SpriteHandle); 120 | sfRenderWindow_Destroy(WindowHandle); 121 | end. 122 | -------------------------------------------------------------------------------- /demos/Sound.pas: -------------------------------------------------------------------------------- 1 | program Sound; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses 6 | SysUtils, 7 | ctypes, 8 | CSFMLConfig, 9 | CSFMLAudio, 10 | CSFMLGraphics, 11 | CSFMLNetwork, 12 | CSFMLSystem, 13 | CSFMLWindow; 14 | 15 | procedure PlaySound; 16 | var 17 | SoundBuffer: PsfSoundBuffer; 18 | Sound: PsfSound; 19 | begin 20 | // Load a sound buffer from a wav file 21 | SoundBuffer := sfSoundBuffer_createFromFile('../resources/canary.wav'); 22 | 23 | // Display sound informations 24 | WriteLn('Canary.wav:'); 25 | WriteLn(' ', FloatToStr(sfTime_asSeconds( sfSoundBuffer_getDuration(SoundBuffer))), ' seconds'); 26 | WriteLn(' ', IntToStr(sfSoundBuffer_getSampleRate(SoundBuffer)), ' samples / sec'); 27 | WriteLn(' ', IntToStr(sfSoundBuffer_getChannelCount(SoundBuffer)), ' channels'); 28 | 29 | // Create a sound instance and play it 30 | Sound := sfSound_create(); 31 | sfSound_setBuffer(Sound, SoundBuffer); 32 | sfSound_play(Sound); 33 | 34 | // Loop while the sound is playing 35 | while sfSound_getStatus(Sound) = sfPlaying do 36 | begin 37 | // Display the playing position 38 | WriteLn('Playing... ', FloatToStr(sfTime_asSeconds(sfSound_getPlayingOffset(Sound))), ' sec'); 39 | 40 | // Leave some CPU time for other processes 41 | sfSleep(sfMilliseconds(100)); 42 | end; 43 | WriteLn; 44 | 45 | sfSound_destroy(Sound); 46 | sfSoundBuffer_destroy(SoundBuffer); 47 | end; 48 | 49 | procedure PlayMusic(FileName: String); 50 | var 51 | Music: PsfMusic; 52 | begin 53 | // Load an ogg music file 54 | Music := sfMusic_createFromFile(PChar('../resources/' + FileName)); 55 | 56 | // Display music informations 57 | WriteLn(FileName + ':'); 58 | WriteLn(' ', FloatToStr(sfTime_asSeconds(sfMusic_getDuration(Music))), ' seconds'); 59 | WriteLn(' ', IntToStr(sfMusic_getSampleRate(Music)), ' samples / sec'); 60 | WriteLn(' ', IntToStr(sfMusic_getChannelCount(Music)), ' channels'); 61 | 62 | // Play it 63 | sfMusic_play(Music); 64 | 65 | // Loop while the music is playing 66 | while sfMusic_getStatus(Music) = sfPlaying do 67 | begin 68 | // Display the playing position 69 | WriteLn('Playing... ', FloatToStr(sfTime_asSeconds(sfMusic_getPlayingOffset(Music))), ' sec'); 70 | 71 | // Leave some CPU time for other processes 72 | sfSleep(sfMilliseconds(100)); 73 | end; 74 | WriteLn; 75 | 76 | sfMusic_destroy(Music); 77 | end; 78 | 79 | begin 80 | // Play a sound 81 | PlaySound; 82 | 83 | // Play music from an ogg file 84 | PlayMusic('orchestral.ogg'); 85 | 86 | // Play music from a flac file 87 | PlayMusic('ding.flac'); 88 | 89 | // Wait until the user presses 'enter' key 90 | Write('Press enter to exit...'); 91 | ReadLn; 92 | end. 93 | -------------------------------------------------------------------------------- /demos/SoundCapture.pas: -------------------------------------------------------------------------------- 1 | program SoundCapture; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses 6 | SysUtils, 7 | ctypes, 8 | CSFMLConfig, 9 | CSFMLAudio, 10 | CSFMLGraphics, 11 | CSFMLNetwork, 12 | CSFMLSystem, 13 | CSFMLWindow; 14 | 15 | var 16 | SampleRate: cint; 17 | Recorder: PsfSoundBufferRecorder; 18 | Buffer: PsfSoundBuffer; 19 | Choice: Char; 20 | FileName: string; 21 | Sound: PsfSound; 22 | 23 | begin 24 | // Check that the device can capture audio 25 | if not (sfSoundRecorder_isAvailable() = sfTrue) then 26 | begin 27 | WriteLn('Sorry, audio capture is not supported by your system'); 28 | Halt; 29 | end; 30 | 31 | // Choose the sample rate 32 | Write('Please choose the sample rate for sound capture (44100 is CD quality): '); 33 | ReadLn(SampleRate); 34 | 35 | // Wait for user input... 36 | WriteLn('Press enter to start recording audio'); 37 | ReadLn; 38 | 39 | // Here we'll use an integrated custom recorder, which saves the captured data into a SoundBuffer 40 | Recorder := sfSoundBufferRecorder_create(); 41 | 42 | // Audio capture is done in a separate thread, so we can block the main thread while it is capturing 43 | if (sfSoundBufferRecorder_start(Recorder, SampleRate) = sfFalse) then 44 | begin 45 | WriteLn('Recording failed!'); 46 | sfSoundBufferRecorder_destroy(Recorder); 47 | Halt; 48 | end; 49 | WriteLn('Recording... press enter to stop'); 50 | ReadLn; 51 | sfSoundBufferRecorder_stop(Recorder); 52 | 53 | // Get the buffer containing the captured data 54 | Buffer := sfSoundBufferRecorder_getBuffer(Recorder); 55 | 56 | // Display captured sound informations 57 | WriteLn('Sound information:'); 58 | WriteLn(' ', sfTime_asSeconds(sfSoundBuffer_getDuration(Buffer)), ' seconds'); 59 | WriteLn(' ', sfSoundBuffer_getSampleRate(Buffer), ' samples / seconds'); 60 | WriteLn(' ', sfSoundBuffer_getChannelCount(Buffer), ' channels'); 61 | 62 | // Choose what to do with the recorded sound data 63 | Write('What do you want to do with captured sound (p = play, s = save)? '); 64 | ReadLn(Choice); 65 | 66 | if Choice = 's' then 67 | begin 68 | // Choose the filename 69 | WriteLn('Choose the file to create:'); 70 | ReadLn(FileName); 71 | 72 | // Save the buffer 73 | sfSoundBuffer_saveToFile(Buffer, PChar(FileName)); 74 | end 75 | else 76 | begin 77 | // Create a sound instance and play it 78 | Sound := sfSound_create(); 79 | sfSound_setBuffer(Sound, Buffer); 80 | sfSound_play(Sound); 81 | 82 | // Wait until finished 83 | while sfSound_getStatus(Sound) = sfPlaying do 84 | begin 85 | // Display the playing position 86 | WriteLn('Playing... ', sfTime_asSeconds(sfSound_getPlayingOffset(Sound)), ' sec'); 87 | 88 | // Leave some CPU time for other threads 89 | sfSleep(sfMilliseconds(100)); 90 | end; 91 | 92 | sfSound_destroy(Sound); 93 | end; 94 | 95 | // Finished! 96 | WriteLn('Done!'); 97 | 98 | sfSoundBufferRecorder_destroy(Recorder); 99 | 100 | // Wait until the user presses 'enter' key 101 | Write('Press enter to exit...'); 102 | ReadLn; 103 | end. 104 | -------------------------------------------------------------------------------- /demos/Win.pas: -------------------------------------------------------------------------------- 1 | program Win; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses 6 | SysUtils, 7 | Windows, 8 | Messages, 9 | ctypes, 10 | CSFMLConfig, 11 | CSFMLAudio, 12 | CSFMLGraphics, 13 | CSFMLNetwork, 14 | CSFMLSystem, 15 | CSFMLWindow; 16 | 17 | var 18 | Button: HWND; 19 | 20 | function OnEvent(Handle: HWND; &Message: Cardinal; WParam: WPARAM; 21 | LParam: LPARAM): LRESULT; stdcall; 22 | begin 23 | Result := 0; 24 | case (message) of 25 | // Quit when we close the main Window 26 | WM_CLOSE: 27 | begin 28 | PostQuitMessage(0); 29 | Exit; 30 | end; 31 | 32 | // Quit when we click the "quit" button 33 | WM_COMMAND: 34 | if HWND(lParam) = Button then 35 | begin 36 | PostQuitMessage(0); 37 | Exit; 38 | end; 39 | end; 40 | 41 | Result := DefWindowProc(Handle, Message, WParam, LParam); 42 | end; 43 | 44 | var 45 | WindowClass: WNDCLASS; 46 | Window: HWND; 47 | Title: string; 48 | View1, View2: HWND; 49 | SfmlView1, SfmlView2: PsfRenderWindow; 50 | Texture1, Texture2: PsfTexture; 51 | Sprite1, Sprite2: PsfSprite; 52 | Origin: sfVector2f; 53 | Position: sfVector2f; 54 | Clock: PsfClock; 55 | &Message: MSG; 56 | Time: Single; 57 | begin 58 | // Define a class for our main Window 59 | WindowClass.style := 0; 60 | WindowClass.lpfnWndProc := @OnEvent; 61 | WindowClass.cbClsExtra := 0; 62 | WindowClass.cbWndExtra := 0; 63 | WindowClass.hInstance := hInstance; 64 | WindowClass.hIcon := 0; 65 | WindowClass.hCursor := 0; 66 | WindowClass.hbrBackground := HBRUSH(COLOR_BACKGROUND); 67 | WindowClass.lpszMenuName := nil; 68 | WindowClass.lpszClassName := 'SFML App'; 69 | RegisterClass(WindowClass); 70 | 71 | // Let's create the main window 72 | Title := 'SFML Win - ' + lowerCase({$I %FPCTARGETCPU%}) + '-' + lowerCase({$I %FPCTARGETOS%}); 73 | Window := CreateWindow('SFML App', PChar(Title), WS_SYSMENU or WS_VISIBLE, 200, 200, 660, 520, 0, 0, hInstance, nil); 74 | 75 | // Add a button for exiting 76 | Button := CreateWindow('BUTTON', 'Quit', WS_CHILD or WS_VISIBLE, 560, 440, 80, 40, Window, 0, hInstance, nil); 77 | 78 | // Let's create two SFML views 79 | View1 := CreateWindow('STATIC', nil, WS_CHILD or WS_VISIBLE or WS_CLIPSIBLINGS, 20, 20, 300, 400, Window, 0, hInstance, nil); 80 | View2 := CreateWindow('STATIC', nil, WS_CHILD or WS_VISIBLE or WS_CLIPSIBLINGS, 340, 20, 300, 400, Window, 0, hInstance, nil); 81 | SfmlView1 := sfRenderWindow_createFromHandle(pointer(View1), nil); 82 | SfmlView2 := sfRenderWindow_createFromHandle(pointer(View2), nil); 83 | 84 | // Load some textures to display 85 | Texture1 := sfTexture_createFromFile('../resources/image1.jpg', nil); 86 | Texture2 := sfTexture_createFromFile('../resources/image2.jpg', nil); 87 | Sprite1 := sfSprite_create(); 88 | sfSprite_setTexture(Sprite1, Texture1, sfFalse); 89 | Sprite2 := sfSprite_create(); 90 | sfSprite_setTexture(Sprite2, Texture2, sfFalse); 91 | 92 | Origin.x := sfTexture_getSize(Texture1).x; 93 | Origin.y := sfTexture_getSize(Texture1).y; 94 | sfSprite_setOrigin(Sprite1, Origin); 95 | Position := Origin; 96 | sfSprite_setPosition(Sprite1, Position); 97 | 98 | // Create a clock for measuring elapsed time 99 | Clock := sfClock_create(); 100 | 101 | // Loop until a WM_QUIT message is received 102 | repeat 103 | if (PeekMessage(&Message, 0, 0, 0, PM_REMOVE)) then 104 | begin 105 | // If a message was waiting in the message queue, process it 106 | TranslateMessage(&Message); 107 | DispatchMessage(&Message); 108 | end 109 | else 110 | begin 111 | Time := sfTime_asSeconds(sfClock_getElapsedTime(Clock)); 112 | 113 | // Clear views 114 | sfRenderWindow_clear(SfmlView1, sfBlack); 115 | sfRenderWindow_clear(SfmlView2, sfBlack); 116 | 117 | // Draw sprite 1 on view 1 118 | sfSprite_setRotation(Sprite1, Time * 100); 119 | sfRenderWindow_drawSprite(SfmlView1, Sprite1, nil); 120 | 121 | // Draw sprite 2 on view 2 122 | Position.x := Cos(Time) * 100; 123 | Position.y := 0; 124 | sfSprite_setPosition(Sprite2, Position); 125 | sfRenderWindow_drawSprite(SfmlView2, Sprite2, nil); 126 | 127 | // Display each view on screen 128 | sfRenderWindow_display(SfmlView1); 129 | sfRenderWindow_display(SfmlView2); 130 | end; 131 | until &Message.&Message = WM_QUIT; 132 | 133 | // Destroy the main Window (all its child controls will be destroyed) 134 | DestroyWindow(Window); 135 | 136 | // Don't forget to unregister the window class 137 | UnregisterClass('SFML App', hInstance); 138 | end. 139 | -------------------------------------------------------------------------------- /demos/Window.pas: -------------------------------------------------------------------------------- 1 | program Window_; 2 | 3 | {$mode objfpc}{$H+} 4 | 5 | uses 6 | SysUtils, 7 | {$ifdef LINUX} 8 | Math, 9 | {$endif} 10 | ctypes, 11 | gl, 12 | CSFMLConfig, 13 | CSFMLAudio, 14 | CSFMLGraphics, 15 | CSFMLNetwork, 16 | CSFMLSystem, 17 | CSFMLWindow; 18 | 19 | const 20 | Cube: array [0.. 251] of GLfloat = ( 21 | // positions // colors (r, g, b, a) 22 | -50, -50, -50, 0, 0, 1, 1, 23 | -50, 50, -50, 0, 0, 1, 1, 24 | -50, -50, 50, 0, 0, 1, 1, 25 | -50, -50, 50, 0, 0, 1, 1, 26 | -50, 50, -50, 0, 0, 1, 1, 27 | -50, 50, 50, 0, 0, 1, 1, 28 | 29 | 50, -50, -50, 0, 1, 0, 1, 30 | 50, 50, -50, 0, 1, 0, 1, 31 | 50, -50, 50, 0, 1, 0, 1, 32 | 50, -50, 50, 0, 1, 0, 1, 33 | 50, 50, -50, 0, 1, 0, 1, 34 | 50, 50, 50, 0, 1, 0, 1, 35 | 36 | -50, -50, -50, 1, 0, 0, 1, 37 | 50, -50, -50, 1, 0, 0, 1, 38 | -50, -50, 50, 1, 0, 0, 1, 39 | -50, -50, 50, 1, 0, 0, 1, 40 | 50, -50, -50, 1, 0, 0, 1, 41 | 50, -50, 50, 1, 0, 0, 1, 42 | 43 | -50, 50, -50, 0, 1, 1, 1, 44 | 50, 50, -50, 0, 1, 1, 1, 45 | -50, 50, 50, 0, 1, 1, 1, 46 | -50, 50, 50, 0, 1, 1, 1, 47 | 50, 50, -50, 0, 1, 1, 1, 48 | 50, 50, 50, 0, 1, 1, 1, 49 | 50 | -50, -50, -50, 1, 0, 1, 1, 51 | 50, -50, -50, 1, 0, 1, 1, 52 | -50, 50, -50, 1, 0, 1, 1, 53 | -50, 50, -50, 1, 0, 1, 1, 54 | 50, -50, -50, 1, 0, 1, 1, 55 | 50, 50, -50, 1, 0, 1, 1, 56 | 57 | -50, -50, 50, 1, 1, 0, 1, 58 | 50, -50, 50, 1, 1, 0, 1, 59 | -50, 50, 50, 1, 1, 0, 1, 60 | -50, 50, 50, 1, 1, 0, 1, 61 | 50, -50, 50, 1, 1, 0, 1, 62 | 50, 50, 50, 1, 1, 0, 1 63 | ); 64 | 65 | var 66 | ContextSettings: sfContextSettings; 67 | Mode: sfVideoMode; 68 | Window: PsfWindow; 69 | Title: string; 70 | Ratio: GLfloat; 71 | Clock: PsfClock; 72 | Event: sfEvent; 73 | begin 74 | {$ifdef LINUX} 75 | SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow, exPrecision]); 76 | 77 | {$endif} 78 | // Request a 32-bits depth buffer when creating the window 79 | ContextSettings.DepthBits := 32; 80 | 81 | Mode.width := 640; 82 | Mode.height := 480; 83 | // Create the main window 84 | Title := 'SFML window with OpenGL - ' + lowerCase({$I %FPCTARGETCPU%}) + '-' + lowerCase({$I %FPCTARGETOS%}); 85 | Window := sfWindow_create(Mode, PChar(Title), sfUint32(sfDefaultStyle), @ContextSettings); 86 | 87 | // Make it the active window for OpenGL calls 88 | sfWindow_setActive(Window, sfTrue); 89 | 90 | // Set the color and depth clear values 91 | glClearDepth(1); 92 | glClearColor(0, 0, 0, 1); 93 | 94 | // Enable Z-buffer read and write 95 | glEnable(GL_DEPTH_TEST); 96 | glDepthMask(GL_TRUE); 97 | 98 | // Disable lighting and texturing 99 | glDisable(GL_LIGHTING); 100 | glDisable(GL_TEXTURE_2D); 101 | 102 | // Configure the viewport (the same size as the window) 103 | glViewport(0, 0, sfWindow_getSize(Window).X, sfWindow_getSize(Window).Y); 104 | 105 | // Setup a perspective projection 106 | glMatrixMode(GL_PROJECTION); 107 | glLoadIdentity; 108 | Ratio := sfWindow_getSize(Window).X / sfWindow_getSize(Window).Y; 109 | glFrustum(-Ratio, Ratio, -1, 1, 1, 500); 110 | 111 | // Enable position and color vertex components 112 | glEnableClientState(GL_VERTEX_ARRAY); 113 | glEnableClientState(GL_COLOR_ARRAY); 114 | glVertexPointer(3, GL_FLOAT, 7 * sizeof(GLfloat), @Cube); 115 | glColorPointer(4, GL_FLOAT, 7 * sizeof(GLfloat), @Cube[3]); 116 | 117 | // Disable normal and texture coordinates vertex components 118 | glDisableClientState(GL_NORMAL_ARRAY); 119 | glDisableClientState(GL_TEXTURE_COORD_ARRAY); 120 | 121 | // Create a clock for measuring the time elapsed 122 | Clock := sfClock_create(); 123 | 124 | // Start the game loop 125 | while sfWindow_isOpen(Window) = sfTrue do 126 | begin 127 | // Process events 128 | while sfWindow_pollEvent(Window, @Event) = sfTrue do 129 | begin 130 | // Close window: exit 131 | if Event.type_ = sfEvtClosed then 132 | sfWindow_close(Window); 133 | 134 | // Escape key: exit 135 | if (Event.type_ = sfEvtKeyPressed) and (Event.key.code = sfKeyEscape) then 136 | sfWindow_close(Window); 137 | 138 | // Resize event: adjust the viewport 139 | if (Event.type_ = sfEvtResized) then 140 | glViewport(0, 0, Event.size.width, Event.size.height); 141 | end; 142 | 143 | // Clear the color and depth buffers 144 | glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); 145 | 146 | // Apply some transformations to rotate the cube 147 | glMatrixMode(GL_MODELVIEW); 148 | glLoadIdentity(); 149 | glTranslatef(0, 0, -200); 150 | glRotatef(sfTime_AsSeconds(sfClock_getElapsedTime(Clock)) * 50, 1, 0, 0); 151 | glRotatef(sfTime_AsSeconds(sfClock_getElapsedTime(Clock)) * 30, 0, 1, 0); 152 | glRotatef(sfTime_AsSeconds(sfClock_getElapsedTime(Clock)) * 90, 0, 0, 1); 153 | 154 | // Draw the cube 155 | glDrawArrays(GL_TRIANGLES, 0, 36); 156 | 157 | // Finally, display the rendered frame on screen 158 | sfWindow_display(Window); 159 | end; 160 | 161 | sfWindow_Destroy(Window); 162 | end. 163 | -------------------------------------------------------------------------------- /resources/admirationpains.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJMaster/csfml-fpc/72dc50f07d8d35cd9d244b8f6b2c429aba8e64ef/resources/admirationpains.ttf -------------------------------------------------------------------------------- /resources/background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJMaster/csfml-fpc/72dc50f07d8d35cd9d244b8f6b2c429aba8e64ef/resources/background.jpg -------------------------------------------------------------------------------- /resources/ball.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJMaster/csfml-fpc/72dc50f07d8d35cd9d244b8f6b2c429aba8e64ef/resources/ball.wav -------------------------------------------------------------------------------- /resources/billboard.frag: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | uniform sampler2D texture; 4 | 5 | in vec2 tex_coord; 6 | 7 | void main() 8 | { 9 | // Read and apply a color from the texture 10 | gl_FragColor = texture2D(texture, tex_coord); 11 | } 12 | -------------------------------------------------------------------------------- /resources/billboard.geom: -------------------------------------------------------------------------------- 1 | #version 150 2 | 3 | // The render target's resolution (used for scaling) 4 | uniform vec2 resolution; 5 | 6 | // The billboards' size 7 | uniform vec2 size; 8 | 9 | // Input is the passed point cloud 10 | layout (points) in; 11 | 12 | // The output will consist of triangle strips with four vertices each 13 | layout (triangle_strip, max_vertices = 4) out; 14 | 15 | // Output texture coordinates 16 | out vec2 tex_coord; 17 | 18 | // Main entry point 19 | void main() 20 | { 21 | // Caculate the half width/height of the billboards 22 | vec2 half_size = size / 2.f; 23 | 24 | // Scale the size based on resolution (1 would be full width/height) 25 | half_size /= resolution; 26 | 27 | // Iterate over all vertices 28 | for (int i = 0; i < gl_in.length(); i++) 29 | { 30 | // Retrieve the passed vertex position 31 | vec2 pos = gl_in[i].gl_Position.xy; 32 | 33 | // Bottom left vertex 34 | gl_Position = vec4(pos - half_size, 0.f, 1.f); 35 | tex_coord = vec2(1.f, 1.f); 36 | EmitVertex(); 37 | 38 | // Bottom right vertex 39 | gl_Position = vec4(pos.x + half_size.x, pos.y - half_size.y, 0.f, 1.f); 40 | tex_coord = vec2(0.f, 1.f); 41 | EmitVertex(); 42 | 43 | // Top left vertex 44 | gl_Position = vec4(pos.x - half_size.x, pos.y + half_size.y, 0.f, 1.f); 45 | tex_coord = vec2(1.f, 0.f); 46 | EmitVertex(); 47 | 48 | // Top right vertex 49 | gl_Position = vec4(pos + half_size, 0.f, 1.f); 50 | tex_coord = vec2(0.f, 0.f); 51 | EmitVertex(); 52 | 53 | // And finalize the primitive 54 | EndPrimitive(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /resources/billboard.vert: -------------------------------------------------------------------------------- 1 | void main() 2 | { 3 | // Transform the vertex position 4 | gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; 5 | } 6 | -------------------------------------------------------------------------------- /resources/blink.frag: -------------------------------------------------------------------------------- 1 | uniform sampler2D texture; 2 | uniform float blink_alpha; 3 | 4 | void main() 5 | { 6 | vec4 pixel = gl_Color; 7 | pixel.a = blink_alpha; 8 | gl_FragColor = pixel; 9 | } 10 | -------------------------------------------------------------------------------- /resources/blur.frag: -------------------------------------------------------------------------------- 1 | uniform sampler2D texture; 2 | uniform float blur_radius; 3 | 4 | void main() 5 | { 6 | vec2 offx = vec2(blur_radius, 0.0); 7 | vec2 offy = vec2(0.0, blur_radius); 8 | 9 | vec4 pixel = texture2D(texture, gl_TexCoord[0].xy) * 4.0 + 10 | texture2D(texture, gl_TexCoord[0].xy - offx) * 2.0 + 11 | texture2D(texture, gl_TexCoord[0].xy + offx) * 2.0 + 12 | texture2D(texture, gl_TexCoord[0].xy - offy) * 2.0 + 13 | texture2D(texture, gl_TexCoord[0].xy + offy) * 2.0 + 14 | texture2D(texture, gl_TexCoord[0].xy - offx - offy) * 1.0 + 15 | texture2D(texture, gl_TexCoord[0].xy - offx + offy) * 1.0 + 16 | texture2D(texture, gl_TexCoord[0].xy + offx - offy) * 1.0 + 17 | texture2D(texture, gl_TexCoord[0].xy + offx + offy) * 1.0; 18 | 19 | gl_FragColor = gl_Color * (pixel / 16.0); 20 | } 21 | -------------------------------------------------------------------------------- /resources/canary.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJMaster/csfml-fpc/72dc50f07d8d35cd9d244b8f6b2c429aba8e64ef/resources/canary.wav -------------------------------------------------------------------------------- /resources/devices.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJMaster/csfml-fpc/72dc50f07d8d35cd9d244b8f6b2c429aba8e64ef/resources/devices.png -------------------------------------------------------------------------------- /resources/ding.flac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJMaster/csfml-fpc/72dc50f07d8d35cd9d244b8f6b2c429aba8e64ef/resources/ding.flac -------------------------------------------------------------------------------- /resources/edge.frag: -------------------------------------------------------------------------------- 1 | uniform sampler2D texture; 2 | uniform float edge_threshold; 3 | 4 | void main() 5 | { 6 | const float offset = 1.0 / 512.0; 7 | vec2 offx = vec2(offset, 0.0); 8 | vec2 offy = vec2(0.0, offset); 9 | 10 | vec4 hEdge = texture2D(texture, gl_TexCoord[0].xy - offy) * -2.0 + 11 | texture2D(texture, gl_TexCoord[0].xy + offy) * 2.0 + 12 | texture2D(texture, gl_TexCoord[0].xy - offx - offy) * -1.0 + 13 | texture2D(texture, gl_TexCoord[0].xy - offx + offy) * 1.0 + 14 | texture2D(texture, gl_TexCoord[0].xy + offx - offy) * -1.0 + 15 | texture2D(texture, gl_TexCoord[0].xy + offx + offy) * 1.0; 16 | 17 | vec4 vEdge = texture2D(texture, gl_TexCoord[0].xy - offx) * 2.0 + 18 | texture2D(texture, gl_TexCoord[0].xy + offx) * -2.0 + 19 | texture2D(texture, gl_TexCoord[0].xy - offx - offy) * 1.0 + 20 | texture2D(texture, gl_TexCoord[0].xy - offx + offy) * -1.0 + 21 | texture2D(texture, gl_TexCoord[0].xy + offx - offy) * 1.0 + 22 | texture2D(texture, gl_TexCoord[0].xy + offx + offy) * -1.0; 23 | 24 | vec3 result = sqrt(hEdge.rgb * hEdge.rgb + vEdge.rgb * vEdge.rgb); 25 | float edge = length(result); 26 | vec4 pixel = gl_Color * texture2D(texture, gl_TexCoord[0].xy); 27 | if (edge > (edge_threshold * 8.0)) 28 | pixel.rgb = vec3(0.0, 0.0, 0.0); 29 | else 30 | pixel.a = edge_threshold; 31 | gl_FragColor = pixel; 32 | } 33 | -------------------------------------------------------------------------------- /resources/image1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJMaster/csfml-fpc/72dc50f07d8d35cd9d244b8f6b2c429aba8e64ef/resources/image1.jpg -------------------------------------------------------------------------------- /resources/image2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJMaster/csfml-fpc/72dc50f07d8d35cd9d244b8f6b2c429aba8e64ef/resources/image2.jpg -------------------------------------------------------------------------------- /resources/ladybug.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJMaster/csfml-fpc/72dc50f07d8d35cd9d244b8f6b2c429aba8e64ef/resources/ladybug.jpg -------------------------------------------------------------------------------- /resources/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJMaster/csfml-fpc/72dc50f07d8d35cd9d244b8f6b2c429aba8e64ef/resources/logo.png -------------------------------------------------------------------------------- /resources/oncapintada.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJMaster/csfml-fpc/72dc50f07d8d35cd9d244b8f6b2c429aba8e64ef/resources/oncapintada.jpg -------------------------------------------------------------------------------- /resources/oncapintada.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJMaster/csfml-fpc/72dc50f07d8d35cd9d244b8f6b2c429aba8e64ef/resources/oncapintada.ogg -------------------------------------------------------------------------------- /resources/orchestral.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJMaster/csfml-fpc/72dc50f07d8d35cd9d244b8f6b2c429aba8e64ef/resources/orchestral.ogg -------------------------------------------------------------------------------- /resources/pixelate.frag: -------------------------------------------------------------------------------- 1 | uniform sampler2D texture; 2 | uniform float pixel_threshold; 3 | 4 | void main() 5 | { 6 | float factor = 1.0 / (pixel_threshold + 0.001); 7 | vec2 pos = floor(gl_TexCoord[0].xy * factor + 0.5) / factor; 8 | gl_FragColor = texture2D(texture, pos) * gl_Color; 9 | } 10 | -------------------------------------------------------------------------------- /resources/sansation.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJMaster/csfml-fpc/72dc50f07d8d35cd9d244b8f6b2c429aba8e64ef/resources/sansation.ttf -------------------------------------------------------------------------------- /resources/sfml.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJMaster/csfml-fpc/72dc50f07d8d35cd9d244b8f6b2c429aba8e64ef/resources/sfml.png -------------------------------------------------------------------------------- /resources/storm.vert: -------------------------------------------------------------------------------- 1 | uniform vec2 storm_position; 2 | uniform float storm_total_radius; 3 | uniform float storm_inner_radius; 4 | 5 | void main() 6 | { 7 | vec4 vertex = gl_ModelViewMatrix * gl_Vertex; 8 | vec2 offset = vertex.xy - storm_position; 9 | float len = length(offset); 10 | if (len < storm_total_radius) 11 | { 12 | float push_distance = storm_inner_radius + len / storm_total_radius * (storm_total_radius - storm_inner_radius); 13 | vertex.xy = storm_position + normalize(offset) * push_distance; 14 | } 15 | 16 | gl_Position = gl_ProjectionMatrix * vertex; 17 | gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; 18 | gl_FrontColor = gl_Color; 19 | } 20 | -------------------------------------------------------------------------------- /resources/text-background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJMaster/csfml-fpc/72dc50f07d8d35cd9d244b8f6b2c429aba8e64ef/resources/text-background.png -------------------------------------------------------------------------------- /resources/texture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJMaster/csfml-fpc/72dc50f07d8d35cd9d244b8f6b2c429aba8e64ef/resources/texture.jpg -------------------------------------------------------------------------------- /resources/wave.vert: -------------------------------------------------------------------------------- 1 | uniform float wave_phase; 2 | uniform vec2 wave_amplitude; 3 | 4 | void main() 5 | { 6 | vec4 vertex = gl_Vertex; 7 | vertex.x += cos(gl_Vertex.y * 0.02 + wave_phase * 3.8) * wave_amplitude.x 8 | + sin(gl_Vertex.y * 0.02 + wave_phase * 6.3) * wave_amplitude.x * 0.3; 9 | vertex.y += sin(gl_Vertex.x * 0.02 + wave_phase * 2.4) * wave_amplitude.y 10 | + cos(gl_Vertex.x * 0.02 + wave_phase * 5.2) * wave_amplitude.y * 0.3; 11 | 12 | gl_Position = gl_ModelViewProjectionMatrix * vertex; 13 | gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; 14 | gl_FrontColor = gl_Color; 15 | } 16 | --------------------------------------------------------------------------------