Moved all bindings to the "bindings" sub-directory
Renamed the CSFML directory to c Renamed the DSFML directory to d --> bindings must now be updated to match the new organization! git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1630 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
0cc5563cac
commit
0e2297af28
417 changed files with 0 additions and 0 deletions
41
bindings/c/include/SFML/Audio.h
Normal file
41
bindings/c/include/SFML/Audio.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_AUDIO_H
|
||||
#define SFML_AUDIO_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#include <SFML/System.h>
|
||||
#include <SFML/Audio/Listener.h>
|
||||
#include <SFML/Audio/Music.h>
|
||||
#include <SFML/Audio/Sound.h>
|
||||
#include <SFML/Audio/SoundBuffer.h>
|
||||
#include <SFML/Audio/SoundBufferRecorder.h>
|
||||
#include <SFML/Audio/SoundRecorder.h>
|
||||
|
||||
|
||||
#endif // SFML_AUDIO_H
|
91
bindings/c/include/SFML/Audio/Listener.h
Normal file
91
bindings/c/include/SFML/Audio/Listener.h
Normal file
|
@ -0,0 +1,91 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_LISTENER_H
|
||||
#define SFML_LISTENER_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the global volume of all the sounds
|
||||
///
|
||||
/// \param volume : New global volume, in the range [0, 100]
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfListener_SetGlobalVolume(float volume);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current value of the global volume of all the sounds
|
||||
///
|
||||
/// \return Current global volume, in the range [0, 100]
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfListener_GetGlobalVolume(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the position of the listener
|
||||
///
|
||||
/// \param x : X position of the listener in the world
|
||||
/// \param y : Y position of the listener in the world
|
||||
/// \param z : Z position of the listener in the world
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfListener_SetPosition(float x, float y, float z);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current position of the listener
|
||||
///
|
||||
/// \param x : X position of the listener in the world
|
||||
/// \param y : Y position of the listener in the world
|
||||
/// \param z : Z position of the listener in the world
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfListener_GetPosition(float* x, float* y, float* z);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the orientation of the listener
|
||||
///
|
||||
/// \param x : X component of the listener's direction
|
||||
/// \param y : Y component of the listener's direction
|
||||
/// \param z : Z component of the listener's direction
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfListener_SetDirection(float x, float y, float z);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current orientation of the listener
|
||||
///
|
||||
/// \param x : X component of the listener's direction
|
||||
/// \param y : Y component of the listener's direction
|
||||
/// \param z : Z component of the listener's direction
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfListener_GetDirection(float* x, float* y, float* z);
|
||||
|
||||
|
||||
#endif // SFML_LISTENER_H
|
292
bindings/c/include/SFML/Audio/Music.h
Normal file
292
bindings/c/include/SFML/Audio/Music.h
Normal file
|
@ -0,0 +1,292 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_MUSIC_H
|
||||
#define SFML_MUSIC_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Audio/SoundStatus.h>
|
||||
#include <SFML/Audio/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new music and load it from a file
|
||||
///
|
||||
/// \param filename : Path of the music file to open
|
||||
///
|
||||
/// \return A new sfMusic object (NULL if failed)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfMusic* sfMusic_CreateFromFile(const char* filename);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new music and load it from a file in memory
|
||||
///
|
||||
/// \param data : Pointer to the file data in memory
|
||||
/// \param sizeInBytes : Size of the data to load, in bytes
|
||||
///
|
||||
/// \return A new sfMusic object (NULL if failed)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfMusic* sfMusic_CreateFromMemory(const void* data, size_t sizeInBytes);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing music
|
||||
///
|
||||
/// \param music : Music to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMusic_Destroy(sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set a music loop state
|
||||
///
|
||||
/// \param music : Music to set the loop state
|
||||
/// \param loop : sfTrue to play in loop, sfFalse to play once
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMusic_SetLoop(sfMusic* music, sfBool loop);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell whether or not a music is looping
|
||||
///
|
||||
/// \param music : Music to get the loop state from
|
||||
///
|
||||
/// \return sfTrue if the music is looping, sfFalse otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfMusic_GetLoop(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get a music duration
|
||||
///
|
||||
/// \param music : Music to get the duration from
|
||||
///
|
||||
/// \return Music duration, in seconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfMusic_GetDuration(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Start playing a music
|
||||
///
|
||||
/// \param music : Music to play
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMusic_Play(sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Pause a music
|
||||
///
|
||||
/// \param music : Music to pause
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMusic_Pause(sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Stop playing a music
|
||||
///
|
||||
/// \param music : Music to stop
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMusic_Stop(sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the number of channels of a music (1 = mono, 2 = stereo)
|
||||
///
|
||||
/// \param music : Music to get the channels count from
|
||||
///
|
||||
/// \return Number of channels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfMusic_GetChannelsCount(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the stream sample rate of a music
|
||||
///
|
||||
/// \param music : Music to get the sample rate from
|
||||
///
|
||||
/// \return Stream frequency (number of samples per second)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfMusic_GetSampleRate(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the status of a music (stopped, paused, playing)
|
||||
///
|
||||
/// \param music : Music to get the status from
|
||||
///
|
||||
/// \return Current status of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSoundStatus sfMusic_GetStatus(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current playing position of a music
|
||||
///
|
||||
/// \param music : Music to get the position from
|
||||
///
|
||||
/// \return Current playing position, expressed in seconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfMusic_GetPlayingOffset(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the pitch of a music
|
||||
///
|
||||
/// \param music : Music to modify
|
||||
/// \param pitch : New pitch
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMusic_SetPitch(sfMusic* music, float pitch);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the volume of a music
|
||||
///
|
||||
/// \param music : Music to modify
|
||||
/// \param volume : Volume (in range [0, 100])
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMusic_SetVolume(sfMusic* music, float volume);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the position of a music
|
||||
///
|
||||
/// \param music : Music to modify
|
||||
/// \param x : X position of the sound in the world
|
||||
/// \param y : Y position of the sound in the world
|
||||
/// \param z : Z position of the sound in the world
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMusic_SetPosition(sfMusic* music, float x, float y, float z);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Make the music's position relative to the listener's
|
||||
/// position, or absolute.
|
||||
/// The default value is false (absolute)
|
||||
///
|
||||
/// \param music : Music to modify
|
||||
/// \param relative : True to set the position relative, false to set it absolute
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMusic_SetRelativeToListener(sfMusic* music, sfBool relative);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the minimum distance - closer than this distance,
|
||||
/// the listener will hear the music at its maximum volume.
|
||||
/// The default minimum distance is 1.0
|
||||
///
|
||||
/// \param music : Music to modify
|
||||
/// \param distance : New minimum distance for the music
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMusic_SetMinDistance(sfMusic* music, float distance);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the attenuation factor - the higher the attenuation, the
|
||||
/// more the sound will be attenuated with distance from listener.
|
||||
/// The default attenuation factor 1.0
|
||||
///
|
||||
/// \param music : Music to modify
|
||||
/// \param attenuation : New attenuation factor for the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMusic_SetAttenuation(sfMusic* music, float attenuation);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the current playing position of a music
|
||||
///
|
||||
/// \param music : Music to modify
|
||||
/// \param timeOffset : New playing position, expressed in seconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMusic_SetPlayingOffset(sfMusic* music, float timeOffset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the pitch of a music
|
||||
///
|
||||
/// \param music : Music to get the pitch from
|
||||
///
|
||||
/// \return Pitch value
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfMusic_GetPitch(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the volume of a music
|
||||
///
|
||||
/// \param music : Music to get the volume from
|
||||
///
|
||||
/// \return Volume value (in range [1, 100])
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfMusic_GetVolume(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the position of a music
|
||||
///
|
||||
/// \param music : Music to get the position from
|
||||
/// \param x : X position of the sound in the world
|
||||
/// \param y : Y position of the sound in the world
|
||||
/// \param z : Z position of the sound in the world
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMusic_GetPosition(const sfMusic* music, float* x, float* y, float* z);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell if the music's position is relative to the listener's
|
||||
/// position, or if it's absolute
|
||||
///
|
||||
/// \param music : Music to check
|
||||
///
|
||||
/// \return sfTrue if the position is relative, sfFalse if it's absolute
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfMusic_IsRelativeToListener(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the minimum distance of a music
|
||||
///
|
||||
/// \param music : Music to get the minimum distance from
|
||||
///
|
||||
/// \return Minimum distance for the music
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfMusic_GetMinDistance(const sfMusic* music);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the attenuation factor of a music
|
||||
///
|
||||
/// \param music : Music to get the attenuation factor from
|
||||
///
|
||||
/// \return Attenuation factor for the a music
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfMusic_GetAttenuation(const sfMusic* music);
|
||||
|
||||
|
||||
#endif // SFML_MUSIC_H
|
278
bindings/c/include/SFML/Audio/Sound.h
Normal file
278
bindings/c/include/SFML/Audio/Sound.h
Normal file
|
@ -0,0 +1,278 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SOUND_H
|
||||
#define SFML_SOUND_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Audio/SoundStatus.h>
|
||||
#include <SFML/Audio/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new sound
|
||||
///
|
||||
/// \return A new sfSound object (NULL if failed)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSound* sfSound_Create(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy an existing sound
|
||||
///
|
||||
/// \param sound : Sound to copy
|
||||
///
|
||||
/// \return Copied object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSound* sfSound_Copy(sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing sound
|
||||
///
|
||||
/// \param sound : Sound to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_Destroy(sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Start playing a sound
|
||||
///
|
||||
/// \param sound : Sound to play
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_Play(sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Pause a sound
|
||||
///
|
||||
/// \param sound : Sound to pause
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_Pause(sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Stop playing a sound
|
||||
///
|
||||
/// \param sound : Sound to stop
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_Stop(sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Bind a sound buffer to a sound
|
||||
///
|
||||
/// \param sound : Sound to set the loop state
|
||||
/// \param buffer : Buffer to bind
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_SetBuffer(sfSound* sound, const sfSoundBuffer* buffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the sound buffer bound to a sound
|
||||
///
|
||||
/// \param sound : Sound to get the buffer from
|
||||
///
|
||||
/// \return Pointer to the sound's buffer
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const sfSoundBuffer* sfSound_GetBuffer(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set a sound loop state
|
||||
///
|
||||
/// \param sound : Sound to set the loop state
|
||||
/// \param loop : sfTrue to play in loop, sfFalse to play once
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_SetLoop(sfSound* sound, sfBool loop);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell whether or not a sound is looping
|
||||
///
|
||||
/// \param sound : Sound to get the loop state from
|
||||
///
|
||||
/// \return sfTrue if the sound is looping, sfFalse otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfSound_GetLoop(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the status of a sound (stopped, paused, playing)
|
||||
///
|
||||
/// \param sound : Sound to get the status from
|
||||
///
|
||||
/// \return Current status of the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSoundStatus sfSound_GetStatus(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the pitch of a sound
|
||||
///
|
||||
/// \param sound : Sound to modify
|
||||
/// \param pitch : New pitch
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_SetPitch(sfSound* sound, float pitch);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the volume of a sound
|
||||
///
|
||||
/// \param sound : Sound to modify
|
||||
/// \param volume : Volume (in range [0, 100])
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_SetVolume(sfSound* sound, float volume);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the position of a sound
|
||||
///
|
||||
/// \param sound : Sound to modify
|
||||
/// \param x : X position of the sound in the world
|
||||
/// \param y : Y position of the sound in the world
|
||||
/// \param z : Z position of the sound in the world
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_SetPosition(sfSound* sound, float x, float y, float z);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Make the sound's position relative to the listener's
|
||||
/// position, or absolute.
|
||||
/// The default value is false (absolute)
|
||||
///
|
||||
/// \param sound : Sound to modify
|
||||
/// \param relative : True to set the position relative, false to set it absolute
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_SetRelativeToListener(sfSound* sound, sfBool relative);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the minimum distance - closer than this distance,
|
||||
/// the listener will hear the sound at its maximum volume.
|
||||
/// The default minimum distance is 1.0
|
||||
///
|
||||
/// \param sound : Sound to modify
|
||||
/// \param distance : New minimum distance for the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_SetMinDistance(sfSound* sound, float distance);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the attenuation factor - the higher the attenuation, the
|
||||
/// more the sound will be attenuated with distance from listener.
|
||||
/// The default attenuation factor is 1.0
|
||||
///
|
||||
/// \param sound : Sound to modify
|
||||
/// \param attenuation : New attenuation factor for the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_SetAttenuation(sfSound* sound, float attenuation);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the current playing position of a sound
|
||||
///
|
||||
/// \param sound : Sound to modify
|
||||
/// \param timeOffset : New playing position, expressed in seconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_SetPlayingOffset(sfSound* sound, float timeOffset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the pitch of a sound
|
||||
///
|
||||
/// \param sound : Sound to get the pitch from
|
||||
///
|
||||
/// \return Pitch value
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSound_GetPitch(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the volume of a sound
|
||||
///
|
||||
/// \param sound : Sound to get the volume from
|
||||
///
|
||||
/// \return Volume value (in range [1, 100])
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSound_GetVolume(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the position of a sound
|
||||
///
|
||||
/// \param sound : Sound to get the position from
|
||||
/// \param x : X position of the sound in the world
|
||||
/// \param y : Y position of the sound in the world
|
||||
/// \param z : Z position of the sound in the world
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSound_GetPosition(const sfSound* sound, float* x, float* y, float* z);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell if the sound's position is relative to the listener's
|
||||
/// position, or if it's absolute
|
||||
///
|
||||
/// \param sound : Sound to check
|
||||
///
|
||||
/// \return sfTrue if the position is relative, sfFalse if it's absolute
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfSound_IsRelativeToListener(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the minimum distance of a sound
|
||||
///
|
||||
/// \param sound : Sound to get the minimum distance from
|
||||
///
|
||||
/// \return Minimum distance for the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSound_GetMinDistance(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the attenuation factor of a sound
|
||||
///
|
||||
/// \param sound : Sound to get the attenuation factor from
|
||||
///
|
||||
/// \return Attenuation factor for the sound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSound_GetAttenuation(const sfSound* sound);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current playing position of a sound
|
||||
///
|
||||
/// \param sound : Sound to get the position from
|
||||
///
|
||||
/// \return Current playing position, expressed in seconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSound_GetPlayingOffset(const sfSound* sound);
|
||||
|
||||
|
||||
#endif // SFML_SOUND_H
|
151
bindings/c/include/SFML/Audio/SoundBuffer.h
Normal file
151
bindings/c/include/SFML/Audio/SoundBuffer.h
Normal file
|
@ -0,0 +1,151 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SOUNDBUFFER_H
|
||||
#define SFML_SOUNDBUFFER_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Audio/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new sound buffer and load it from a file
|
||||
///
|
||||
/// \param filename : Path of the music file to open
|
||||
///
|
||||
/// \return A new sfSoundBuffer object (NULL if failed)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSoundBuffer* sfSoundBuffer_CreateFromFile(const char* filename);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new sound buffer and load it from a file in memory
|
||||
///
|
||||
/// \param data : Pointer to the file data in memory
|
||||
/// \param sizeInBytes : Size of the data to load, in bytes
|
||||
///
|
||||
/// \return A new sfSoundBuffer object (NULL if failed)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSoundBuffer* sfSoundBuffer_CreateFromMemory(const void* data, size_t sizeInBytes);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new sound buffer and load it from an array of
|
||||
/// samples in memory - assumed format for samples is
|
||||
/// 16 bits signed integer
|
||||
///
|
||||
/// \param samples : Pointer to the samples in memory
|
||||
/// \param samplesCount : Number of samples pointed by Samples
|
||||
/// \param channelsCount : Number of channels (1 = mono, 2 = stereo, ...)
|
||||
/// \param sampleRate : Frequency (number of samples to play per second)
|
||||
///
|
||||
/// \return A new sfSoundBuffer object (NULL if failed)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSoundBuffer* sfSoundBuffer_CreateFromSamples(const sfInt16* samples, size_t samplesCount, unsigned int channelsCount, unsigned int sampleRate);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy an existing sound buffer
|
||||
///
|
||||
/// \param soundBuffer : Sound buffer to copy
|
||||
///
|
||||
/// \return Copied object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSoundBuffer* sfSoundBuffer_Copy(sfSoundBuffer* soundBuffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing sound buffer
|
||||
///
|
||||
/// \param soundBuffer : Sound buffer to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundBuffer_Destroy(sfSoundBuffer* soundBuffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Save a sound buffer to a file
|
||||
///
|
||||
/// \param soundBuffer : Sound buffer to save
|
||||
/// \param filename : Path of the sound file to write
|
||||
///
|
||||
/// \return sfTrue if saving has been successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfSoundBuffer_SaveToFile(const sfSoundBuffer* soundBuffer, const char* filename);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the samples contained in a sound buffer
|
||||
///
|
||||
/// \param soundBuffer : Sound buffer to get samples from
|
||||
///
|
||||
/// \return Pointer to the array of sound samples, in 16 bits signed integer format
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const sfInt16* sfSoundBuffer_GetSamples(const sfSoundBuffer* soundBuffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the number of samples contained in a sound buffer
|
||||
///
|
||||
/// \param soundBuffer : Sound buffer to get samples count from
|
||||
///
|
||||
/// \return Number of samples
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API size_t sfSoundBuffer_GetSamplesCount(const sfSoundBuffer* soundBuffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the sample rate of a sound buffer
|
||||
///
|
||||
/// \param soundBuffer : Sound buffer to get sample rate from
|
||||
///
|
||||
/// \return Sound frequency (number of samples per second)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfSoundBuffer_GetSampleRate(const sfSoundBuffer* soundBuffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the number of channels of a sound buffer (1 = mono, 2 = stereo, ...)
|
||||
///
|
||||
/// \param soundBuffer : Sound buffer to get channels count from
|
||||
///
|
||||
/// \return Number of channels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfSoundBuffer_GetChannelsCount(const sfSoundBuffer* soundBuffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the duration of a sound buffer
|
||||
///
|
||||
/// \param soundBuffer : Sound buffer to get duration from
|
||||
///
|
||||
/// \return Sound duration, in seconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSoundBuffer_GetDuration(const sfSoundBuffer* soundBuffer);
|
||||
|
||||
|
||||
#endif // SFML_SOUNDBUFFER_H
|
91
bindings/c/include/SFML/Audio/SoundBufferRecorder.h
Normal file
91
bindings/c/include/SFML/Audio/SoundBufferRecorder.h
Normal file
|
@ -0,0 +1,91 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SOUNDBUFFERRECORDER_H
|
||||
#define SFML_SOUNDBUFFERRECORDER_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Audio/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new sound buffer recorder
|
||||
///
|
||||
/// \return A new sfSoundBufferRecorder object (NULL if failed)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSoundBufferRecorder* sfSoundBufferRecorder_Create(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing sound buffer recorder
|
||||
///
|
||||
/// \param soundBufferRecorder : Sound buffer recorder to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundBufferRecorder_Destroy(sfSoundBufferRecorder* soundBufferRecorder);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Start the capture.
|
||||
/// Warning : only one capture can happen at the same time
|
||||
///
|
||||
/// \param soundBufferRecorder : Sound buffer recorder to start
|
||||
/// \param sampleRate : Sound frequency (the more samples, the higher the quality)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundBufferRecorder_Start(sfSoundBufferRecorder* soundBufferRecorder, unsigned int sampleRate);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Stop the capture
|
||||
///
|
||||
/// \param soundBufferRecorder : Sound buffer recorder to stop
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundBufferRecorder_Stop(sfSoundBufferRecorder* soundBufferRecorder);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the sample rate of a sound buffer recorder
|
||||
///
|
||||
/// \param soundBufferRecorder : Sound buffer recorder to get sample rate from
|
||||
///
|
||||
/// \return Frequency, in samples per second
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfSoundBufferRecorder_GetSampleRate(const sfSoundBufferRecorder* soundBufferRecorder);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the sound buffer containing the captured audio data
|
||||
/// of a sound buffer recorder
|
||||
///
|
||||
/// \param soundBufferRecorder : Sound buffer recorder to get the sound buffer from
|
||||
///
|
||||
/// \return Pointer to the sound buffer (you don't need to destroy it after use)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const sfSoundBuffer* sfSoundBufferRecorder_GetBuffer(const sfSoundBufferRecorder* soundBufferRecorder);
|
||||
|
||||
|
||||
#endif // SFML_SOUNDBUFFERRECORDER_H
|
103
bindings/c/include/SFML/Audio/SoundRecorder.h
Normal file
103
bindings/c/include/SFML/Audio/SoundRecorder.h
Normal file
|
@ -0,0 +1,103 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SOUNDRECORDER_H
|
||||
#define SFML_SOUNDRECORDER_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Audio/Types.h>
|
||||
|
||||
|
||||
typedef sfBool (*sfSoundRecorderStartCallback)(void*); ///< Type of the callback used when starting a capture
|
||||
typedef sfBool (*sfSoundRecorderProcessCallback)(const sfInt16*, size_t, void*); ///< Type of the callback used to process audio data
|
||||
typedef void (*sfSoundRecorderStopCallback)(void*); ///< Type of the callback used when stopping a capture
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new sound recorder with callback functions
|
||||
/// for processing captured samples
|
||||
///
|
||||
/// \param onStart : Callback function which will be called when a new capture starts (can be NULL)
|
||||
/// \param onProcess : Callback function which will be called each time there's audio data to process
|
||||
/// \param onStop : Callback function which will be called when the current capture stops (can be NULL)
|
||||
/// \param userData : Data to pass to the callback function (can be NULL)
|
||||
///
|
||||
/// \return A new sfSoundRecorder object (NULL if failed)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSoundRecorder* sfSoundRecorder_Create(sfSoundRecorderStartCallback onStart,
|
||||
sfSoundRecorderProcessCallback onProcess,
|
||||
sfSoundRecorderStopCallback onStop,
|
||||
void* userData);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing sound recorder
|
||||
///
|
||||
/// \param soundRecorder : Sound recorder to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundRecorder_Destroy(sfSoundRecorder* soundRecorder);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Start the capture.
|
||||
/// Warning : only one capture can happen at the same time
|
||||
///
|
||||
/// \param soundRecorder : Sound recorder to start
|
||||
/// \param sampleRate : Sound frequency (the more samples, the higher the quality)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundRecorder_Start(sfSoundRecorder* soundRecorder, unsigned int sampleRate);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Stop the capture
|
||||
///
|
||||
/// \param soundRecorder : Sound recorder to stop
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundRecorder_Stop(sfSoundRecorder* soundRecorder);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the sample rate of a sound recorder
|
||||
///
|
||||
/// \param soundRecorder : Sound recorder to get sample rate from
|
||||
///
|
||||
/// \return Frequency, in samples per second
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfSoundRecorder_GetSampleRate(const sfSoundRecorder* soundRecorder);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell if the system supports sound capture.
|
||||
/// If not, this class won't be usable
|
||||
///
|
||||
/// \return sfTrue if audio capture is supported
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfSoundRecorder_IsAvailable(void);
|
||||
|
||||
|
||||
#endif // SFML_SOUNDRECORDER_H
|
42
bindings/c/include/SFML/Audio/SoundStatus.h
Normal file
42
bindings/c/include/SFML/Audio/SoundStatus.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SOUNDSTATUS_H
|
||||
#define SFML_SOUNDSTATUS_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
sfStopped, ///< Sound / music is not playing
|
||||
sfPaused, ///< Sound / music is paused
|
||||
sfPlaying ///< Sound / music is playing
|
||||
} sfSoundStatus;
|
||||
|
||||
|
||||
#endif // SFML_SOUNDSTATUS_H
|
294
bindings/c/include/SFML/Audio/SoundStream.h
Normal file
294
bindings/c/include/SFML/Audio/SoundStream.h
Normal file
|
@ -0,0 +1,294 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SOUNDSTREAM_H
|
||||
#define SFML_SOUNDSTREAM_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Audio/SoundStatus.h>
|
||||
#include <SFML/Audio/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfSoundStreamChunk defines the data to fill by the
|
||||
/// OnGetData callback
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
sfInt16* Samples; ///< Pointer to the audio samples
|
||||
unsigned int NbSamples; ///< Number of samples pointed by Samples
|
||||
} sfSoundStreamChunk;
|
||||
|
||||
typedef sfBool (*sfSoundStreamGetDataCallback)(sfSoundStreamChunk*, void*); ///< Type of the callback used to get a sound stream data
|
||||
typedef void (*sfSoundStreamSeekCallback)(float, void*); ///< Type of the callback used to seek in a sound stream
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new sound stream
|
||||
///
|
||||
/// \param onGetData : Function called when the stream needs more data (can't be NULL)
|
||||
/// \param onSeek : Function called when the stream seeks (can't be NULL)
|
||||
/// \param channelsCount : Number of channels to use (1 = mono, 2 = stereo)
|
||||
/// \param sampleRate : Sample rate of the sound (44100 = CD quality)
|
||||
/// \param userData : Data to pass to the callback functions
|
||||
///
|
||||
/// \return A new sfSoundStream object (NULL if failed)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSoundStream* sfSoundStream_Create(sfSoundStreamGetDataCallback onGetData,
|
||||
sfSoundStreamSeekCallback onSeek,
|
||||
unsigned int channelsCount,
|
||||
unsigned int sampleRate,
|
||||
void* userData);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing sound stream
|
||||
///
|
||||
/// \param soundStream : Sound stream to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundStream_Destroy(sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Start playing a sound stream
|
||||
///
|
||||
/// \param soundStream : Sound stream to play
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundStream_Play(sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Pause a sound stream
|
||||
///
|
||||
/// \param soundStream : Sound stream to pause
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundStream_Pause(sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Stop playing a sound stream
|
||||
///
|
||||
/// \param soundStream : Sound stream to stop
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundStream_Stop(sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the status of a sound stream (stopped, paused, playing)
|
||||
///
|
||||
/// \param soundStream : Sound stream to get the status from
|
||||
///
|
||||
/// \return Current status of the sound stream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSoundStatus sfSoundStream_GetStatus(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the number of channels of a sound stream
|
||||
/// (1 = mono, 2 = stereo)
|
||||
///
|
||||
/// \param soundStream : Sound stream to get the channels count from
|
||||
///
|
||||
/// \return Number of channels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfSoundStream_GetChannelsCount(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the sample rate of a sound stream
|
||||
///
|
||||
/// \param soundStream : Sound stream to get the sample rate from
|
||||
///
|
||||
/// \return Stream frequency (number of samples per second)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfSoundStream_GetSampleRate(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the pitch of a sound stream
|
||||
///
|
||||
/// \param soundStream : Sound stream to modify
|
||||
/// \param pitch : New pitch
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundStream_SetPitch(sfSoundStream* soundStream, float pitch);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the volume of a sound stream
|
||||
///
|
||||
/// \param soundStream : Sound stream to modify
|
||||
/// \param volume : Volume (in range [0, 100])
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundStream_SetVolume(sfSoundStream* soundStream, float volume);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the position of a sound stream
|
||||
///
|
||||
/// \param soundStream : Sound stream to modify
|
||||
/// \param x : X position of the sound stream in the world
|
||||
/// \param y : Y position of the sound stream in the world
|
||||
/// \param z : Z position of the sound stream in the world
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundStream_SetPosition(sfSoundStream* soundStream, float x, float y, float z);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Make the sound stream's position relative to the listener's
|
||||
/// position, or absolute.
|
||||
/// The default value is false (absolute)
|
||||
///
|
||||
/// \param soundStream : Sound stream to modify
|
||||
/// \param relative : True to set the position relative, false to set it absolute
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundStream_SetRelativeToListener(sfSoundStream* soundStream, sfBool relative);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the minimum distance - closer than this distance,
|
||||
/// the listener will hear the sound stream at its maximum volume.
|
||||
/// The default minimum distance is 1.0
|
||||
///
|
||||
/// \param soundStream : Sound stream to modify
|
||||
/// \param distance : New minimum distance for the sound stream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundStream_SetMinDistance(sfSoundStream* soundStream, float distance);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the attenuation factor - the higher the attenuation, the
|
||||
/// more the sound stream will be attenuated with distance from listener.
|
||||
/// The default attenuation factor 1.0
|
||||
///
|
||||
/// \param soundStream : Sound stream to modify
|
||||
/// \param attenuation : New attenuation factor for the sound stream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundStream_SetAttenuation(sfSoundStream* soundStream, float attenuation);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the current playing position of a stream
|
||||
///
|
||||
/// \param soundStream : Sound stream to modify
|
||||
/// \param timeOffset : New playing position, expressed in seconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundStream_SetPlayingOffset(sfSoundStream* soundStream, float timeOffset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set a stream loop state
|
||||
///
|
||||
/// \param soundStream : Stream to set the loop state
|
||||
/// \param loop : sfTrue to play in loop, sfFalse to play once
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundStream_SetLoop(sfSoundStream* soundStream, sfBool loop);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the pitch of a sound stream
|
||||
///
|
||||
/// \param soundStream : Sound stream to get the pitch from
|
||||
///
|
||||
/// \return Pitch value
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSoundStream_GetPitch(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the volume of a sound stream
|
||||
///
|
||||
/// \param soundStream : Sound stream to get the volume from
|
||||
///
|
||||
/// \return Volume value (in range [1, 100])
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSoundStream_GetVolume(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the position of a sound stream
|
||||
///
|
||||
/// \param soundStream : Sound stream to get the position from
|
||||
/// \param x : X position of the sound stream in the world
|
||||
/// \param y : Y position of the sound stream in the world
|
||||
/// \param z : Z position of the sound stream in the world
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSoundStream_GetPosition(const sfSoundStream* soundStream, float* x, float* y, float* z);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell if the sound stream's position is relative to the listener's
|
||||
/// position, or if it's absolute
|
||||
///
|
||||
/// \param soundStream : Sound stream to check
|
||||
///
|
||||
/// \return sfTrue if the position is relative, sfFalse if it's absolute
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfSoundStream_IsRelativeToListener(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the minimum distance of a sound stream
|
||||
///
|
||||
/// \param soundStream : Sound stream to get the minimum distance from
|
||||
///
|
||||
/// \return Minimum distance for the sound stream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSoundStream_GetMinDistance(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the attenuation factor of a sound stream
|
||||
///
|
||||
/// \param soundStream : Sound stream to get the attenuation factor from
|
||||
///
|
||||
/// \return Attenuation factor for the sound stream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSoundStream_GetAttenuation(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell whether or not a stream is looping
|
||||
///
|
||||
/// \param soundStream : Soundstream to get the loop state from
|
||||
///
|
||||
/// \return sfTrue if the stream is looping, sfFalse otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfSoundStream_GetLoop(const sfSoundStream* soundStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current playing position of a sound stream
|
||||
///
|
||||
/// \param soundStream : Sound stream to get the position from
|
||||
///
|
||||
/// \return Current playing position, expressed in seconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSoundStream_GetPlayingOffset(const sfSoundStream* soundStream);
|
||||
|
||||
|
||||
#endif // SFML_SOUNDSTREAM_H
|
36
bindings/c/include/SFML/Audio/Types.h
Normal file
36
bindings/c/include/SFML/Audio/Types.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_AUDIO_TYPES_H
|
||||
#define SFML_AUDIO_TYPES_H
|
||||
|
||||
|
||||
typedef struct sfMusic sfMusic;
|
||||
typedef struct sfSound sfSound;
|
||||
typedef struct sfSoundBuffer sfSoundBuffer;
|
||||
typedef struct sfSoundBufferRecorder sfSoundBufferRecorder;
|
||||
typedef struct sfSoundRecorder sfSoundRecorder;
|
||||
typedef struct sfSoundStream sfSoundStream;
|
||||
|
||||
|
||||
#endif // SFML_AUDIO_TYPES_H
|
143
bindings/c/include/SFML/Config.h
Normal file
143
bindings/c/include/SFML/Config.h
Normal file
|
@ -0,0 +1,143 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_CONFIG_H
|
||||
#define SFML_CONFIG_H
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Identify the operating system
|
||||
////////////////////////////////////////////////////////////
|
||||
#if defined(_WIN32) || defined(__WIN32__)
|
||||
|
||||
// Windows
|
||||
#define CSFML_SYSTEM_WINDOWS
|
||||
|
||||
#elif defined(linux) || defined(__linux)
|
||||
|
||||
// Linux
|
||||
#define CSFML_SYSTEM_LINUX
|
||||
|
||||
#elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh)
|
||||
|
||||
// MacOS
|
||||
#define CSFML_SYSTEM_MACOS
|
||||
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
|
||||
// FreeBSD
|
||||
#define CSFML_SYSTEM_FREEBSD
|
||||
|
||||
#else
|
||||
|
||||
// Unsupported system
|
||||
#error This operating system is not supported by SFML library
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Define portable import / export macros
|
||||
////////////////////////////////////////////////////////////
|
||||
#if defined(CSFML_SYSTEM_WINDOWS)
|
||||
|
||||
#ifdef CSFML_EXPORTS
|
||||
|
||||
// From DLL side, we must export
|
||||
#define CSFML_API extern "C" __declspec(dllexport)
|
||||
|
||||
#else
|
||||
|
||||
// From client application side, we must import
|
||||
#define CSFML_API extern __declspec(dllimport)
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#ifdef CSFML_EXPORTS
|
||||
|
||||
#define CSFML_API extern "C"
|
||||
|
||||
#else
|
||||
|
||||
#define CSFML_API extern
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Define a portable boolean type
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef int sfBool;
|
||||
#define sfFalse 0
|
||||
#define sfTrue 1
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Define portable types
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
|
||||
// 8 bits integer types
|
||||
#if UCHAR_MAX == 0xFF
|
||||
typedef signed char sfInt8;
|
||||
typedef unsigned char sfUint8;
|
||||
#else
|
||||
#error No 8 bits integer type for this platform
|
||||
#endif
|
||||
|
||||
// 16 bits integer types
|
||||
#if USHRT_MAX == 0xFFFF
|
||||
typedef signed short sfInt16;
|
||||
typedef unsigned short sfUint16;
|
||||
#elif UINT_MAX == 0xFFFF
|
||||
typedef signed int sfInt16;
|
||||
typedef unsigned int sfUint16;
|
||||
#elif ULONG_MAX == 0xFFFF
|
||||
typedef signed long sfInt16;
|
||||
typedef unsigned long sfUint16;
|
||||
#else
|
||||
#error No 16 bits integer type for this platform
|
||||
#endif
|
||||
|
||||
// 32 bits integer types
|
||||
#if USHRT_MAX == 0xFFFFFFFF
|
||||
typedef signed short sfInt32;
|
||||
typedef unsigned short sfUint32;
|
||||
#elif UINT_MAX == 0xFFFFFFFF
|
||||
typedef signed int sfInt32;
|
||||
typedef unsigned int sfUint32;
|
||||
#elif ULONG_MAX == 0xFFFFFFFF
|
||||
typedef signed long sfInt32;
|
||||
typedef unsigned long sfUint32;
|
||||
#else
|
||||
#error No 32 bits integer type for this platform
|
||||
#endif
|
||||
|
||||
|
||||
#endif // SFML_CONFIG_H
|
46
bindings/c/include/SFML/Graphics.h
Normal file
46
bindings/c/include/SFML/Graphics.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_GRAPHICS_H
|
||||
#define SFML_GRAPHICS_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#include <SFML/Window.h>
|
||||
#include <SFML/Graphics/Color.h>
|
||||
#include <SFML/Graphics/Font.h>
|
||||
#include <SFML/Graphics/Image.h>
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
#include <SFML/Graphics/RenderWindow.h>
|
||||
#include <SFML/Graphics/RenderImage.h>
|
||||
#include <SFML/Graphics/Shader.h>
|
||||
#include <SFML/Graphics/Shape.h>
|
||||
#include <SFML/Graphics/Sprite.h>
|
||||
#include <SFML/Graphics/Text.h>
|
||||
#include <SFML/Graphics/View.h>
|
||||
|
||||
|
||||
#endif // SFML_GRAPHICS_H
|
46
bindings/c/include/SFML/Graphics/BlendMode.h
Normal file
46
bindings/c/include/SFML/Graphics/BlendMode.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_BLENDMODE_H
|
||||
#define SFML_BLENDMODE_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Enumerate the blending modes for drawable objects
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
sfBlendAlpha, ///< Pixel = Src * a + Dest * (1 - a)
|
||||
sfBlendAdd, ///< Pixel = Src + Dest
|
||||
sfBlendMultiply, ///< Pixel = Src * Dest
|
||||
sfBlendNone ///< No blending
|
||||
} sfBlendMode;
|
||||
|
||||
|
||||
#endif // SFML_BLENDMODE_H
|
107
bindings/c/include/SFML/Graphics/Color.h
Normal file
107
bindings/c/include/SFML/Graphics/Color.h
Normal file
|
@ -0,0 +1,107 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_COLOR_H
|
||||
#define SFML_COLOR_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfColor is an utility class for manipulating colors
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
sfUint8 r;
|
||||
sfUint8 g;
|
||||
sfUint8 b;
|
||||
sfUint8 a;
|
||||
} sfColor;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Define some common colors
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfColor sfBlack;
|
||||
CSFML_API sfColor sfWhite;
|
||||
CSFML_API sfColor sfRed;
|
||||
CSFML_API sfColor sfGreen;
|
||||
CSFML_API sfColor sfBlue;
|
||||
CSFML_API sfColor sfYellow;
|
||||
CSFML_API sfColor sfMagenta;
|
||||
CSFML_API sfColor sfCyan;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a color from its 3 RGB components
|
||||
///
|
||||
/// \param red : Red component (0 .. 255)
|
||||
/// \param green : Green component (0 .. 255)
|
||||
/// \param blue : Blue component (0 .. 255)
|
||||
///
|
||||
/// \return sfColor constructed from the components
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfColor sfColor_FromRGB(sfUint8 red, sfUint8 green, sfUint8 blue);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a color from its 4 RGBA components
|
||||
///
|
||||
/// \param red : Red component (0 .. 255)
|
||||
/// \param green : Green component (0 .. 255)
|
||||
/// \param blue : Blue component (0 .. 255)
|
||||
/// \param alpha : Alpha component (0 .. 255)
|
||||
///
|
||||
/// \return sfColor constructed from the components
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfColor sfColor_FromRGBA(sfUint8 red, sfUint8 green, sfUint8 blue, sfUint8 alpha);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Add two colors
|
||||
///
|
||||
/// \param color1 : First color
|
||||
/// \param color2 : Second color
|
||||
///
|
||||
/// \return Component-wise saturated addition of the two colors
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfColor sfColor_Add(sfColor color1, sfColor color2);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Modulate two colors
|
||||
///
|
||||
/// \param color1 : First color
|
||||
/// \param color2 : Second color
|
||||
///
|
||||
/// \return Component-wise multiplication of the two colors
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfColor sfColor_Modulate(sfColor color1, sfColor color2);
|
||||
|
||||
|
||||
#endif // SFML_COLOR_H
|
132
bindings/c/include/SFML/Graphics/Font.h
Normal file
132
bindings/c/include/SFML/Graphics/Font.h
Normal file
|
@ -0,0 +1,132 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_FONT_H
|
||||
#define SFML_FONT_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/Glyph.h>
|
||||
#include <SFML/Graphics/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new font from a file
|
||||
///
|
||||
/// \param filename : Path of the font file to load
|
||||
///
|
||||
/// \return A new sfFont object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFont* sfFont_CreateFromFile(const char* filename);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new image font a file in memory
|
||||
///
|
||||
/// \param data : Pointer to the file data in memory
|
||||
/// \param sizeInBytes : Size of the data to load, in bytes
|
||||
///
|
||||
/// \return A new sfFont object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFont* sfFont_CreateFromMemory(const void* data, size_t sizeInBytes);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy an existing font
|
||||
///
|
||||
/// \param font : Font to copy
|
||||
///
|
||||
/// \return Copied object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFont* sfFont_Copy(sfFont* font);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing font
|
||||
///
|
||||
/// \param font : Font to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfFont_Destroy(sfFont* font);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get a glyph in a font
|
||||
///
|
||||
/// \param font : Source font
|
||||
/// \param codePoint : Unicode code point of the character to get
|
||||
/// \param characterSize : Character size, in pixels
|
||||
/// \param bold Retrieve the bold version or the regular one?
|
||||
///
|
||||
/// \return The corresponding glyph
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfGlyph sfFont_GetGlyph(sfFont* font, sfUint32 codePoint, unsigned int characterSize, sfBool bold);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the kerning value corresponding to a given pair of characters in a font
|
||||
///
|
||||
/// \param font : Source font
|
||||
/// \param first : Unicode code point of the first character
|
||||
/// \param second : Unicode code point of the second character
|
||||
/// \param characterSize : Character size, in pixels
|
||||
///
|
||||
/// \return Kerning offset, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API int sfFont_GetKerning(sfFont* font, sfUint32 first, sfUint32 second, unsigned int characterSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the line spacing value
|
||||
///
|
||||
/// \param font : Source font
|
||||
/// \param codePoint : Unicode code point of the character to get
|
||||
/// \param characterSize : Character size, in pixels
|
||||
///
|
||||
/// \return Line spacing, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API int sfFont_GetLineSpacing(sfFont* font, unsigned int characterSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the image containing the glyphs of a given size in a font
|
||||
///
|
||||
/// \param font : Source font
|
||||
/// \param characterSize : Character size, in pixels
|
||||
///
|
||||
/// \return Read-only pointer to the image
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const sfImage* sfFont_GetImage(sfFont* font, unsigned int characterSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the built-in default font (Arial)
|
||||
///
|
||||
/// \return Pointer to the default font
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const sfFont* sfFont_GetDefaultFont(void);
|
||||
|
||||
|
||||
#endif // SFML_IMAGE_H
|
45
bindings/c/include/SFML/Graphics/Glyph.h
Normal file
45
bindings/c/include/SFML/Graphics/Glyph.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_GLYPH_H
|
||||
#define SFML_GLYPH_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfGlyph describes a glyph (a visual character)
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
int Advance; ///< Offset to move horizontically to the next character
|
||||
sfIntRect Bounds; ///< Bounding rectangle of the glyph, in coordinates relative to the baseline
|
||||
sfIntRect SubRect; ///< Texture coordinates of the glyph inside the font's image
|
||||
} sfGlyph;
|
||||
|
||||
|
||||
#endif // SFML_GLYPH_H
|
254
bindings/c/include/SFML/Graphics/Image.h
Normal file
254
bindings/c/include/SFML/Graphics/Image.h
Normal file
|
@ -0,0 +1,254 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_IMAGE_H
|
||||
#define SFML_IMAGE_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Graphics/Color.h>
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
#include <SFML/Graphics/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new empty image
|
||||
///
|
||||
/// \return A new sfImage object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfImage* sfImage_Create(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new image filled with a color
|
||||
///
|
||||
/// \param width : Image width
|
||||
/// \param height : Image height
|
||||
/// \param color : Image color
|
||||
///
|
||||
/// \return A new sfImage object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfImage* sfImage_CreateFromColor(unsigned int width, unsigned int height, sfColor color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new image from an array of pixels in memory
|
||||
///
|
||||
/// \param width : Image width
|
||||
/// \param height : Image height
|
||||
/// \param data : Pointer to the pixels in memory (assumed format is RGBA)
|
||||
///
|
||||
/// \return A new sfImage object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfImage* sfImage_CreateFromPixels(unsigned int width, unsigned int height, const sfUint8* data);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new image from a file
|
||||
///
|
||||
/// \param filename : Path of the image file to load
|
||||
///
|
||||
/// \return A new sfImage object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfImage* sfImage_CreateFromFile(const char* filename);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new image from a file in memory
|
||||
///
|
||||
/// \param data : Pointer to the file data in memory
|
||||
/// \param sizeInBytes : Size of the data to load, in bytes
|
||||
///
|
||||
/// \return A new sfImage object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfImage* sfImage_CreateFromMemory(const void* data, size_t sizeInBytes);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy an existing image
|
||||
///
|
||||
/// \param image : Image to copy
|
||||
///
|
||||
/// \return Copied object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfImage* sfImage_Copy(sfImage* image);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing image
|
||||
///
|
||||
/// \param image : Image to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfImage_Destroy(sfImage* image);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Save the content of an image to a file
|
||||
///
|
||||
/// \param image : Image to save
|
||||
/// \param filename : Path of the file to save (overwritten if already exist)
|
||||
///
|
||||
/// \return sfTrue if saving was successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfImage_SaveToFile(const sfImage* image, const char* filename);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a transparency mask for an image from a specified colorkey
|
||||
///
|
||||
/// \param image : Image to modify
|
||||
/// \param colorKey : Color to become transparent
|
||||
/// \param alpha : Alpha value to use for transparent pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfImage_CreateMaskFromColor(sfImage* image, sfColor colorKey, sfUint8 alpha);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy pixels from another image onto this one.
|
||||
/// This function does a slow pixel copy and should only
|
||||
/// be used at initialization time
|
||||
///
|
||||
/// \param image : Destination image
|
||||
/// \param source : Source image to copy
|
||||
/// \param destX : X coordinate of the destination position
|
||||
/// \param destY : Y coordinate of the destination position
|
||||
/// \param sourceRect : Sub-rectangle of the source image to copy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfImage_CopyImage(sfImage* image, const sfImage* source, unsigned int destX, unsigned int destY, sfIntRect sourceRect);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create the image from the current contents of the
|
||||
/// given window
|
||||
///
|
||||
/// \param image : Destination image
|
||||
/// \param window : Window to capture
|
||||
/// \param sourceRect : Sub-rectangle of the screen to copy (empty by default - entire image)
|
||||
///
|
||||
/// \return True if creation was successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfImage_CopyScreen(sfImage* image, sfRenderWindow* window, sfIntRect sourceRect);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the color of a pixel of an image
|
||||
///
|
||||
/// \param image : Image to modify
|
||||
/// \param x : X coordinate of pixel in the image
|
||||
/// \param y : Y coordinate of pixel in the image
|
||||
/// \param color : New color for pixel (X, Y)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfImage_SetPixel(sfImage* image, unsigned int x, unsigned int y, sfColor color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get a pixel from an image
|
||||
///
|
||||
/// \param image : Image to read
|
||||
/// \param x : X coordinate of pixel in the image
|
||||
/// \param y : Y coordinate of pixel in the image
|
||||
///
|
||||
/// \return Color of pixel (x, y)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfColor sfImage_GetPixel(const sfImage* image, unsigned int x, unsigned int y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get a read-only pointer to the array of pixels of an image (8 bits integers RGBA)
|
||||
/// Array size is sfImage_GetWidth(img) x sfImage_GetHeight(img) x 4
|
||||
/// This pointer becomes invalid if you reload or resize the image
|
||||
///
|
||||
/// \param image : Image to read
|
||||
///
|
||||
/// \return Pointer to the array of pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const sfUint8* sfImage_GetPixelsPtr(const sfImage* image);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Update a sub-rectangle of the image from an array of pixels
|
||||
///
|
||||
/// Warning: for performances reasons, this function doesn't
|
||||
/// perform any check; thus you're responsible of ensuring that
|
||||
/// \a rectangle does not exceed the image size, and that
|
||||
/// \a pixels contains enough elements.
|
||||
///
|
||||
/// \param image : Image to update
|
||||
/// \param rectangle : Sub-rectangle of the image to update
|
||||
/// \param pixels : Array of pixels to write to the image
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfImage_UpdatePixels(const sfImage* image, const sfUint8* pixels, sfIntRect rectangle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Bind the image for rendering
|
||||
///
|
||||
/// \param image : Image to bind
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfImage_Bind(const sfImage* image);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Enable or disable image smooth filter
|
||||
///
|
||||
/// \param image : Image to modify
|
||||
/// \param smooth : sfTrue to enable smoothing filter, false to disable it
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfImage_SetSmooth(sfImage* image, sfBool smooth);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the width of the image
|
||||
///
|
||||
/// \param image : Image to read
|
||||
///
|
||||
/// \return Width in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfImage_GetWidth(const sfImage* image);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the height of the image
|
||||
///
|
||||
/// \param image : Image to read
|
||||
///
|
||||
/// \return Height in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfImage_GetHeight(const sfImage* image);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tells whether the smoothing filter is enabled or not on an image
|
||||
///
|
||||
/// \param image : Image to read
|
||||
///
|
||||
/// \return sfTrue if the smoothing filter is enabled
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfImage_IsSmooth(const sfImage* image);
|
||||
|
||||
|
||||
#endif // SFML_IMAGE_H
|
81
bindings/c/include/SFML/Graphics/Rect.h
Normal file
81
bindings/c/include/SFML/Graphics/Rect.h
Normal file
|
@ -0,0 +1,81 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_RECT_H
|
||||
#define SFML_RECT_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfFloatRect and sfIntRect are utility classes for
|
||||
/// manipulating rectangles.
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
float Left;
|
||||
float Top;
|
||||
float Width;
|
||||
float Height;
|
||||
} sfFloatRect;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int Left;
|
||||
int Top;
|
||||
int Width;
|
||||
int Height;
|
||||
} sfIntRect;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Check if a point is inside a rectangle's area
|
||||
///
|
||||
/// \param rect : Rectangle to test
|
||||
/// \param x : X coordinate of the point to test
|
||||
/// \param y : Y coordinate of the point to test
|
||||
///
|
||||
/// \return sfTrue if the point is inside
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfFloatRect_Contains(const sfFloatRect* rect, float x, float y);
|
||||
CSFML_API sfBool sfIntRect_Contains(const sfIntRect* rect, int x, int y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Check intersection between two rectangles
|
||||
///
|
||||
/// \param rect1 : First rectangle to test
|
||||
/// \param rect2 : Second rectangle to test
|
||||
/// \param intersection : Rectangle to be filled with overlapping rect (can be NULL)
|
||||
///
|
||||
/// \return sfTrue if rectangles overlap
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfFloatRect_Intersects(const sfFloatRect* rect1, const sfFloatRect* rect2, sfFloatRect* intersection);
|
||||
CSFML_API sfBool sfIntRect_Intersects(const sfIntRect* rect1, const sfIntRect* rect2, sfIntRect* intersection);
|
||||
|
||||
|
||||
#endif // SFML_RECT_H
|
214
bindings/c/include/SFML/Graphics/RenderImage.h
Normal file
214
bindings/c/include/SFML/Graphics/RenderImage.h
Normal file
|
@ -0,0 +1,214 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_RENDERIMAGE_H
|
||||
#define SFML_RENDERIMAGE_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Graphics/Color.h>
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
#include <SFML/Graphics/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new renderimage
|
||||
///
|
||||
/// \param width : Width of the renderimage
|
||||
/// \param height : Height of the renderimage
|
||||
/// \param depthBuffer : Do you want a depth-buffer attached? (useful only if you're doing 3D OpenGL on the renderimage)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfRenderImage* sfRenderImage_Create(unsigned int width, unsigned int height, sfBool depthBuffer);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing renderimage
|
||||
///
|
||||
/// \param renderImage : renderimage to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderImage_Destroy(sfRenderImage* renderImage);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the width of the rendering region of a renderimage
|
||||
///
|
||||
/// \param renderImage : Renderimage object
|
||||
///
|
||||
/// \return Width in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfRenderImage_GetWidth(const sfRenderImage* renderImage);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the height of the rendering region of a renderimage
|
||||
///
|
||||
/// \param renderImage : Renderimage object
|
||||
///
|
||||
/// \return Height in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfRenderImage_GetHeight(const sfRenderImage* renderImage);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Activate or deactivate a renderimage as the current target for rendering
|
||||
///
|
||||
/// \param renderImage : Renderimage object
|
||||
/// \param active : sfTrue to activate, sfFalse to deactivate
|
||||
///
|
||||
/// \return True if operation was successful, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfRenderImage_SetActive(sfRenderImage* renderImage, sfBool active);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Save the current OpenGL render states and matrices
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderImage_SaveGLStates(sfRenderImage* renderImage);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Restore the previously saved OpenGL render states and matrices
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderImage_RestoreGLStates(sfRenderImage* renderImage);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Update the contents of the target image
|
||||
///
|
||||
/// \param renderImage : Renderimage object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderImage_Display(sfRenderImage* renderImage);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Draw something on a renderimage
|
||||
///
|
||||
/// \param renderImage : Renderimage to draw in
|
||||
/// \param sprite / text / shape : Object to draw
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderImage_DrawSprite(sfRenderImage* renderImage, const sfSprite* sprite);
|
||||
CSFML_API void sfRenderImage_DrawShape (sfRenderImage* renderImage, const sfShape* shape);
|
||||
CSFML_API void sfRenderImage_DrawText (sfRenderImage* renderImage, const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Draw something on a renderimage with a shader
|
||||
///
|
||||
/// \param renderImage : Renderimage to draw in
|
||||
/// \param sprite / text / shape : Object to draw
|
||||
/// \param shader : Shader to use
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderImage_DrawSpriteWithShader(sfRenderImage* renderImage, const sfSprite* sprite, const sfShader* shader);
|
||||
CSFML_API void sfRenderImage_DrawShapeWithShader (sfRenderImage* renderImage, const sfShape* shape, const sfShader* shader);
|
||||
CSFML_API void sfRenderImage_DrawTextWithShader (sfRenderImage* renderImage, const sfText* text, const sfShader* shader);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Clear the renderimage with the given color
|
||||
///
|
||||
/// \param renderImage : Renderimage to modify
|
||||
/// \param color : Fill color
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderImage_Clear(sfRenderImage* renderImage, sfColor color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the current active view of a renderimage
|
||||
///
|
||||
/// \param renderImage : Renderimage to modify
|
||||
/// \param view : Pointer to the new view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderImage_SetView(sfRenderImage* renderImage, const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current active view of a renderimage
|
||||
///
|
||||
/// \param renderImage : Renderimage
|
||||
///
|
||||
/// \return Current active view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const sfView* sfRenderImage_GetView(const sfRenderImage* renderImage);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the default view of a renderimage
|
||||
///
|
||||
/// \param renderImage : Renderimage
|
||||
///
|
||||
/// \return Default view of the renderimage
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const sfView* sfRenderImage_GetDefaultView(const sfRenderImage* renderImage);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the viewport of a view applied to this target
|
||||
///
|
||||
/// \param renderImage : Renderimage object
|
||||
/// \param view : Target view
|
||||
///
|
||||
/// \return Viewport rectangle, expressed in pixels in the current target
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfIntRect sfRenderImage_GetViewport(const sfRenderImage* renderImage, const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Convert a point in image coordinates into view coordinates
|
||||
///
|
||||
/// \param renderImage : Renderimage object
|
||||
/// \param windowX : X coordinate of the point to convert, relative to the image
|
||||
/// \param windowY : Y coordinate of the point to convert, relative to the image
|
||||
/// \param viewX : Pointer to fill with the X coordinate of the converted point
|
||||
/// \param viewY : Pointer to fill with the Y coordinate of the converted point
|
||||
/// \param targetView : Target view to convert the point to (pass NULL to use the current view)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderImage_ConvertCoords(const sfRenderImage* renderImage, unsigned int windowX, unsigned int windowY, float* viewX, float* viewY, const sfView* targetView);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the target image
|
||||
///
|
||||
/// \param renderImage : Renderimage object
|
||||
///
|
||||
/// \return Pointer to the target image
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const sfImage* sfRenderImage_GetImage(const sfRenderImage* renderImage);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Check whether the system supports render images or not
|
||||
///
|
||||
/// \return sfTrue if the RenderImage class can be used
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfRenderImage_IsAvailable(void);
|
||||
|
||||
|
||||
#endif // SFML_RENDERIMAGE_H
|
386
bindings/c/include/SFML/Graphics/RenderWindow.h
Normal file
386
bindings/c/include/SFML/Graphics/RenderWindow.h
Normal file
|
@ -0,0 +1,386 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_RENDERWINDOW_H
|
||||
#define SFML_RENDERWINDOW_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Graphics/Color.h>
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
#include <SFML/Graphics/Types.h>
|
||||
#include <SFML/Window/Event.h>
|
||||
#include <SFML/Window/VideoMode.h>
|
||||
#include <SFML/Window/WindowHandle.h>
|
||||
#include <SFML/Window/Window.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new renderwindow
|
||||
///
|
||||
/// \param mode : Video mode to use
|
||||
/// \param title : Title of the window
|
||||
/// \param style : Window style
|
||||
/// \param settings : Creation settings (pass NULL to use default values)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfRenderWindow* sfRenderWindow_Create(sfVideoMode mode, const char* title, unsigned long style, const sfContextSettings* settings);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a renderwindow from an existing control
|
||||
///
|
||||
/// \param handle : Platform-specific handle of the control
|
||||
/// \param settings : Creation settings (pass NULL to use default values)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfRenderWindow* sfRenderWindow_CreateFromHandle(sfWindowHandle handle, const sfContextSettings* settings);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing renderwindow
|
||||
///
|
||||
/// \param renderWindow : Renderwindow to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_Destroy(sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Close a renderwindow (but doesn't destroy the internal data)
|
||||
///
|
||||
/// \param renderWindow : Renderwindow to close
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_Close(sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell whether or not a renderwindow is opened
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfRenderWindow_IsOpened(const sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the width of the rendering region of a window
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
///
|
||||
/// \return Width in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfRenderWindow_GetWidth(const sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the height of the rendering region of a window
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
///
|
||||
/// \return Height in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfRenderWindow_GetHeight(const sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the creation settings of a window
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
///
|
||||
/// \return Settings used to create the window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfContextSettings sfRenderWindow_GetSettings(const sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the event on top of events stack of a window, if any, and pop it
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
/// \param event : Event to fill, if any
|
||||
///
|
||||
/// \return sfTrue if an event was returned, sfFalse if events stack was empty
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfRenderWindow_GetEvent(sfRenderWindow* renderWindow, sfEvent* event);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Wait for an event and return it
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
/// \param event : Event to fill
|
||||
///
|
||||
/// \return sfFalse if an error occured
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfRenderWindow_WaitEvent(sfRenderWindow* renderWindow, sfEvent* event);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Enable / disable vertical synchronization on a window
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
/// \param enabled : sfTrue to enable v-sync, sfFalse to deactivate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_UseVerticalSync(sfRenderWindow* renderWindow, sfBool enabled);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Show or hide the mouse cursor on a window
|
||||
///
|
||||
/// \param renderWindow : RenderWindow object
|
||||
/// \param show : sfTrue to show, sfFalse to hide
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_ShowMouseCursor(sfRenderWindow* renderWindow, sfBool show);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the position of the mouse cursor on a window
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
/// \param left : Left coordinate of the cursor, relative to the window
|
||||
/// \param top : Top coordinate of the cursor, relative to the window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_SetCursorPosition(sfRenderWindow* renderWindow, unsigned int left, unsigned int top);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the position of a window on screen.
|
||||
/// Only works for top-level windows
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
/// \param left : Left position
|
||||
/// \param top : Top position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_SetPosition(sfRenderWindow* renderWindow, int left, int top);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the size of the rendering region of a window
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
/// \param width : New Width
|
||||
/// \param height : New Height
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_SetSize(sfRenderWindow* renderWindow, unsigned int width, unsigned int height);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Show or hide a window
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
/// \param show : sfTrue to show, sfFalse to hide
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_Show(sfRenderWindow* renderWindow, sfBool show);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Enable or disable automatic key-repeat for keydown events.
|
||||
/// Automatic key-repeat is enabled by default
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
/// \param enabled : sfTrue to enable, sfFalse to disable
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_EnableKeyRepeat(sfRenderWindow* renderWindow, sfBool enabled);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the window's icon
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
/// \param width : Icon's width, in pixels
|
||||
/// \param height : Icon's height, in pixels
|
||||
/// \param pixels : Pointer to the pixels in memory, format must be RGBA 32 bits
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_SetIcon(sfRenderWindow* renderWindow, unsigned int width, unsigned int height, const sfUint8* pixels);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Activate or deactivate a window as the current target for rendering
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
/// \param active : sfTrue to activate, sfFalse to deactivate
|
||||
///
|
||||
/// \return True if operation was successful, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfRenderWindow_SetActive(sfRenderWindow* renderWindow, sfBool active);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Save the current OpenGL render states and matrices
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_SaveGLStates(sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Restore the previously saved OpenGL render states and matrices
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_RestoreGLStates(sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Display a window on screen
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_Display(sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the input manager of a window
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
///
|
||||
/// \return Reference to the input
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const sfInput* sfRenderWindow_GetInput(const sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Limit the framerate to a maximum fixed frequency for a window
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
/// \param limit : Framerate limit, in frames per seconds (use 0 to disable limit)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_SetFramerateLimit(sfRenderWindow* renderWindow, unsigned int limit);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get time elapsed since last frame of a window
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
///
|
||||
/// \return Time elapsed, in seconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfRenderWindow_GetFrameTime(const sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the joystick threshold, ie. the value below which
|
||||
/// no move event will be generated
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
/// \param threshold : New threshold, in range [0, 100]
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_SetJoystickThreshold(sfRenderWindow* renderWindow, float threshold);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Retrieve the Os-specific handle of a window
|
||||
///
|
||||
/// \param renderWindow : Renderwindow object
|
||||
///
|
||||
/// \return Window handle
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfWindowHandle sfRenderWindow_GetSystemHandle(const sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Draw something on a renderwindow
|
||||
///
|
||||
/// \param renderWindow : Renderwindow to draw in
|
||||
/// \param sprite / text / shape : Object to draw
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_DrawSprite(sfRenderWindow* renderWindow, const sfSprite* sprite);
|
||||
CSFML_API void sfRenderWindow_DrawShape (sfRenderWindow* renderWindow, const sfShape* shape);
|
||||
CSFML_API void sfRenderWindow_DrawText (sfRenderWindow* renderWindow, const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Draw something on a renderwindow with a shader
|
||||
///
|
||||
/// \param renderWindow : Renderwindow to draw in
|
||||
/// \param sprite / text / shape : Object to draw
|
||||
/// \param shader : Shader to use
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_DrawSpriteWithShader(sfRenderWindow* renderWindow, const sfSprite* sprite, const sfShader* shader);
|
||||
CSFML_API void sfRenderWindow_DrawShapeWithShader (sfRenderWindow* renderWindow, const sfShape* shape, const sfShader* shader);
|
||||
CSFML_API void sfRenderWindow_DrawTextWithShader (sfRenderWindow* renderWindow, const sfText* text, const sfShader* shader);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Clear the screen with the given color
|
||||
///
|
||||
/// \param renderWindow : Renderwindow to modify
|
||||
/// \param color : Fill color
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_Clear(sfRenderWindow* renderWindow, sfColor color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the current active view of a renderwindow
|
||||
///
|
||||
/// \param renderWindow : Renderwindow to modify
|
||||
/// \param view : Pointer to the new view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_SetView(sfRenderWindow* renderWindow, const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current active view of a renderwindow
|
||||
///
|
||||
/// \param renderWindow : Renderwindow
|
||||
///
|
||||
/// \return Current active view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const sfView* sfRenderWindow_GetView(const sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the default view of a renderwindow
|
||||
///
|
||||
/// \param renderWindow : Renderwindow
|
||||
///
|
||||
/// \return Default view of the render window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const sfView* sfRenderWindow_GetDefaultView(const sfRenderWindow* renderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the viewport of a view applied to this target
|
||||
///
|
||||
/// \param renderWindow : Renderwindow
|
||||
/// \param view : Target view
|
||||
///
|
||||
/// \return Viewport rectangle, expressed in pixels in the current target
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfIntRect sfRenderWindow_GetViewport(const sfRenderWindow* renderWindow, const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Convert a point in window coordinates into view coordinates
|
||||
///
|
||||
/// \param renderWindow : Target Renderwindow
|
||||
/// \param windowX : X coordinate of the point to convert, relative to the window
|
||||
/// \param windowY : Y coordinate of the point to convert, relative to the window
|
||||
/// \param viewX : Pointer to fill with the X coordinate of the converted point
|
||||
/// \param viewY : Pointer to fill with the Y coordinate of the converted point
|
||||
/// \param targetView : Target view to convert the point to (pass NULL to use the current view)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_ConvertCoords(const sfRenderWindow* renderWindow, unsigned int windowX, unsigned int windowY, float* viewX, float* viewY, const sfView* targetView);
|
||||
|
||||
|
||||
#endif // SFML_RENDERWINDOW_H
|
148
bindings/c/include/SFML/Graphics/Shader.h
Normal file
148
bindings/c/include/SFML/Graphics/Shader.h
Normal file
|
@ -0,0 +1,148 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SHADER_H
|
||||
#define SFML_SHADER_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Graphics/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new shader from a file
|
||||
///
|
||||
/// \param filename : File to load
|
||||
///
|
||||
/// \return A new sfShader object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfShader* sfShader_CreateFromFile(const char* filename);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new shader from an effect source code
|
||||
///
|
||||
/// \param effect : Source code of the effect
|
||||
///
|
||||
/// \return A new sfShader object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfShader* sfShader_CreateFromMemory(const char* effect);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy an existing shader
|
||||
///
|
||||
/// \param shader : Shader to copy
|
||||
///
|
||||
/// \return Copied object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfShader* sfShader_Copy(sfShader* shader);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing shader
|
||||
///
|
||||
/// \param shader : Shader to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShader_Destroy(sfShader* shader);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change a parameter of a shader (1 float)
|
||||
///
|
||||
/// \param shader : Shader to modify
|
||||
/// \param name : Parameter name in the effect
|
||||
/// \param x : Value to assign
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShader_SetParameter1(sfShader* shader, const char* name, float x);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change a parameter of a shader (2 floats)
|
||||
///
|
||||
/// \param shader : Shader to modify
|
||||
/// \param name : Parameter name in the effect
|
||||
/// \param x, y : Values to assign
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShader_SetParameter2(sfShader* shader, const char* name, float x, float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change a parameter of a shader (3 floats)
|
||||
///
|
||||
/// \param shader : Shader to modify
|
||||
/// \param name : Parameter name in the effect
|
||||
/// \param x, y, z : Values to assign
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShader_SetParameter3(sfShader* shader, const char* name, float x, float y, float z);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change a parameter of a shader (4 floats)
|
||||
///
|
||||
/// \param shader : Shader to modify
|
||||
/// \param name : Parameter name in the effect
|
||||
/// \param x, y, z, w : Values to assign
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShader_SetParameter4(sfShader* shader, const char* name, float x, float y, float z, float w);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set a texture parameter in a shader
|
||||
///
|
||||
/// \param shader : Shader to modify
|
||||
/// \param name : Texture name in the effect
|
||||
/// \param texture : Image to set (pass NULL to use the texture of the object being drawn)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShader_SetTexture(sfShader* shader, const char* name, const sfImage* texture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Bind a shader for rendering
|
||||
///
|
||||
/// \param shader : Shader to bind
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShader_Bind(const sfShader* shader);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Unbind a shader
|
||||
///
|
||||
/// \param shader : Shader to unbind
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShader_Unbind(const sfShader* shader);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell whether or not the system supports shaders
|
||||
///
|
||||
/// \return sfTrue if the system can use shaders
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfShader_IsAvailable(void);
|
||||
|
||||
|
||||
#endif // SFML_SHADER_H
|
464
bindings/c/include/SFML/Graphics/Shape.h
Normal file
464
bindings/c/include/SFML/Graphics/Shape.h
Normal file
|
@ -0,0 +1,464 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SHAPE_H
|
||||
#define SFML_SHAPE_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Graphics/BlendMode.h>
|
||||
#include <SFML/Graphics/Color.h>
|
||||
#include <SFML/Graphics/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new shape
|
||||
///
|
||||
/// \return A new sfShape object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfShape* sfShape_Create(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new shape made of a single line
|
||||
///
|
||||
/// \param p1x, p1y : Position of the first point
|
||||
/// \param p2x, p2y : Position second point
|
||||
/// \param thickness : Line thickness
|
||||
/// \param color : Color used to draw the line
|
||||
/// \param outline : Outline width
|
||||
/// \param outlineColor : Color used to draw the outline
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfShape* sfShape_CreateLine(float p1x, float p1y, float p2x, float p2y, float thickness, sfColor color, float outline, sfColor outlineColor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new shape made of a single rectangle
|
||||
///
|
||||
/// \param left, top : Top-left corner of the rectangle
|
||||
/// \param width, height : Size of the rectangle
|
||||
/// \param color : Color used to fill the rectangle
|
||||
/// \param outline : Outline width
|
||||
/// \param outlineColor : Color used to draw the outline
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfShape* sfShape_CreateRectangle(float left, float top, float width, float height, sfColor color, float outline, sfColor outlineColor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new shape made of a single circle
|
||||
///
|
||||
/// \param x, y : Position of the center
|
||||
/// \param radius : Radius
|
||||
/// \param color : Color used to fill the circle
|
||||
/// \param outline : Outline width
|
||||
/// \param outlineColor : Color used to draw the outline
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfShape* sfShape_CreateCircle(float x, float y, float radius, sfColor color, float outline, sfColor outlineColor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy an existing shape
|
||||
///
|
||||
/// \param shape : Shape to copy
|
||||
///
|
||||
/// \return Copied object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfShape* sfShape_Copy(sfShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing Shape
|
||||
///
|
||||
/// \param Shape : Shape to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_Destroy(sfShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the X position of a shape
|
||||
///
|
||||
/// \param shape : Shape to modify
|
||||
/// \param x : New X coordinate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_SetX(sfShape* shape, float x);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the Y position of a shape
|
||||
///
|
||||
/// \param shape : Shape to modify
|
||||
/// \param y : New Y coordinate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_SetY(sfShape* shape, float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the position of a shape
|
||||
///
|
||||
/// \param shape : Shape to modify
|
||||
/// \param x : New X coordinate
|
||||
/// \param y : New Y coordinate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_SetPosition(sfShape* shape, float x, float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the horizontal scale of a shape
|
||||
///
|
||||
/// \param shape : Shape to modify
|
||||
/// \param scale : New scale (must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_SetScaleX(sfShape* shape, float scale);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the vertical scale of a shape
|
||||
///
|
||||
/// \param shape : Shape to modify
|
||||
/// \param scale : New scale (must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_SetScaleY(sfShape* shape, float scale);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the scale of a shape
|
||||
///
|
||||
/// \param shape : Shape to modify
|
||||
/// \param scaleX : New horizontal scale (must be strictly positive)
|
||||
/// \param scaleY : New vertical scale (must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_SetScale(sfShape* shape, float scaleX, float scaleY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the orientation of a shape
|
||||
///
|
||||
/// \param shape : Shape to modify
|
||||
/// \param rotation : Angle of rotation, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_SetRotation(sfShape* shape, float rotation);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the local origin of a shape, in coordinates relative to
|
||||
/// its left-top corner
|
||||
///
|
||||
/// \param shape : Shape to modify
|
||||
/// \param x : X coordinate of the origin
|
||||
/// \param y : Y coordinate of the origin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_SetOrigin(sfShape* shape, float x, float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the color of a shape
|
||||
///
|
||||
/// \param shape : Shape to modify
|
||||
/// \param color : New color
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_SetColor(sfShape* shape, sfColor color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the blending mode for a shape
|
||||
///
|
||||
/// \param shape : Shape to modify
|
||||
/// \param mode : New blending mode
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_SetBlendMode(sfShape* shape, sfBlendMode mode);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the X position of a shape
|
||||
///
|
||||
/// \param shape : Shape to read
|
||||
///
|
||||
/// \return Current X position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfShape_GetX(const sfShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the Y position of a shape
|
||||
///
|
||||
/// \param shape : Shape to read
|
||||
///
|
||||
/// \return Current Y position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfShape_GetY(const sfShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the horizontal scale of a shape
|
||||
///
|
||||
/// \param shape : Shape to read
|
||||
///
|
||||
/// \return Current X scale factor (always positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfShape_GetScaleX(const sfShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the vertical scale of a shape
|
||||
///
|
||||
/// \param shape : Shape to read
|
||||
///
|
||||
/// \return Current Y scale factor (always positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfShape_GetScaleY(const sfShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the orientation of a shape
|
||||
///
|
||||
/// \param shape : Shape to read
|
||||
///
|
||||
/// \return Current rotation, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfShape_GetRotation(const sfShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the X position of the origin a shape
|
||||
///
|
||||
/// \param shape : Shape to read
|
||||
///
|
||||
/// \return Current X origin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfShape_GetOriginX(const sfShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the Y position of the origin a shape
|
||||
///
|
||||
/// \param shape : Shape to read
|
||||
///
|
||||
/// \return Current Y origin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfShape_GetOriginY(const sfShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the color of a shape
|
||||
///
|
||||
/// \param shape : Shape to read
|
||||
///
|
||||
/// \return Current color
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfColor sfShape_GetColor(const sfShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current blending mode of a shape
|
||||
///
|
||||
/// \param shape : Shape to read
|
||||
///
|
||||
/// \return Current blending mode
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBlendMode sfShape_GetBlendMode(const sfShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Move a shape
|
||||
///
|
||||
/// \param shape : Shape to modify
|
||||
/// \param offsetX : Offset on the X axis
|
||||
/// \param offsetY : Offset on the Y axis
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_Move(sfShape* shape, float offsetX, float offsetY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Scale a shape
|
||||
///
|
||||
/// \param shape : Shape to modify
|
||||
/// \param factorX : Horizontal scaling factor (must be strictly positive)
|
||||
/// \param factorY : Vertical scaling factor (must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_Scale(sfShape* shape, float factorX, float factorY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Rotate a shape
|
||||
///
|
||||
/// \param shape : Shape to modify
|
||||
/// \param angle : Angle of rotation, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_Rotate(sfShape* shape, float angle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from global coordinates into the shape's local coordinates
|
||||
/// (ie it applies the inverse of object's origin, translation, rotation and scale to the point)
|
||||
///
|
||||
/// \param shape : Shape object
|
||||
/// \param pointX : X coordinate of the point to transform
|
||||
/// \param pointY : Y coordinate of the point to transform
|
||||
/// \param x : Value to fill with the X coordinate of the converted point
|
||||
/// \param y : Value to fill with the y coordinate of the converted point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_TransformToLocal(const sfShape* shape, float pointX, float pointY, float* x, float* y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from the shape's local coordinates into global coordinates
|
||||
/// (ie it applies the object's origin, translation, rotation and scale to the point)
|
||||
///
|
||||
/// \param shape : Shape object
|
||||
/// \param pointX : X coordinate of the point to transform
|
||||
/// \param pointY : Y coordinate of the point to transform
|
||||
/// \param x : Value to fill with the X coordinate of the converted point
|
||||
/// \param y : Value to fill with the y coordinate of the converted point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_TransformToGlobal(const sfShape* shape, float pointX, float pointY, float* x, float* y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Add a point to a shape
|
||||
///
|
||||
/// \param shape : Shape to modify
|
||||
/// \param x, y : Position of the point
|
||||
/// \param color : Color of the point
|
||||
/// \param outlineColor : Outline color of the point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_AddPoint(sfShape* shape, float x, float y, sfColor color, sfColor outlineColor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Enable or disable filling a shape.
|
||||
/// Fill is enabled by default
|
||||
///
|
||||
/// \param shape : Shape to modify
|
||||
/// \param enable : True to enable, false to disable
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_EnableFill(sfShape* shape, sfBool enable);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Enable or disable drawing a shape outline.
|
||||
/// Outline is enabled by default
|
||||
///
|
||||
/// \param shape : Shape to modify
|
||||
/// \param enable : True to enable, false to disable
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_EnableOutline(sfShape* shape, sfBool enable);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the width of a shape outline
|
||||
///
|
||||
/// \param shape : Shape to modify
|
||||
/// \param width : New width
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_SetOutlineWidth(sfShape* shape, float width);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the width of a shape outline
|
||||
///
|
||||
/// \param shape : Shape to read
|
||||
///
|
||||
/// \param return Current outline width
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfShape_GetOutlineWidth(const sfShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the number of points composing a shape
|
||||
///
|
||||
/// \param shape : Shape to read
|
||||
///
|
||||
/// \return Total number of points
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfShape_GetPointsCount(const sfShape* shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get a the position of a shape's point
|
||||
///
|
||||
/// \param shape : Shape to read
|
||||
/// \param index : Index of the point to get
|
||||
/// \param x : Variable to fill with the X coordinate of the point
|
||||
/// \param y : Variable to fill with the Y coordinate of the point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_GetPointPosition(const sfShape* shape, unsigned int index, float* x, float* y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get a the color of a shape's point
|
||||
///
|
||||
/// \param shape : Shape to read
|
||||
/// \param index : Index of the point to get
|
||||
///
|
||||
/// \return Color of the point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfColor sfShape_GetPointColor(const sfShape* shape, unsigned int index);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get a the outline color of a shape's point
|
||||
///
|
||||
/// \param shape : Shape to read
|
||||
/// \param index : Index of the point to get
|
||||
///
|
||||
/// \return Outline color of the point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfColor sfShape_GetPointOutlineColor(const sfShape* shape, unsigned int index);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set a the position of a shape's point
|
||||
///
|
||||
/// \param shape : Shape to read
|
||||
/// \param index : Index of the point to get
|
||||
/// \param x : X coordinate of the point
|
||||
/// \param y : Y coordinate of the point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_SetPointPosition(sfShape* shape, unsigned int index, float x, float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set a the color of a shape's point
|
||||
///
|
||||
/// \param shape : Shape to read
|
||||
/// \param index : Index of the point to get
|
||||
/// \param color : Color of the point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_SetPointColor(sfShape* shape, unsigned int index, sfColor color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set a the outline color of a shape's point
|
||||
///
|
||||
/// \param shape : Shape to read
|
||||
/// \param index : Index of the point to get
|
||||
/// \param color : Outline color of the point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_SetPointOutlineColor(sfShape* shape, unsigned int index, sfColor color);
|
||||
|
||||
|
||||
#endif // SFML_SHAPE_H
|
403
bindings/c/include/SFML/Graphics/Sprite.h
Normal file
403
bindings/c/include/SFML/Graphics/Sprite.h
Normal file
|
@ -0,0 +1,403 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SPRITE_H
|
||||
#define SFML_SPRITE_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Graphics/BlendMode.h>
|
||||
#include <SFML/Graphics/Color.h>
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
#include <SFML/Graphics/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new sprite
|
||||
///
|
||||
/// \return A new sfSprite object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSprite* sfSprite_Create(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy an existing sprite
|
||||
///
|
||||
/// \param sprite : Sprite to copy
|
||||
///
|
||||
/// \return Copied object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSprite* sfSprite_Copy(sfSprite* sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing sprite
|
||||
///
|
||||
/// \param sprite : Sprite to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSprite_Destroy(sfSprite* sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the X position of a sprite
|
||||
///
|
||||
/// \param sprite : Sprite to modify
|
||||
/// \param x : New X coordinate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSprite_SetX(sfSprite* sprite, float x);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the T position of a sprite
|
||||
///
|
||||
/// \param sprite : Sprite to modify
|
||||
/// \param y : New Y coordinate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSprite_SetY(sfSprite* sprite, float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the position of a sprite
|
||||
///
|
||||
/// \param sprite : Sprite to modify
|
||||
/// \param x : New X coordinate
|
||||
/// \param y : New Y coordinate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSprite_SetPosition(sfSprite* sprite, float x, float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the horizontal scale of a sprite
|
||||
///
|
||||
/// \param sprite : Sprite to modify
|
||||
/// \param scale : New scale (must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSprite_SetScaleX(sfSprite* sprite, float scale);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the vertical scale of a sprite
|
||||
///
|
||||
/// \param sprite : Sprite to modify
|
||||
/// \param scale : New scale (must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSprite_SetScaleY(sfSprite* sprite, float scale);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the scale of a sprite
|
||||
///
|
||||
/// \param sprite : Sprite to modify
|
||||
/// \param scaleX : New horizontal scale (must be strictly positive)
|
||||
/// \param scaleY : New vertical scale (must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSprite_SetScale(sfSprite* sprite, float scaleX, float scaleY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the orientation of a sprite
|
||||
///
|
||||
/// \param sprite : Sprite to modify
|
||||
/// \param rotation : Angle of rotation, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSprite_SetRotation(sfSprite* sprite, float rotation);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the local origin of a sprite, in coordinates relative to
|
||||
/// its left-top corner
|
||||
///
|
||||
/// \param sprite : Sprite to modify
|
||||
/// \param x : X coordinate of the origin
|
||||
/// \param y : Y coordinate of the origin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSprite_SetOrigin(sfSprite* sprite, float x, float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the color of a sprite
|
||||
///
|
||||
/// \param sprite : Sprite to modify
|
||||
/// \param color : New color
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSprite_SetColor(sfSprite* sprite, sfColor color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the blending mode for a sprite
|
||||
///
|
||||
/// \param sprite : Sprite to modify
|
||||
/// \param mode : New blending mode
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSprite_SetBlendMode(sfSprite* sprite, sfBlendMode mode);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the X position of a sprite
|
||||
///
|
||||
/// \param sprite : Sprite to read
|
||||
///
|
||||
/// \return Current X position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSprite_GetX(const sfSprite* sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the Y position of a sprite
|
||||
///
|
||||
/// \param sprite : Sprite to read
|
||||
///
|
||||
/// \return Current Y position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSprite_GetY(const sfSprite* sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the horizontal scale of a sprite
|
||||
///
|
||||
/// \param sprite : Sprite to read
|
||||
///
|
||||
/// \return Current X scale factor (always positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSprite_GetScaleX(const sfSprite* sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the vertical scale of a sprite
|
||||
///
|
||||
/// \param sprite : Sprite to read
|
||||
///
|
||||
/// \return Current Y scale factor (always positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSprite_GetScaleY(const sfSprite* sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the orientation of a sprite
|
||||
///
|
||||
/// \param sprite : Sprite to read
|
||||
///
|
||||
/// \return Current rotation, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSprite_GetRotation(const sfSprite* sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the X position of the origin a sprite
|
||||
///
|
||||
/// \param sprite : Sprite to read
|
||||
///
|
||||
/// \return Current X origin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSprite_GetOriginX(const sfSprite* sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the Y position of the origin a sprite
|
||||
///
|
||||
/// \param sprite : Sprite to read
|
||||
///
|
||||
/// \return Current Y origin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSprite_GetOriginY(const sfSprite* sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the color of a sprite
|
||||
///
|
||||
/// \param sprite : Sprite to read
|
||||
///
|
||||
/// \return Current color
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfColor sfSprite_GetColor(const sfSprite* sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current blending mode of a sprite
|
||||
///
|
||||
/// \param sprite : Sprite to read
|
||||
///
|
||||
/// \return Current blending mode
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBlendMode sfSprite_GetBlendMode(const sfSprite* sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Move a sprite
|
||||
///
|
||||
/// \param sprite : Sprite to modify
|
||||
/// \param offsetX : Offset on the X axis
|
||||
/// \param offsetY : Offset on the Y axis
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSprite_Move(sfSprite* sprite, float offsetX, float offsetY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Scale a sprite
|
||||
///
|
||||
/// \param sprite : Sprite to modify
|
||||
/// \param factorX : Horizontal scaling factor (must be strictly positive)
|
||||
/// \param factorY : Vertical scaling factor (must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSprite_Scale(sfSprite* sprite, float factorX, float factorY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Rotate a sprite
|
||||
///
|
||||
/// \param sprite : Sprite to modify
|
||||
/// \param angle : Angle of rotation, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSprite_Rotate(sfSprite* sprite, float angle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from global coordinates into the sprite's local coordinates
|
||||
/// (ie it applies the inverse of object's origin, translation, rotation and scale to the point)
|
||||
///
|
||||
/// \param sprite : Sprite object
|
||||
/// \param pointX : X coordinate of the point to transform
|
||||
/// \param pointY : Y coordinate of the point to transform
|
||||
/// \param x : Value to fill with the X coordinate of the converted point
|
||||
/// \param y : Value to fill with the y coordinate of the converted point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSprite_TransformToLocal(const sfSprite* sprite, float pointX, float pointY, float* x, float* y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from the sprite's local coordinates into global coordinates
|
||||
/// (ie it applies the object's origin, translation, rotation and scale to the point)
|
||||
///
|
||||
/// \param sprite : Sprite object
|
||||
/// \param pointX : X coordinate of the point to transform
|
||||
/// \param pointY : Y coordinate of the point to transform
|
||||
/// \param x : Value to fill with the X coordinate of the converted point
|
||||
/// \param y : Value to fill with the y coordinate of the converted point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSprite_TransformToGlobal(const sfSprite* sprite, float pointX, float pointY, float* x, float* y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the image of a sprite
|
||||
///
|
||||
/// \param sprite : Sprite to modify
|
||||
/// \param image : New image
|
||||
/// \param adjustToNewSize : If true, the SubRect of the sprite will be adjusted to the size of the new image
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSprite_SetImage(sfSprite* sprite, const sfImage* image, sfBool adjustToNewSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the sub-rectangle of a sprite inside the source image
|
||||
///
|
||||
/// \param sprite : Sprite to modify
|
||||
/// \param rectangle : New sub-rectangle
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSprite_SetSubRect(sfSprite* sprite, sfIntRect rectangle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Resize a sprite (by changing its scale factors)
|
||||
///
|
||||
/// \param sprite : Sprite to modify
|
||||
/// \param width : New width (must be strictly positive)
|
||||
/// \param height : New height (must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSprite_Resize(sfSprite* sprite, float width, float height);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Flip a sprite horizontally
|
||||
///
|
||||
/// \param sprite : Sprite to modify
|
||||
/// \param flipped : sfTrue to flip the sprite
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSprite_FlipX(sfSprite* sprite, sfBool flipped);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Flip a sprite vertically
|
||||
///
|
||||
/// \param sprite : Sprite to modify
|
||||
/// \param flipped : sfTrue to flip the sprite
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSprite_FlipY(sfSprite* sprite, sfBool flipped);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the source image of a sprite
|
||||
///
|
||||
/// \param sprite : Sprite to read
|
||||
///
|
||||
/// \return Pointer to the image (can be NULL)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const sfImage* sfSprite_GetImage(const sfSprite* sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the sub-rectangle of a sprite inside the source image
|
||||
///
|
||||
/// \param sprite : Sprite to read
|
||||
///
|
||||
/// \return Sub-rectangle
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfIntRect sfSprite_GetSubRect(const sfSprite* sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get a sprite width
|
||||
///
|
||||
/// \param sprite : Sprite to read
|
||||
///
|
||||
/// \return Width of the sprite
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSprite_GetWidth(const sfSprite* sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get a sprite height
|
||||
///
|
||||
/// \param sprite : Sprite to read
|
||||
///
|
||||
/// \return Height of the sprite
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSprite_GetHeight(const sfSprite* sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the color of a given pixel in a sprite
|
||||
///
|
||||
/// \param sprite : Sprite to read
|
||||
/// \param x : X coordinate of the pixel to get
|
||||
/// \param y : Y coordinate of the pixel to get
|
||||
///
|
||||
/// \return Color of pixel (X, Y)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfColor sfSprite_GetPixel(const sfSprite* sprite, unsigned int x, unsigned int y);
|
||||
|
||||
|
||||
#endif // SFML_SPRITE_H
|
434
bindings/c/include/SFML/Graphics/Text.h
Normal file
434
bindings/c/include/SFML/Graphics/Text.h
Normal file
|
@ -0,0 +1,434 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_TEXT_H
|
||||
#define SFML_TEXT_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Graphics/BlendMode.h>
|
||||
#include <SFML/Graphics/Color.h>
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
#include <SFML/Graphics/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfText styles
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
sfTextRegular = 0, ///< Regular characters, no style
|
||||
sfTextBold = 1 << 0, ///< Characters are bold
|
||||
sfTextItalic = 1 << 1, ///< Characters are in italic
|
||||
sfTextUnderlined = 1 << 2 ///< Characters are underlined
|
||||
} sfTextStyle;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new text
|
||||
///
|
||||
/// \return A new sfText object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfText* sfText_Create(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy an existing text
|
||||
///
|
||||
/// \param text : Text to copy
|
||||
///
|
||||
/// \return Copied object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfText* sfText_Copy(sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing text
|
||||
///
|
||||
/// \param text : Text to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfText_Destroy(sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the X position of a text
|
||||
///
|
||||
/// \param text : String to modify
|
||||
/// \param x : New X coordinate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfText_SetX(sfText* text, float x);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the Y position of a text
|
||||
///
|
||||
/// \param text : String to modify
|
||||
/// \param y : New Y coordinate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfText_SetY(sfText* text, float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the position of a text
|
||||
///
|
||||
/// \param text : String to modify
|
||||
/// \param x : New X coordinate
|
||||
/// \param y : New Y coordinate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfText_SetPosition(sfText* text, float x, float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the horizontal scale of a text
|
||||
///
|
||||
/// \param text : String to modify
|
||||
/// \param scale : New scale (must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfText_SetScaleX(sfText* text, float scale);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the vertical scale of a text
|
||||
///
|
||||
/// \param text : String to modify
|
||||
/// \param scale : New scale (must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfText_SetScaleY(sfText* text, float scale);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the scale of a text
|
||||
///
|
||||
/// \param text : String to modify
|
||||
/// \param scaleX : New horizontal scale (must be strictly positive)
|
||||
/// \param scaleY : New vertical scale (must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfText_SetScale(sfText* text, float scaleX, float scaleY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the orientation of a text
|
||||
///
|
||||
/// \param text : String to modify
|
||||
/// \param rotation : Angle of rotation, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfText_SetRotation(sfText* text, float rotation);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the local origin of a text, in coordinates
|
||||
/// relative to its left-top corner
|
||||
///
|
||||
/// \param text : String to modify
|
||||
/// \param x : X coordinate of the origin
|
||||
/// \param y : Y coordinate of the origin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfText_SetOrigin(sfText* text, float x, float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the color of a text
|
||||
///
|
||||
/// \param text : String to modify
|
||||
/// \param color : New color
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfText_SetColor(sfText* text, sfColor color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the blending mode for a text
|
||||
///
|
||||
/// \param text : String to modify
|
||||
/// \param mode : New blending mode
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfText_SetBlendMode(sfText* text, sfBlendMode mode);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the X position of a text
|
||||
///
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Current X position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfText_GetX(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the top Y of a text
|
||||
///
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Current Y position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfText_GetY(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the horizontal scale of a text
|
||||
///
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Current X scale factor (always positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfText_GetScaleX(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the vertical scale of a text
|
||||
///
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Current Y scale factor (always positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfText_GetScaleY(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the orientation of a text
|
||||
///
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Current rotation, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfText_GetRotation(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the X position of the origin a text
|
||||
///
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Current X origin position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfText_GetOriginX(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the top Y of the origin of a text
|
||||
///
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Current Y origin position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfText_GetOriginY(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the color of a text
|
||||
///
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Current color
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfColor sfText_GetColor(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current blending mode of a text
|
||||
///
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Current blending mode
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBlendMode sfText_GetBlendMode(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Move a text
|
||||
///
|
||||
/// \param text : String to modify
|
||||
/// \param offsetX : Offset on the X axis
|
||||
/// \param offsetY : Offset on the Y axis
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfText_Move(sfText* text, float offsetX, float offsetY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Scale a text
|
||||
///
|
||||
/// \param text : String to modify
|
||||
/// \param factorX : Horizontal scaling factor (must be strictly positive)
|
||||
/// \param factorY : Vertical scaling factor (must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfText_Scale(sfText* text, float factorX, float factorY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Rotate a text
|
||||
///
|
||||
/// \param text : String to modify
|
||||
/// \param angle : Angle of rotation, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfText_Rotate(sfText* text, float angle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from global coordinates into the string's local coordinates
|
||||
/// (ie it applies the inverse of object's origin, translation, rotation and scale to the point)
|
||||
///
|
||||
/// \param text : String object
|
||||
/// \param pointX : X coordinate of the point to transform
|
||||
/// \param pointY : Y coordinate of the point to transform
|
||||
/// \param x : Value to fill with the X coordinate of the converted point
|
||||
/// \param y : Value to fill with the y coordinate of the converted point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfText_TransformToLocal(const sfText* text, float pointX, float pointY, float* x, float* y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from the string's local coordinates into global coordinates
|
||||
/// (ie it applies the object's origin, translation, rotation and scale to the point)
|
||||
///
|
||||
/// \param text : String object
|
||||
/// \param pointX : X coordinate of the point to transform
|
||||
/// \param pointY : Y coordinate of the point to transform
|
||||
/// \param x : Value to fill with the X coordinate of the converted point
|
||||
/// \param y : Value to fill with the y coordinate of the converted point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfText_TransformToGlobal(const sfText* text, float pointX, float pointY, float* X, float* y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the string of a text (from a multibyte string)
|
||||
///
|
||||
/// \param text : Text to modify
|
||||
/// \param string : New string
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfText_SetString(sfText* text, const char* string);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the string of a text (from a unicode string)
|
||||
///
|
||||
/// \param text : Text to modify
|
||||
/// \param string : New string
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfText_SetUnicodeString(sfText* text, const sfUint32* string);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the font of a text
|
||||
///
|
||||
/// \param text : String to modify
|
||||
/// \param font : Font to use
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfText_SetFont(sfText* text, const sfFont* font);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the size of a text
|
||||
///
|
||||
/// \param text : String to modify
|
||||
/// \param size : New size, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfText_SetCharacterSize(sfText* text, unsigned int size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the style of a text
|
||||
///
|
||||
/// \param text : String to modify
|
||||
/// \param style : New style (see sfTextStyle enum)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfText_SetStyle(sfText* text, unsigned long style);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the string of a text (returns a unicode string)
|
||||
///
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return String as UTF-32
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const sfUint32* sfText_GetUnicodeString(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the text of a text (returns an ANSI string)
|
||||
///
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return String an a locale-dependant ANSI string
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const char* sfText_GetString(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the font used by a text
|
||||
///
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Pointer to the font
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const sfFont* sfText_GetFont(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the size of the characters of a text
|
||||
///
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Size of the characters
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfText_GetCharacterSize(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the style of a text
|
||||
///
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Current string style (see sfTextStyle enum)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned long sfText_GetStyle(const sfText* text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the visual position of the Index-th character of the text,
|
||||
/// in coordinates relative to the string
|
||||
/// (note : translation, origin, rotation and scale are not applied)
|
||||
///
|
||||
/// \param text : String to read
|
||||
/// \param index : Index of the character
|
||||
/// \param x : Value to fill with the X coordinate of the position
|
||||
/// \param y : Value to fill with the y coordinate of the position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfText_GetCharacterPos(const sfText* text, size_t index, float* x, float* y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the bounding rectangle of a text on screen
|
||||
///
|
||||
/// \param text : String to read
|
||||
///
|
||||
/// \return Rectangle contaning the string in screen coordinates
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFloatRect sfText_GetRect(const sfText* text);
|
||||
|
||||
|
||||
#endif // SFML_TEXT_H
|
40
bindings/c/include/SFML/Graphics/Types.h
Normal file
40
bindings/c/include/SFML/Graphics/Types.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_GRAPHICS_TYPES_H
|
||||
#define SFML_GRAPHICS_TYPES_H
|
||||
|
||||
|
||||
typedef struct sfFont sfFont;
|
||||
typedef struct sfImage sfImage;
|
||||
typedef struct sfShader sfShader;
|
||||
typedef struct sfRenderImage sfRenderImage;
|
||||
typedef struct sfRenderWindow sfRenderWindow;
|
||||
typedef struct sfShape sfShape;
|
||||
typedef struct sfSprite sfSprite;
|
||||
typedef struct sfText sfText;
|
||||
typedef struct sfView sfView;
|
||||
|
||||
|
||||
#endif // SFML_GRAPHICS_TYPES_H
|
209
bindings/c/include/SFML/Graphics/View.h
Normal file
209
bindings/c/include/SFML/Graphics/View.h
Normal file
|
@ -0,0 +1,209 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_VIEW_H
|
||||
#define SFML_VIEW_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
#include <SFML/Graphics/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a default view (1000x1000)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfView* sfView_Create(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a view from a rectangle
|
||||
///
|
||||
/// \param rectangle : Rectangle defining the bounds of the view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfView* sfView_CreateFromRect(sfFloatRect rectangle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy an existing view
|
||||
///
|
||||
/// \param view : View to copy
|
||||
///
|
||||
/// \return Copied object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfView* sfView_Copy(sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing view
|
||||
///
|
||||
/// \param view : View to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfView_Destroy(sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the center of a view
|
||||
///
|
||||
/// \param view : View to modify
|
||||
/// \param x : X coordinate of the new center
|
||||
/// \param y : Y coordinate of the new center
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfView_SetCenter(sfView* view, float x, float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the size of a view
|
||||
///
|
||||
/// \param view : View to modify
|
||||
/// \param width : New width
|
||||
/// \param height : New height
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfView_SetSize(sfView* view, float width, float height);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the angle of rotation of a view
|
||||
///
|
||||
/// \param view : View to modify
|
||||
/// \param angle : New angle, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfView_SetRotation(sfView* view, float angle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the target viewport of a view
|
||||
///
|
||||
/// The viewport is the rectangle into which the contents of the
|
||||
/// view are displayed, expressed as a factor (between 0 and 1)
|
||||
/// of the size of the RenderTarget to which the view is applied.
|
||||
///
|
||||
/// \param view : View to modify
|
||||
/// \param viewport : New viewport
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfView_SetViewport(sfView* view, sfFloatRect viewport);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Reset a view to the given rectangle.
|
||||
/// Note: this function resets the rotation angle to 0.
|
||||
///
|
||||
/// \param view : View to modify
|
||||
/// \param rectangle : Rectangle defining the position and size of the view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfView_Reset(sfView* view, sfFloatRect rectangle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the X coordinate of the center of a view
|
||||
///
|
||||
/// \param view : View to read
|
||||
///
|
||||
/// \return X coordinate of the center of the view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfView_GetCenterX(const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the Y coordinate of the center of a view
|
||||
///
|
||||
/// \param view : View to read
|
||||
///
|
||||
/// \return Y coordinate of the center of the view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfView_GetCenterY(const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the width of the view
|
||||
///
|
||||
/// \param view : View to read
|
||||
///
|
||||
/// \return Width of the view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfView_GetWidth(const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the height of the view
|
||||
///
|
||||
/// \param view : View to read
|
||||
///
|
||||
/// \return Height of the view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfView_GetHeight(const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current rotation of a view
|
||||
///
|
||||
/// \param view : View to read
|
||||
///
|
||||
/// \return Rotation of the view, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfView_GetRotation(const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the target viewport of a view
|
||||
///
|
||||
/// \param view : View to read
|
||||
///
|
||||
/// \return Viewport rectangle, expressed as a factor of the target size
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFloatRect sfView_GetViewport(const sfView* view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Move a view
|
||||
///
|
||||
/// \param view : View to move
|
||||
/// \param offsetX : Offset to move the view, on X axis
|
||||
/// \param offsetY : Offset to move the view, on Y axis
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfView_Move(sfView* view, float offsetX, float offsetY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Rotate a view
|
||||
///
|
||||
/// \param view : View to rotate
|
||||
/// \param angle : Angle in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfView_Rotate(sfView* view, float angle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Resize a view rectangle to simulate a zoom / unzoom effect
|
||||
///
|
||||
/// \param view : View to zoom
|
||||
/// \param factor : Zoom factor to apply, relative to the current zoom
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfView_Zoom(sfView* view, float factor);
|
||||
|
||||
|
||||
#endif // SFML_VIEW_H
|
41
bindings/c/include/SFML/Network.h
Normal file
41
bindings/c/include/SFML/Network.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_NETWORK_H
|
||||
#define SFML_NETWORK_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#include <SFML/System.h>
|
||||
#include <SFML/Network/IpAddress.h>
|
||||
#include <SFML/Network/Packet.h>
|
||||
#include <SFML/Network/SocketSelector.h>
|
||||
#include <SFML/Network/TcpListener.h>
|
||||
#include <SFML/Network/TcpSocket.h>
|
||||
#include <SFML/Network/UdpSocket.h>
|
||||
|
||||
|
||||
#endif // SFML_NETWORK_H
|
449
bindings/c/include/SFML/Network/Ftp.h
Normal file
449
bindings/c/include/SFML/Network/Ftp.h
Normal file
|
@ -0,0 +1,449 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_FTP_H
|
||||
#define SFML_FTP_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Network/IpAddress.h>
|
||||
#include <SFML/Network/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Enumerate all the FTP file transfer modes
|
||||
////////////////////////////////////////////////////////////
|
||||
enum sfFtpTransferMode
|
||||
{
|
||||
sfFtpBinary, ///< Binary mode (file is transfered as a sequence of bytes)
|
||||
sfFtpAscii, ///< Text mode using ASCII encoding
|
||||
sfFtpEbcdic ///< Text mode using EBCDIC encoding
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Enumerate all the valid status codes returned in
|
||||
/// a FTP response
|
||||
////////////////////////////////////////////////////////////
|
||||
enum sfFtpStatus
|
||||
{
|
||||
// 1xx: the requested action is being initiated,
|
||||
// expect another reply before proceeding with a new command
|
||||
sfFtpRestartMarkerReply = 110, ///< Restart marker reply
|
||||
sfFtpServiceReadySoon = 120, ///< Service ready in N minutes
|
||||
sfFtpDataConnectionAlreadyOpened = 125, ///< Data connection already opened, transfer starting
|
||||
sfFtpOpeningDataConnection = 150, ///< File status ok, about to open data connection
|
||||
|
||||
// 2xx: the requested action has been successfully completed
|
||||
sfFtpOk = 200, ///< Command ok
|
||||
sfFtpPointlessCommand = 202, ///< Command not implemented
|
||||
sfFtpSystemStatus = 211, ///< System status, or system help reply
|
||||
sfFtpDirectoryStatus = 212, ///< Directory status
|
||||
sfFtpFileStatus = 213, ///< File status
|
||||
sfFtpHelpMessage = 214, ///< Help message
|
||||
sfFtpSystemType = 215, ///< NAME system type, where NAME is an official system name from the list in the Assigned Numbers document
|
||||
sfFtpServiceReady = 220, ///< Service ready for new user
|
||||
sfFtpClosingConnection = 221, ///< Service closing control connection
|
||||
sfFtpDataConnectionOpened = 225, ///< Data connection open, no transfer in progress
|
||||
sfFtpClosingDataConnection = 226, ///< Closing data connection, requested file action successful
|
||||
sfFtpEnteringPassiveMode = 227, ///< Entering passive mode
|
||||
sfFtpLoggedIn = 230, ///< User logged in, proceed. Logged out if appropriate
|
||||
sfFtpFileActionOk = 250, ///< Requested file action ok
|
||||
sfFtpDirectoryOk = 257, ///< PATHNAME created
|
||||
|
||||
// 3xx: the command has been accepted, but the requested action
|
||||
// is dormant, pending receipt of further information
|
||||
sfFtpNeedPassword = 331, ///< User name ok, need password
|
||||
sfFtpNeedAccountToLogIn = 332, ///< Need account for login
|
||||
sfFtpNeedInformation = 350, ///< Requested file action pending further information
|
||||
|
||||
// 4xx: the command was not accepted and the requested action did not take place,
|
||||
// but the error condition is temporary and the action may be requested again
|
||||
sfFtpServiceUnavailable = 421, ///< Service not available, closing control connection
|
||||
sfFtpDataConnectionUnavailable = 425, ///< Can't open data connection
|
||||
sfFtpTransferAborted = 426, ///< Connection closed, transfer aborted
|
||||
sfFtpFileActionAborted = 450, ///< Requested file action not taken
|
||||
sfFtpLocalError = 451, ///< Requested action aborted, local error in processing
|
||||
sfFtpInsufficientStorageSpace = 452, ///< Requested action not taken; insufficient storage space in system, file unavailable
|
||||
|
||||
// 5xx: the command was not accepted and
|
||||
// the requested action did not take place
|
||||
sfFtpCommandUnknown = 500, ///< Syntax error, command unrecognized
|
||||
sfFtpParametersUnknown = 501, ///< Syntax error in parameters or arguments
|
||||
sfFtpCommandNotImplemented = 502, ///< Command not implemented
|
||||
sfFtpBadCommandSequence = 503, ///< Bad sequence of commands
|
||||
sfFtpParameterNotImplemented = 504, ///< Command not implemented for that parameter
|
||||
sfFtpNotLoggedIn = 530, ///< Not logged in
|
||||
sfFtpNeedAccountToStore = 532, ///< Need account for storing files
|
||||
sfFtpFileUnavailable = 550, ///< Requested action not taken, file unavailable
|
||||
sfFtpPageTypeUnknown = 551, ///< Requested action aborted, page type unknown
|
||||
sfFtpNotEnoughMemory = 552, ///< Requested file action aborted, exceeded storage allocation
|
||||
sfFtpFilenameNotAllowed = 553, ///< Requested action not taken, file name not allowed
|
||||
|
||||
// 10xx: SFML custom codes
|
||||
sfFtpInvalidResponse = 1000, ///< Response is not a valid FTP one
|
||||
sfFtpConnectionFailed = 1001, ///< Connection with server failed
|
||||
sfFtpConnectionClosed = 1002, ///< Connection with server closed
|
||||
sfFtpInvalidFile = 1003 ///< Invalid file to upload / download
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing Ftp listing response
|
||||
///
|
||||
/// \param ftpListingResponse : Ftp listing response to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfFtpListingResponse_Destroy(sfFtpListingResponse* ftpListingResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Convenience function to check if the response status code
|
||||
/// means a success
|
||||
///
|
||||
/// \param ftpListingResponse : Ftp listing response
|
||||
///
|
||||
/// \return sfTrue if status is success (code < 400)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfFtpListingResponse_IsOk(const sfFtpListingResponse* ftpListingResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the response status code
|
||||
///
|
||||
/// \param ftpListingResponse : Ftp listing response
|
||||
///
|
||||
/// \return Status code
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFtpStatus sfFtpListingResponse_GetStatus(const sfFtpListingResponse* ftpListingResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the full message contained in the response
|
||||
///
|
||||
/// \param ftpListingResponse : Ftp listing response
|
||||
///
|
||||
/// \return The response message
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const char* sfFtpListingResponse_GetMessage(const sfFtpListingResponse* ftpListingResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the number of filenames in the listing
|
||||
///
|
||||
/// \param ftpListingResponse : Ftp listing response
|
||||
///
|
||||
/// \return Total number of filenames
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API size_t sfFtpListingResponse_GetCount(const sfFtpListingResponse* ftpListingResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the Index-th filename in the directory
|
||||
///
|
||||
/// \param ftpListingResponse : Ftp listing response
|
||||
/// \param index : Index of the filename to get
|
||||
///
|
||||
/// \return Index-th filename
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const char* sfFtpListingResponse_GetFilename(const sfFtpListingResponse* ftpListingResponse, size_t index);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing Ftp directory response
|
||||
///
|
||||
/// \param ftpDirectoryResponse : Ftp directory response to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfFtpDirectoryResponse_Destroy(sfFtpDirectoryResponse* ftpDirectoryResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Convenience function to check if the response status code
|
||||
/// means a success
|
||||
///
|
||||
/// \param ftpDirectoryResponse : Ftp directory response
|
||||
///
|
||||
/// \return sfTrue if status is success (code < 400)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfFtpDirectoryResponse_IsOk(const sfFtpDirectoryResponse* ftpDirectoryResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the response status code
|
||||
///
|
||||
/// \param ftpDirectoryResponse : Ftp directory response
|
||||
///
|
||||
/// \return Status code
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFtpStatus sfFtpDirectoryResponse_GetStatus(const sfFtpDirectoryResponse* ftpDirectoryResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the full message contained in the response
|
||||
///
|
||||
/// \param ftpDirectoryResponse : Ftp directory response
|
||||
///
|
||||
/// \return The response message
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const char* sfFtpDirectoryResponse_GetMessage(const sfFtpDirectoryResponse* ftpDirectoryResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the directory returned in the response
|
||||
///
|
||||
/// \param ftpDirectoryResponse : Ftp directory response
|
||||
///
|
||||
/// \return Directory name
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const char* sfFtpDirectoryResponse_GetDirectory(const sfFtpDirectoryResponse* ftpDirectoryResponse);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing Ftp response
|
||||
///
|
||||
/// \param ftpResponse : Ftp response to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfFtpResponse_Destroy(sfFtpResponse* ftpResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Convenience function to check if the response status code
|
||||
/// means a success
|
||||
///
|
||||
/// \param ftpResponse : Ftp response
|
||||
///
|
||||
/// \return sfTrue if status is success (code < 400)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfFtpResponse_IsOk(const sfFtpResponse* ftpResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the response status code
|
||||
///
|
||||
/// \param ftpResponse : Ftp response
|
||||
///
|
||||
/// \return Status code
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFtpStatus sfFtpResponse_GetStatus(const sfFtpResponse* ftpResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the full message contained in the response
|
||||
///
|
||||
/// \param ftpResponse : Ftp response
|
||||
///
|
||||
/// \return The response message
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const char* sfFtpResponse_GetMessage(const sfFtpResponse* ftpResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new Ftp
|
||||
///
|
||||
/// \return Pointer to the new Ftp
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFtp* sfFtp_Create(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing Ftp
|
||||
///
|
||||
/// \param ftp : Ftp to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfFtp_Destroy(sfFtp* ftp);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Connect to the specified FTP server
|
||||
///
|
||||
/// \param ftp : Ftp instance
|
||||
/// \param server : FTP server to connect to
|
||||
/// \param port : Port used for connection (21 by default, standard FTP port)
|
||||
/// \param timeout : Maximum time to wait (0 to use no timeout)
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFtpResponse* sfFtp_Connect(sfFtp* ftp, sfIpAddress server, unsigned short port, float timeout);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Log in using anonymous account
|
||||
///
|
||||
/// \param ftp : Ftp instance
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFtpResponse* sfFtp_LoginAnonymous(sfFtp* ftp);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Log in using a username and a password
|
||||
///
|
||||
/// \param ftp : Ftp instance
|
||||
/// \param userName : User name
|
||||
/// \param password : Password
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFtpResponse* sfFtp_Login(sfFtp* ftp, const char* userName, const char* password);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Close the connection with FTP server
|
||||
///
|
||||
/// \param ftp : Ftp instance
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFtpResponse* sfFtp_Disconnect(sfFtp* ftp);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Send a null command just to prevent from being disconnected
|
||||
///
|
||||
/// \param ftp : Ftp instance
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFtpResponse* sfFtp_KeepAlive(sfFtp* ftp);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current working directory
|
||||
///
|
||||
/// \param ftp : Ftp instance
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFtpDirectoryResponse* sfFtp_GetWorkingDirectory(sfFtp* ftp);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the contents of the given directory
|
||||
/// (subdirectories and files)
|
||||
///
|
||||
/// \param ftp : Ftp instance
|
||||
/// \param directory : Directory to list ("" by default, the current one)
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFtpListingResponse* sfFtp_GetDirectoryListing(sfFtp* ftp, const char* directory);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the current working directory
|
||||
///
|
||||
/// \param ftp : Ftp instance
|
||||
/// \param directory : New directory, relative to the current one
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFtpResponse* sfFtp_ChangeDirectory(sfFtp* ftp, const char* directory);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Go to the parent directory of the current one
|
||||
///
|
||||
/// \param ftp : Ftp instance
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFtpResponse* sfFtp_ParentDirectory(sfFtp* ftp);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new directory
|
||||
///
|
||||
/// \param ftp : Ftp instance
|
||||
/// \param name : Name of the directory to create
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFtpResponse* sfFtp_CreateDirectory(sfFtp* ftp, const char* name);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Remove an existing directory
|
||||
///
|
||||
/// \param ftp : Ftp instance
|
||||
/// \param name : Name of the directory to remove
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFtpResponse* sfFtp_DeleteDirectory(sfFtp* ftp, const char* name);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Rename a file
|
||||
///
|
||||
/// \param ftp : Ftp instance
|
||||
/// \param file : File to rename
|
||||
/// \param newName : New name
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFtpResponse* sfFtp_RenameFile(sfFtp* ftp, const char* file, const char* newName);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Remove an existing file
|
||||
///
|
||||
/// \param ftp : Ftp instance
|
||||
/// \param name : File to remove
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFtpResponse* sfFtp_DeleteFile(sfFtp* ftp, const char* name);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Download a file from the server
|
||||
///
|
||||
/// \param ftp : Ftp instance
|
||||
/// \param distantFile : Path of the distant file to download
|
||||
/// \param destPath : Where to put to file on the local computer
|
||||
/// \param mode : Transfer mode (binary by default)
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFtpResponse* sfFtp_Download(sfFtp* ftp, const char* distantFile, const char* destPath, sfFtpTransferMode mode);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Upload a file to the server
|
||||
///
|
||||
/// \param ftp : Ftp instance
|
||||
/// \param localFile : Path of the local file to upload
|
||||
/// \param destPath : Where to put to file on the server
|
||||
/// \param mode : Transfer mode (binary by default)
|
||||
///
|
||||
/// \return Server response to the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFtpResponse* sfFtp_Upload(sfFtp* ftp, const char* localFile, const char* destPath, sfFtpTransferMode mode);
|
||||
|
||||
|
||||
#endif // SFML_FTP_H
|
257
bindings/c/include/SFML/Network/Http.h
Normal file
257
bindings/c/include/SFML/Network/Http.h
Normal file
|
@ -0,0 +1,257 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_HTTP_H
|
||||
#define SFML_HTTP_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Network/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Enumerate the available HTTP methods for a request
|
||||
////////////////////////////////////////////////////////////
|
||||
enum sfHttpMethod
|
||||
{
|
||||
sfHttpGet, ///< Request in get mode, standard method to retrieve a page
|
||||
sfHttpPost, ///< Request in post mode, usually to send data to a page
|
||||
sfHttpHead ///< Request a page's header only
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Enumerate all the valid status codes returned in
|
||||
/// a HTTP response
|
||||
////////////////////////////////////////////////////////////
|
||||
enum sfHttpStatus
|
||||
{
|
||||
// 2xx: success
|
||||
sfHttpOk = 200, ///< Most common code returned when operation was successful
|
||||
sfHttpCreated = 201, ///< The resource has successfully been created
|
||||
sfHttpAccepted = 202, ///< The request has been accepted, but will be processed later by the server
|
||||
sfHttpNoContent = 204, ///< Sent when the server didn't send any data in return
|
||||
|
||||
// 3xx: redirection
|
||||
sfHttpMultipleChoices = 300, ///< The requested page can be accessed from several locations
|
||||
sfHttpMovedPermanently = 301, ///< The requested page has permanently moved to a new location
|
||||
sfHttpMovedTemporarily = 302, ///< The requested page has temporarily moved to a new location
|
||||
sfHttpNotModified = 304, ///< For conditionnal requests, means the requested page hasn't changed and doesn't need to be refreshed
|
||||
|
||||
// 4xx: client error
|
||||
sfHttpBadRequest = 400, ///< The server couldn't understand the request (syntax error)
|
||||
sfHttpUnauthorized = 401, ///< The requested page needs an authentification to be accessed
|
||||
sfHttpForbidden = 403, ///< The requested page cannot be accessed at all, even with authentification
|
||||
sfHttpNotFound = 404, ///< The requested page doesn't exist
|
||||
|
||||
// 5xx: server error
|
||||
sfHttpInternalServerError = 500, ///< The server encountered an unexpected error
|
||||
sfHttpNotImplemented = 501, ///< The server doesn't implement a requested feature
|
||||
sfHttpBadGateway = 502, ///< The gateway server has received an error from the source server
|
||||
sfHttpServiceNotAvailable = 503, ///< The server is temporarily unavailable (overloaded, in maintenance, ...)
|
||||
|
||||
// 10xx: SFML custom codes
|
||||
sfHttpInvalidResponse = 1000, ///< Response is not a valid HTTP one
|
||||
sfHttpConnectionFailed = 1001 ///< Connection with server failed
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new Http request
|
||||
///
|
||||
/// \return Pointer to the new Http request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfHttpRequest* sfHttpRequest_Create(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing Http request
|
||||
///
|
||||
/// \param httpRequest : Http request to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfHttpRequest_Destroy(sfHttpRequest* httpRequest);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the value of a field; the field is added if it doesn't exist
|
||||
///
|
||||
/// \param httpRequest : Http request to modify
|
||||
/// \param field : Name of the field to set (case-insensitive)
|
||||
/// \param value : Value of the field
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfHttpRequest_SetField(sfHttpRequest* httpRequest, const char* field, const char* value);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the request method.
|
||||
/// This parameter is sfHttpGet by default
|
||||
///
|
||||
/// \param httpRequest : Http request to modify
|
||||
/// \param method : Method to use for the request
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfHttpRequest_SetMethod(sfHttpRequest* httpRequest, sfHttpMethod method);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the target URI of the request.
|
||||
/// This parameter is "/" by default
|
||||
///
|
||||
/// \param httpRequest : Http request to modify
|
||||
/// \param URI : URI to request, local to the host
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfHttpRequest_SetUri(sfHttpRequest* httpRequest, const char* uri);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the HTTP version of the request.
|
||||
/// This parameter is 1.0 by default
|
||||
///
|
||||
/// \param httpRequest : Http request to modify
|
||||
/// \param major : Major version number
|
||||
/// \param minor : Minor version number
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfHttpRequest_SetHttpVersion(sfHttpRequest* httpRequest, unsigned int major, unsigned int minor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the body of the request. This parameter is optional and
|
||||
/// makes sense only for POST requests.
|
||||
/// This parameter is empty by default
|
||||
///
|
||||
/// \param httpRequest : Http request to modify
|
||||
/// \param body : Content of the request body
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfHttpRequest_SetBody(sfHttpRequest* httpRequest, const char* body);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing Http response
|
||||
///
|
||||
/// \param httpResponse : Http response to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfHttpResponse_Destroy(sfHttpResponse* httpResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the value of a field; returns NULL if the field doesn't exist
|
||||
///
|
||||
/// \param httpResponse : Http response
|
||||
/// \param field : Field to get
|
||||
///
|
||||
/// \return Value of the field (NULL if it doesn't exist)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const char* sfHttpResponse_GetField(const sfHttpResponse* httpResponse, const char* field);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the status of a response
|
||||
///
|
||||
/// \param httpResponse : Http response
|
||||
///
|
||||
/// \return Status of the response
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfHttpStatus sfHttpResponse_GetStatus(const sfHttpResponse* httpResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the major HTTP version of a response
|
||||
///
|
||||
/// \param httpResponse : Http response
|
||||
///
|
||||
/// \return HTTP major version of the response
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfHttpResponse_GetMajorVersion(const sfHttpResponse* httpResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the minor HTTP version of a response
|
||||
///
|
||||
/// \param httpResponse : Http response
|
||||
///
|
||||
/// \return HTTP minor version of the response
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfHttpResponse_GetMinorVersion(const sfHttpResponse* httpResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the body of the response. The body can contain :
|
||||
/// - the requested page (for GET requests)
|
||||
/// - a response from the server (for POST requests)
|
||||
/// - nothing (for HEAD requests)
|
||||
/// - an error message (in case of an error)
|
||||
///
|
||||
/// \param httpResponse : Http response
|
||||
///
|
||||
/// \return Body of the response (empty string if no body)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const char* sfHttpResponse_GetBody(const sfHttpResponse* httpResponse);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new Http object
|
||||
///
|
||||
/// \return Pointer to the new Http
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfHttp* sfHttp_Create(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing Http object
|
||||
///
|
||||
/// \param Http : Http to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfHttp_Destroy(sfHttp* http);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the target host of a Http server
|
||||
///
|
||||
/// \param http : Http object
|
||||
/// \param host : Web server to connect to
|
||||
/// \param port : Port to use for connection (0 to use the standard port of the protocol used)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfHttp_SetHost(sfHttp* http, const char* host, unsigned short port);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Send a HTTP request and return the server's response.
|
||||
/// You must be connected to a host before sending requests.
|
||||
/// Any missing mandatory header field will be added with an appropriate value.
|
||||
/// Warning : this function waits for the server's response and may
|
||||
/// not return instantly; use a thread if you don't want to block your
|
||||
/// application.
|
||||
///
|
||||
/// \param http : Http object
|
||||
/// \param request : Request to send
|
||||
/// \param timeout : Maximum time to wait (0 to use no timeout)
|
||||
///
|
||||
/// \return Server's response, or NULL if request is invalid
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfHttpResponse* sfHttp_SendRequest(sfHttp* http, const sfHttpRequest* request, float timeout);
|
||||
|
||||
|
||||
#endif // SFML_HTTP_H
|
131
bindings/c/include/SFML/Network/IpAddress.h
Normal file
131
bindings/c/include/SFML/Network/IpAddress.h
Normal file
|
@ -0,0 +1,131 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_IPADDRESS_H
|
||||
#define SFML_IPADDRESS_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfIpAddress provides easy manipulation of IP v4 addresses
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
char Address[16];
|
||||
} sfIpAddress;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct an address from a string
|
||||
///
|
||||
/// \param string : IP address ("xxx.xxx.xxx.xxx") or network name
|
||||
///
|
||||
/// \return Resulting address
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfIpAddress sfIpAddress_FromString(const char* string);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct an address from 4 bytes
|
||||
///
|
||||
/// \param byte0 : First byte of the address
|
||||
/// \param byte1 : Second byte of the address
|
||||
/// \param byte2 : Third byte of the address
|
||||
/// \param byte3 : Fourth byte of the address
|
||||
///
|
||||
/// \return Resulting address
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfIpAddress sfIpAddress_FromBytes(sfUint8 byte0, sfUint8 byte1, sfUint8 byte2, sfUint8 byte3);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct the address from a 32-bits integer
|
||||
///
|
||||
/// \param address : 4 bytes of the address packed into a 32-bits integer
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfIpAddress sfIpAddress_FromInteger(sfUint32 address);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get a string representation of an address
|
||||
///
|
||||
/// \param address : Address to convert
|
||||
/// \param string : Char array to fill (size must be >= 16)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfIpAddress_ToString(sfIpAddress address, char* string);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get an integer representation of the address
|
||||
///
|
||||
/// \param address : Address to convert
|
||||
///
|
||||
/// \return 32-bits integer containing the 4 bytes of the address, in system endianness
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfUint32 sfIpAddress_ToInteger(sfIpAddress address);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the computer's local IP address (from the LAN point of view)
|
||||
///
|
||||
/// \return Local IP address
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfIpAddress sfIpAddress_GetLocalAddress(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the computer's public IP address (from the web point of view).
|
||||
/// The only way to get a public address is to ask it to a
|
||||
/// distant website ; as a consequence, this function may be
|
||||
/// very slow -- use it as few as possible !
|
||||
///
|
||||
/// \param timeout : Maximum time to wait, in seconds (use 0 for no timeout)
|
||||
///
|
||||
/// \return Public IP address
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfIpAddress sfIpAddress_GetPublicAddress(float timeout);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the computer's loopback address
|
||||
///
|
||||
/// \return Local host IP address (127.0.0.1, or "localhost")
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfIpAddress sfIpAddress_LocalHost(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the empty/invalid address
|
||||
///
|
||||
/// \return Empty object that represents invalid addresses
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfIpAddress sfIpAddress_None(void);
|
||||
|
||||
|
||||
#endif // SFML_IPADDRESS_H
|
158
bindings/c/include/SFML/Network/Packet.h
Normal file
158
bindings/c/include/SFML/Network/Packet.h
Normal file
|
@ -0,0 +1,158 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_PACKET_H
|
||||
#define SFML_PACKET_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Network/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new empty packet
|
||||
///
|
||||
/// \return A new sfPacket object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfPacket* sfPacket_Create(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy an existing packet
|
||||
///
|
||||
/// \param packet : Packet to copy
|
||||
///
|
||||
/// \return Copied object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfPacket* sfPacket_Copy(sfPacket* packet);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing packet
|
||||
///
|
||||
/// \param packet : Packet to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfPacket_Destroy(sfPacket* packet);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Append data to the end of a packet
|
||||
///
|
||||
/// \param packet : Packet to fill
|
||||
/// \param data : Pointer to the bytes to append
|
||||
/// \param sizeInBytes : Number of bytes to append
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfPacket_Append(sfPacket* packet, const void* data, size_t sizeInBytes);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Clear all the data of a packet
|
||||
///
|
||||
/// \param packet : Packet to clear
|
||||
///
|
||||
///////////////////////////////////////////////////////////
|
||||
CSFML_API void sfPacket_Clear(sfPacket* packet);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get a pointer to the data contained in a packet
|
||||
/// Warning : the returned pointer may be invalid after you
|
||||
/// append data to the packet
|
||||
///
|
||||
/// \param packet : Packet to get data from
|
||||
///
|
||||
/// \return Pointer to the data
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const char* sfPacket_GetData(const sfPacket* packet);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the size of the data contained in a packet
|
||||
///
|
||||
/// \param packet : Packet to get data size from
|
||||
///
|
||||
/// \return Data size, in bytes
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API size_t sfPacket_GetDataSize(const sfPacket* packet);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell if the reading position has reached the end of the packet
|
||||
///
|
||||
/// \param packet : Packet to check
|
||||
///
|
||||
/// \return sfTrue if all data have been read into the packet
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfPacket_EndOfPacket(const sfPacket* packet);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the validity of packet
|
||||
///
|
||||
/// \param packet : Packet to check
|
||||
///
|
||||
/// \return sfTrue if last data extraction from packet was successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfPacket_CanRead(const sfPacket* packet);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Functions to extract data from a packet
|
||||
///
|
||||
/// \param packet : Packet to read
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfPacket_ReadBool(sfPacket* packet);
|
||||
CSFML_API sfInt8 sfPacket_ReadInt8(sfPacket* packet);
|
||||
CSFML_API sfUint8 sfPacket_ReadUint8(sfPacket* packet);
|
||||
CSFML_API sfInt16 sfPacket_ReadInt16(sfPacket* packet);
|
||||
CSFML_API sfUint16 sfPacket_ReadUint16(sfPacket* packet);
|
||||
CSFML_API sfInt32 sfPacket_ReadInt32(sfPacket* packet);
|
||||
CSFML_API sfUint32 sfPacket_ReadUint32(sfPacket* packet);
|
||||
CSFML_API float sfPacket_ReadFloat(sfPacket* packet);
|
||||
CSFML_API double sfPacket_ReadDouble(sfPacket* packet);
|
||||
CSFML_API void sfPacket_ReadString(sfPacket* packet, char* string);
|
||||
CSFML_API void sfPacket_ReadWideString(sfPacket* packet, wchar_t* string);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Functions to insert data into a packet
|
||||
///
|
||||
/// \param packet : Packet to write
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfPacket_WriteBool(sfPacket* packet, sfBool);
|
||||
CSFML_API void sfPacket_WriteInt8(sfPacket* packet, sfInt8);
|
||||
CSFML_API void sfPacket_WriteUint8(sfPacket* packet, sfUint8);
|
||||
CSFML_API void sfPacket_WriteInt16(sfPacket* packet, sfInt16);
|
||||
CSFML_API void sfPacket_WriteUint16(sfPacket* packet, sfUint16);
|
||||
CSFML_API void sfPacket_WriteInt32(sfPacket* packet, sfInt32);
|
||||
CSFML_API void sfPacket_WriteUint32(sfPacket* packet, sfUint32);
|
||||
CSFML_API void sfPacket_WriteFloat(sfPacket* packet, float);
|
||||
CSFML_API void sfPacket_WriteDouble(sfPacket* packet, double);
|
||||
CSFML_API void sfPacket_WriteString(sfPacket* packet, const char* string);
|
||||
CSFML_API void sfPacket_WriteWideString(sfPacket* packet, const wchar_t* string);
|
||||
|
||||
|
||||
#endif // SFML_PACKET_H
|
118
bindings/c/include/SFML/Network/SocketSelector.h
Normal file
118
bindings/c/include/SFML/Network/SocketSelector.h
Normal file
|
@ -0,0 +1,118 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SOCKETSELECTOR_H
|
||||
#define SFML_SOCKETSELECTOR_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Network/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new selector
|
||||
///
|
||||
/// \return A new sfSelector object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSocketSelector* sfSocketSelector_Create(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy an existing selector
|
||||
///
|
||||
/// \param selector : Selector to copy
|
||||
///
|
||||
/// \return Copied object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSocketSelector* sfSocketSelector_Copy(sfSocketSelector* selector);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing selector
|
||||
///
|
||||
/// \param selector : Selector to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSocketSelector_Destroy(sfSocketSelector* selector);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Add a socket to watch to a selector
|
||||
///
|
||||
/// \param selector : Selector to add the socket to
|
||||
/// \param socket : Socket to add
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSocketSelector_AddTcpListener(sfSocketSelector* selector, sfTcpListener* socket);
|
||||
CSFML_API void sfSocketSelector_AddTcpSocket(sfSocketSelector* selector, sfTcpSocket* socket);
|
||||
CSFML_API void sfSocketSelector_AddUdpSocket(sfSocketSelector* selector, sfUdpSocket* socket);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Remove a socket from a selector
|
||||
///
|
||||
/// \param selector : Selector to remove the socket from
|
||||
/// \param socket : Socket to remove
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSocketSelector_RemoveTcpListener(sfSocketSelector* selector, sfTcpListener* socket);
|
||||
CSFML_API void sfSocketSelector_RemoveTcpSocket(sfSocketSelector* selector, sfTcpSocket* socket);
|
||||
CSFML_API void sfSocketSelector_RemoveUdpSocket(sfSocketSelector* selector, sfUdpSocket* socket);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Remove all sockets from a selector
|
||||
///
|
||||
/// \param selector : Selector to remove the socket from
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSocketSelector_Clear(sfSocketSelector* selector);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Wait and collect sockets which are ready for reading.
|
||||
/// This functions will return either when at least one socket
|
||||
/// is ready, or when the given timeout is over
|
||||
///
|
||||
/// \param selector : Selector to check
|
||||
/// \param timeout : Maximum time to wait, in seconds (0 to disable timeout)
|
||||
///
|
||||
/// \return sfTrue if there are sockets ready, sfFalse otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfSocketSelector_Wait(sfSocketSelector* selector, float timeout);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Test a socket to know if it is ready to receive data
|
||||
///
|
||||
/// \param selector : Selector to check
|
||||
/// \param socket : Socket to test
|
||||
///
|
||||
/// \return sfTrue if the socket is ready to receive data
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfSocketSelector_IsTcpListenerReady(const sfSocketSelector* selector, sfTcpListener* socket);
|
||||
CSFML_API sfBool sfSocketSelector_IsTcpSocketReady(const sfSocketSelector* selector, sfTcpSocket* socket);
|
||||
CSFML_API sfBool sfSocketSelector_IsUdpSocketReady(const sfSocketSelector* selector, sfUdpSocket* socket);
|
||||
|
||||
|
||||
#endif // SFML_SOCKETSELECTOR_H
|
43
bindings/c/include/SFML/Network/SocketStatus.h
Normal file
43
bindings/c/include/SFML/Network/SocketStatus.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SOCKETSTATUS_H
|
||||
#define SFML_SOCKETSTATUS_H
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Define the status that can be returned by the socket
|
||||
/// functions
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
sfSocketDone,
|
||||
sfSocketNotReady,
|
||||
sfSocketDisconnected,
|
||||
sfSocketError
|
||||
|
||||
} sfSocketStatus;
|
||||
|
||||
|
||||
#endif // SFML_SOCKETSTATUS_H
|
97
bindings/c/include/SFML/Network/TcpListener.h
Normal file
97
bindings/c/include/SFML/Network/TcpListener.h
Normal file
|
@ -0,0 +1,97 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_TCPLISTENER_H
|
||||
#define SFML_TCPLISTENER_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Network/SocketStatus.h>
|
||||
#include <SFML/Network/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new TCP socket
|
||||
///
|
||||
/// \return Pointer to the new socket
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfTcpListener* sfTcpListener_Create(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing TCP socket
|
||||
///
|
||||
/// \param socket : Socket to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfTcpListener_Destroy(sfTcpListener* socket);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the blocking state of a TCP socket.
|
||||
/// The default behaviour of a socket is blocking
|
||||
///
|
||||
/// \param socket : Socket to modify
|
||||
/// \param blocking : Pass sfTrue to set the socket as blocking, or sfFalse for non-blocking
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfTcpListener_SetBlocking(sfTcpListener* socket, sfBool blocking);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the blocking state of the socket
|
||||
///
|
||||
/// \param socket : Socket to read
|
||||
///
|
||||
/// \Return sfTrue if the socket is blocking, sfFalse otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfTcpListener_IsBlocking(const sfTcpListener* socket);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Listen to a specified port for incoming data or connections
|
||||
///
|
||||
/// \param socket : Socket to use for listening
|
||||
/// \param port : Port to listen to
|
||||
///
|
||||
/// \return Socket status
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSocketStatus sfTcpListener_Listen(sfTcpListener* socket, unsigned short port);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Wait for a connection (must be listening to a port).
|
||||
/// This function is blocking, ie. it won't return before
|
||||
/// a connection has been accepted
|
||||
///
|
||||
/// \param socket : Socket to use for accepting
|
||||
/// \param connected : Pointer to a socket pointer that will be filled with the connected client
|
||||
///
|
||||
/// \return Socket status
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSocketStatus sfTcpListener_Accept(sfTcpListener* socket, sfTcpSocket** connected);
|
||||
|
||||
|
||||
#endif // SFML_TCPLISTENER_H
|
172
bindings/c/include/SFML/Network/TcpSocket.h
Normal file
172
bindings/c/include/SFML/Network/TcpSocket.h
Normal file
|
@ -0,0 +1,172 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_TCPSOCKET_H
|
||||
#define SFML_TCPSOCKET_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Network/IpAddress.h>
|
||||
#include <SFML/Network/SocketStatus.h>
|
||||
#include <SFML/Network/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new TCP socket
|
||||
///
|
||||
/// \return Pointer to the new socket
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfTcpSocket* sfTcpSocket_Create(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing TCP socket
|
||||
///
|
||||
/// \param socket : Socket to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfTcpSocket_Destroy(sfTcpSocket* socket);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the blocking state of a TCP socket.
|
||||
/// The default behaviour of a socket is blocking
|
||||
///
|
||||
/// \param socket : Socket to modify
|
||||
/// \param blocking : Pass sfTrue to set the socket as blocking, or false for non-blocking
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfTcpSocket_SetBlocking(sfTcpSocket* socket, sfBool blocking);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the blocking state of the socket
|
||||
///
|
||||
/// \param socket : Socket to read
|
||||
///
|
||||
/// \Return sfTrue if the socket is blocking, sfFalse otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfTcpSocket_IsBlocking(const sfTcpSocket* socket);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the port to which a socket is bound locally
|
||||
///
|
||||
/// \param socket : Socket to read
|
||||
///
|
||||
/// \return Port to which the socket is bound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned short sfTcpSocket_GetLocalPort(const sfTcpSocket* socket);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the address of the connected peer of a socket
|
||||
///
|
||||
/// \param socket : Socket to read
|
||||
///
|
||||
/// \return Address of the remote peer
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfIpAddress sfTcpSocket_GetRemoteAddress(const sfTcpSocket* socket);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the port of the connected peer to which a socket is connected
|
||||
///
|
||||
/// \param socket : Socket to read
|
||||
///
|
||||
/// \return Remote port to which the socket is connected
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned short sfTcpSocket_GetRemotePort(const sfTcpSocket* socket);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Connect a TCP socket to another computer on a specified port
|
||||
///
|
||||
/// \param socket : Socket to connect
|
||||
/// \param host : IP Address of the host to connect to
|
||||
/// \param port : Port to use for transfers (warning : ports < 1024 are reserved)
|
||||
/// \param timeout : Maximum time to wait (0 to use no timeout)
|
||||
///
|
||||
/// \return sfTrue if operation has been successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSocketStatus sfTcpSocket_Connect(sfTcpSocket* socket, sfIpAddress host, unsigned short port, float timeout);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Disconnect a connect from its remote peer
|
||||
///
|
||||
/// \param socket : Socket to disconnect
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfTcpSocket_Disconnect(sfTcpSocket* socket);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Send an array of bytes to the host (must be connected first)
|
||||
///
|
||||
/// \param socket : Socket to use for sending
|
||||
/// \param data : Pointer to the bytes to send
|
||||
/// \param size : Number of bytes to send
|
||||
///
|
||||
/// \return Socket status
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSocketStatus sfTcpSocket_Send(sfTcpSocket* socket, const char* data, size_t size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Receive an array of bytes from the host (must be connected first)
|
||||
///
|
||||
/// \param socket : Socket to use for receiving
|
||||
/// \param data : Pointer to a byte array to fill (make sure it is big enough)
|
||||
/// \param maxSize : Maximum number of bytes to read
|
||||
/// \param sizeReceived : Number of bytes received
|
||||
///
|
||||
/// \return Socket status
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSocketStatus sfTcpSocket_Receive(sfTcpSocket* socket, char* data, size_t maxSize, size_t* sizeReceived);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Send a packet of data to the host (must be connected first)
|
||||
///
|
||||
/// \param socket : Socket to use for sending
|
||||
/// \param packet : Packet to send
|
||||
///
|
||||
/// \return Socket status
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSocketStatus sfTcpSocket_SendPacket(sfTcpSocket* socket, sfPacket* packet);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Receive a packet from the host (must be connected first)
|
||||
///
|
||||
/// \param socket : Socket to use for receiving
|
||||
/// \param packet : Packet to fill with received data
|
||||
///
|
||||
/// \return Socket status
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSocketStatus sfTcpSocket_ReceivePacket(sfTcpSocket* socket, sfPacket* packet);
|
||||
|
||||
|
||||
#endif // SFML_TCPSOCKET_H
|
43
bindings/c/include/SFML/Network/Types.h
Normal file
43
bindings/c/include/SFML/Network/Types.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_NETWORK_TYPES_H
|
||||
#define SFML_NETWORK_TYPES_H
|
||||
|
||||
|
||||
typedef struct sfFtpDirectoryResponse sfFtpDirectoryResponse;
|
||||
typedef struct sfFtpListingResponse sfFtpListingResponse;
|
||||
typedef struct sfFtpResponse sfFtpResponse;
|
||||
typedef struct sfFtp sfFtp;
|
||||
typedef struct sfHttpRequest sfHttpRequest;
|
||||
typedef struct sfHttpResponse sfHttpResponse;
|
||||
typedef struct sfHttp sfHttp;
|
||||
typedef struct sfPacket sfPacket;
|
||||
typedef struct sfSocketSelector sfSocketSelector;
|
||||
typedef struct sfTcpListener sfTcpListener;
|
||||
typedef struct sfTcpSocket sfTcpSocket;
|
||||
typedef struct sfUdpSocket sfUdpSocket;
|
||||
|
||||
|
||||
#endif // SFML_NETWORK_TYPES_H
|
162
bindings/c/include/SFML/Network/UdpSocket.h
Normal file
162
bindings/c/include/SFML/Network/UdpSocket.h
Normal file
|
@ -0,0 +1,162 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_UDPSOCKET_H
|
||||
#define SFML_UDPSOCKET_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Network/IpAddress.h>
|
||||
#include <SFML/Network/SocketStatus.h>
|
||||
#include <SFML/Network/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new UDP socket
|
||||
///
|
||||
/// \return Pointer to the new socket
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfUdpSocket* sfUdpSocket_Create(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing UDP socket
|
||||
///
|
||||
/// \param socket : Socket to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfUdpSocket_Destroy(sfUdpSocket* socket);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the blocking state of a UDP socket.
|
||||
/// The default behaviour of a socket is blocking
|
||||
///
|
||||
/// \param socket : Socket to modify
|
||||
/// \param blocking : Pass sfTrue to set the socket as blocking, or false for non-blocking
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfUdpSocket_SetBlocking(sfUdpSocket* socket, sfBool blocking);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the blocking state of the socket
|
||||
///
|
||||
/// \param socket : Socket to read
|
||||
///
|
||||
/// \Return sfTrue if the socket is blocking, sfFalse otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfUdpSocket_IsBlocking(const sfUdpSocket* socket);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the port to which a socket is bound locally
|
||||
///
|
||||
/// \param socket : Socket to read
|
||||
///
|
||||
/// \return Port to which the socket is bound
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned short sfUdpSocket_GetLocalPort(const sfUdpSocket* socket);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Bind a socket to a specific port
|
||||
///
|
||||
/// \param socket : Socket to bind
|
||||
/// \param port : Port to bind the socket to
|
||||
///
|
||||
/// \return Socket status
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSocketStatus sfUdpSocket_Bind(sfUdpSocket* socket, unsigned short port);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Unbind a socket from its previous port, if any
|
||||
///
|
||||
/// \param socket : Socket to unbind
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfUdpSocket_Unbind(sfUdpSocket* socket);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Send an array of bytes
|
||||
///
|
||||
/// \param socket : Socket to use for sending
|
||||
/// \param data : Pointer to the bytes to send
|
||||
/// \param size : Number of bytes to send
|
||||
/// \param address : Address of the computer to send the packet to
|
||||
/// \param port : Port to use for communication
|
||||
///
|
||||
/// \return Socket status
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSocketStatus sfUdpSocket_Send(sfUdpSocket* socket, const char* data, size_t size, sfIpAddress address, unsigned short port);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Receive an array of bytes.
|
||||
/// This function is blocking, ie. it won't return before some
|
||||
/// bytes have been received
|
||||
///
|
||||
/// \param socket : Socket to use for receiving
|
||||
/// \param data : Pointer to a byte array to fill (make sure it is big enough)
|
||||
/// \param maxSize : Maximum number of bytes to read
|
||||
/// \param sizeReceived : Number of bytes received
|
||||
/// \param address : Address of the computer which sent the data
|
||||
/// \param port : Port on which the remote computer sent the data
|
||||
///
|
||||
/// \return Socket status
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSocketStatus sfUdpSocket_Receive(sfUdpSocket* socket, char* data, size_t maxSize, size_t* sizeReceived, sfIpAddress* address, unsigned short* port);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Send a packet of data
|
||||
///
|
||||
/// \param socket : Socket to use for sending
|
||||
/// \param packet : Packet to send
|
||||
/// \param address : Address of the computer to send the packet to
|
||||
/// \param port : Port to use for communication
|
||||
///
|
||||
/// \return Socket status
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSocketStatus sfUdpSocket_SendPacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress address, unsigned short port);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Receive a packet.
|
||||
/// This function is blocking, ie. it won't return before a
|
||||
/// packet is received
|
||||
///
|
||||
/// \param socket : Socket to use for receiving
|
||||
/// \param packet : Packet to fill with received data
|
||||
/// \param address : Address of the computer which sent the packet
|
||||
/// \param port : Port on which the remote computer sent the data
|
||||
///
|
||||
/// \return Socket status
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSocketStatus sfUdpSocket_ReceivePacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress* address, unsigned short* port);
|
||||
|
||||
|
||||
#endif // SFML_UDPSOCKET_H
|
58
bindings/c/include/SFML/OpenGL.h
Normal file
58
bindings/c/include/SFML/OpenGL.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_OPENGL_H
|
||||
#define SFML_OPENGL_H
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// This file just includes the OpenGL (GL and GLU) headers,
|
||||
/// which have actually different paths on each system
|
||||
////////////////////////////////////////////////////////////
|
||||
#if defined(CSFML_SYSTEM_WINDOWS)
|
||||
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
#elif defined(CSFML_SYSTEM_LINUX) || defined(CSFML_SYSTEM_FREEBSD)
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
#elif defined(CSFML_SYSTEM_MACOS)
|
||||
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glu.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif // SFML_OPENGL_H
|
40
bindings/c/include/SFML/System.h
Normal file
40
bindings/c/include/SFML/System.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SYSTEM_H
|
||||
#define SFML_SYSTEM_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/System/Clock.h>
|
||||
#include <SFML/System/Mutex.h>
|
||||
#include <SFML/System/Randomizer.h>
|
||||
#include <SFML/System/Sleep.h>
|
||||
#include <SFML/System/Thread.h>
|
||||
|
||||
|
||||
#endif // SFML_SYSTEM_H
|
78
bindings/c/include/SFML/System/Clock.h
Normal file
78
bindings/c/include/SFML/System/Clock.h
Normal file
|
@ -0,0 +1,78 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_CLOCK_H
|
||||
#define SFML_CLOCK_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/System/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new clock and start it
|
||||
///
|
||||
/// \return A new sfClock object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfClock* sfClock_Create(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy an existing clock
|
||||
///
|
||||
/// \param clock : Clock to copy
|
||||
///
|
||||
/// \return Copied object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfClock* sfClock_Copy(sfClock* clock);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing clock
|
||||
///
|
||||
/// \param clock : Clock to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfClock_Destroy(sfClock* clock);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the time elapsed for a clock
|
||||
///
|
||||
/// \param clock : Clock to get time from
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfClock_GetTime(const sfClock* clock);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Restart a clock
|
||||
///
|
||||
/// \param clock : Clock to restart
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfClock_Reset(sfClock* clock);
|
||||
|
||||
|
||||
#endif // SFML_CLOCK_H
|
68
bindings/c/include/SFML/System/Mutex.h
Normal file
68
bindings/c/include/SFML/System/Mutex.h
Normal file
|
@ -0,0 +1,68 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_MUTEX_H
|
||||
#define SFML_MUTEX_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/System/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new mutex
|
||||
///
|
||||
/// \return A new sfMutex object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfMutex* sfMutex_Create(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing mutex
|
||||
///
|
||||
/// \param mutex : Mutex to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMutex_Destroy(sfMutex* mutex);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Lock a mutex
|
||||
///
|
||||
/// \param mutex : Mutex to lock
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMutex_Lock(sfMutex* mutex);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Unlock a mutex
|
||||
///
|
||||
/// \param mutex : Mutex to unlock
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfMutex_Unlock(sfMutex* mutex);
|
||||
|
||||
|
||||
#endif // SFML_MUTEX_H
|
74
bindings/c/include/SFML/System/Randomizer.h
Normal file
74
bindings/c/include/SFML/System/Randomizer.h
Normal file
|
@ -0,0 +1,74 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_RANDOMIZER_H
|
||||
#define SFML_RANDOMIZER_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the seed for the random numbers generator. Using a known seed
|
||||
/// allows you to reproduce the same sequence of random numbers
|
||||
///
|
||||
/// \param seed : Number to use as the seed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRandom_SetSeed(unsigned int seed);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the seed used to generate random numbers the generator
|
||||
///
|
||||
/// \return Current seed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfRandom_GetSeed(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get a random float number in a given range
|
||||
///
|
||||
/// \return begin : Start of the range
|
||||
/// \return end : End of the range
|
||||
///
|
||||
/// \return Random number in [begin, end]
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfRandom_Float(float begin, float end);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get a random integer number in a given range
|
||||
///
|
||||
/// \return begin : Start of the range
|
||||
/// \return end : End of the range
|
||||
///
|
||||
/// \return Random number in [begin, end]
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API int sfRandom_Int(int begin, int end);
|
||||
|
||||
|
||||
#endif // SFML_RANDOMIZER_H
|
43
bindings/c/include/SFML/System/Sleep.h
Normal file
43
bindings/c/include/SFML/System/Sleep.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SLEEP_H
|
||||
#define SFML_SLEEP_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Make the current thread sleep for a given time
|
||||
///
|
||||
/// \param duration : Time to sleep, in seconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSleep(float duration);
|
||||
|
||||
|
||||
#endif // SFML_SLEEP_H
|
80
bindings/c/include/SFML/System/Thread.h
Normal file
80
bindings/c/include/SFML/System/Thread.h
Normal file
|
@ -0,0 +1,80 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_THREAD_H
|
||||
#define SFML_THREAD_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/System/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new thread from a function pointer
|
||||
///
|
||||
/// \param function : Entry point of the thread
|
||||
/// \param userData : Data to pass to the thread function
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfThread* sfThread_Create(void (*function)(void*), void* userData);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing thread
|
||||
///
|
||||
/// \param thread : Thread to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfThread_Destroy(sfThread* thread);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Run a thread
|
||||
///
|
||||
/// \param thread : Thread to launch
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfThread_Launch(sfThread* thread);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Wait until a thread finishes
|
||||
///
|
||||
/// \param thread : Thread to wait for
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfThread_Wait(sfThread* thread);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Terminate a thread
|
||||
/// Terminating a thread with this function is not safe,
|
||||
/// you should rather try to make the thread function
|
||||
/// terminate by itself
|
||||
///
|
||||
/// \param thread : Thread to terminate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfThread_Terminate(sfThread* thread);
|
||||
|
||||
|
||||
#endif // SFML_THREAD_H
|
33
bindings/c/include/SFML/System/Types.h
Normal file
33
bindings/c/include/SFML/System/Types.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SYSTEM_TYPES_H
|
||||
#define SFML_SYSTEM_TYPES_H
|
||||
|
||||
|
||||
typedef struct sfClock sfClock;
|
||||
typedef struct sfMutex sfMutex;
|
||||
typedef struct sfThread sfThread;
|
||||
|
||||
|
||||
#endif // SFML_SYSTEM_TYPES_H
|
40
bindings/c/include/SFML/Window.h
Normal file
40
bindings/c/include/SFML/Window.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_SFML_WINDOW_H
|
||||
#define SFML_SFML_WINDOW_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#include <SFML/System.h>
|
||||
#include <SFML/Window/Context.h>
|
||||
#include <SFML/Window/Event.h>
|
||||
#include <SFML/Window/Input.h>
|
||||
#include <SFML/Window/VideoMode.h>
|
||||
#include <SFML/Window/Window.h>
|
||||
|
||||
|
||||
#endif // SFML_SFML_WINDOW_H
|
61
bindings/c/include/SFML/Window/Context.h
Normal file
61
bindings/c/include/SFML/Window/Context.h
Normal file
|
@ -0,0 +1,61 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_CONTEXT_H
|
||||
#define SFML_CONTEXT_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Window/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new context
|
||||
///
|
||||
/// \return New context
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfContext* sfContext_Create(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing context
|
||||
///
|
||||
/// \param context : Context to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfContext_Destroy(sfContext* context);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Activate or deactivate a context
|
||||
///
|
||||
/// \param context : Context to activate or deactivate
|
||||
/// \param active : sfTrue to activate, sfFalse to deactivate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfContext_SetActive(sfContext* context, sfBool active);
|
||||
|
||||
|
||||
#endif // SFML_CONTEXT_H
|
301
bindings/c/include/SFML/Window/Event.h
Normal file
301
bindings/c/include/SFML/Window/Event.h
Normal file
|
@ -0,0 +1,301 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_EVENT_H
|
||||
#define SFML_EVENT_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Definition of key codes for keyboard events
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
sfKeyA = 'a',
|
||||
sfKeyB = 'b',
|
||||
sfKeyC = 'c',
|
||||
sfKeyD = 'd',
|
||||
sfKeyE = 'e',
|
||||
sfKeyF = 'f',
|
||||
sfKeyG = 'g',
|
||||
sfKeyH = 'h',
|
||||
sfKeyI = 'i',
|
||||
sfKeyJ = 'j',
|
||||
sfKeyK = 'k',
|
||||
sfKeyL = 'l',
|
||||
sfKeyM = 'm',
|
||||
sfKeyN = 'n',
|
||||
sfKeyO = 'o',
|
||||
sfKeyP = 'p',
|
||||
sfKeyQ = 'q',
|
||||
sfKeyR = 'r',
|
||||
sfKeyS = 's',
|
||||
sfKeyT = 't',
|
||||
sfKeyU = 'u',
|
||||
sfKeyV = 'v',
|
||||
sfKeyW = 'w',
|
||||
sfKeyX = 'x',
|
||||
sfKeyY = 'y',
|
||||
sfKeyZ = 'z',
|
||||
sfKeyNum0 = '0',
|
||||
sfKeyNum1 = '1',
|
||||
sfKeyNum2 = '2',
|
||||
sfKeyNum3 = '3',
|
||||
sfKeyNum4 = '4',
|
||||
sfKeyNum5 = '5',
|
||||
sfKeyNum6 = '6',
|
||||
sfKeyNum7 = '7',
|
||||
sfKeyNum8 = '8',
|
||||
sfKeyNum9 = '9',
|
||||
sfKeyEscape = 256,
|
||||
sfKeyLControl,
|
||||
sfKeyLShift,
|
||||
sfKeyLAlt,
|
||||
sfKeyLSystem, ///< OS specific key (left side) : windows (Win and Linux), apple (MacOS), ...
|
||||
sfKeyRControl,
|
||||
sfKeyRShift,
|
||||
sfKeyRAlt,
|
||||
sfKeyRSystem, ///< OS specific key (right side) : windows (Win and Linux), apple (MacOS), ...
|
||||
sfKeyMenu,
|
||||
sfKeyLBracket, ///< [
|
||||
sfKeyRBracket, ///< ]
|
||||
sfKeySemiColon, ///< ;
|
||||
sfKeyComma, ///< ,
|
||||
sfKeyPeriod, ///< .
|
||||
sfKeyQuote, ///< '
|
||||
sfKeySlash, ///< /
|
||||
sfKeyBackSlash,
|
||||
sfKeyTilde, ///< ~
|
||||
sfKeyEqual, ///< =
|
||||
sfKeyDash, ///< -
|
||||
sfKeySpace,
|
||||
sfKeyReturn,
|
||||
sfKeyBack,
|
||||
sfKeyTab,
|
||||
sfKeyPageUp,
|
||||
sfKeyPageDown,
|
||||
sfKeyEnd,
|
||||
sfKeyHome,
|
||||
sfKeyInsert,
|
||||
sfKeyDelete,
|
||||
sfKeyAdd, ///< +
|
||||
sfKeySubtract, ///< -
|
||||
sfKeyMultiply, ///< *
|
||||
sfKeyDivide, ///< /
|
||||
sfKeyLeft, ///< Left arrow
|
||||
sfKeyRight, ///< Right arrow
|
||||
sfKeyUp, ///< Up arrow
|
||||
sfKeyDown, ///< Down arrow
|
||||
sfKeyNumpad0,
|
||||
sfKeyNumpad1,
|
||||
sfKeyNumpad2,
|
||||
sfKeyNumpad3,
|
||||
sfKeyNumpad4,
|
||||
sfKeyNumpad5,
|
||||
sfKeyNumpad6,
|
||||
sfKeyNumpad7,
|
||||
sfKeyNumpad8,
|
||||
sfKeyNumpad9,
|
||||
sfKeyF1,
|
||||
sfKeyF2,
|
||||
sfKeyF3,
|
||||
sfKeyF4,
|
||||
sfKeyF5,
|
||||
sfKeyF6,
|
||||
sfKeyF7,
|
||||
sfKeyF8,
|
||||
sfKeyF9,
|
||||
sfKeyF10,
|
||||
sfKeyF11,
|
||||
sfKeyF12,
|
||||
sfKeyF13,
|
||||
sfKeyF14,
|
||||
sfKeyF15,
|
||||
sfKeyPause,
|
||||
|
||||
sfKeyCount // For internal use
|
||||
} sfKeyCode;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Definition of button codes for mouse events
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
sfButtonLeft,
|
||||
sfButtonRight,
|
||||
sfButtonMiddle,
|
||||
sfButtonX1,
|
||||
sfButtonX2
|
||||
} sfMouseButton;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Definition of joystick axis for joystick events
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
sfJoyAxisX,
|
||||
sfJoyAxisY,
|
||||
sfJoyAxisZ,
|
||||
sfJoyAxisR,
|
||||
sfJoyAxisU,
|
||||
sfJoyAxisV,
|
||||
sfJoyAxisPOV
|
||||
} sfJoyAxis;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Definition of all the event types
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
sfEvtClosed,
|
||||
sfEvtResized,
|
||||
sfEvtLostFocus,
|
||||
sfEvtGainedFocus,
|
||||
sfEvtTextEntered,
|
||||
sfEvtKeyPressed,
|
||||
sfEvtKeyReleased,
|
||||
sfEvtMouseWheelMoved,
|
||||
sfEvtMouseButtonPressed,
|
||||
sfEvtMouseButtonReleased,
|
||||
sfEvtMouseMoved,
|
||||
sfEvtMouseEntered,
|
||||
sfEvtMouseLeft,
|
||||
sfEvtJoyButtonPressed,
|
||||
sfEvtJoyButtonReleased,
|
||||
sfEvtJoyMoved
|
||||
} sfEventType;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Keyboard event parameters
|
||||
////////////////////////////////////////////////////////////
|
||||
struct sfKeyEvent
|
||||
{
|
||||
sfEventType Type;
|
||||
sfKeyCode Code;
|
||||
sfBool Alt;
|
||||
sfBool Control;
|
||||
sfBool Shift;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Text event parameters
|
||||
////////////////////////////////////////////////////////////
|
||||
struct sfTextEvent
|
||||
{
|
||||
sfEventType Type;
|
||||
sfUint32 Unicode;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Mouse move event parameters
|
||||
////////////////////////////////////////////////////////////
|
||||
struct sfMouseMoveEvent
|
||||
{
|
||||
sfEventType Type;
|
||||
int X;
|
||||
int Y;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Mouse buttons events parameters
|
||||
////////////////////////////////////////////////////////////
|
||||
struct sfMouseButtonEvent
|
||||
{
|
||||
sfEventType Type;
|
||||
sfMouseButton Button;
|
||||
int X;
|
||||
int Y;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Mouse wheel events parameters
|
||||
////////////////////////////////////////////////////////////
|
||||
struct sfMouseWheelEvent
|
||||
{
|
||||
sfEventType Type;
|
||||
int Delta;
|
||||
int X;
|
||||
int Y;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Joystick axis move event parameters
|
||||
////////////////////////////////////////////////////////////
|
||||
struct sfJoyMoveEvent
|
||||
{
|
||||
sfEventType Type;
|
||||
unsigned int JoystickId;
|
||||
sfJoyAxis Axis;
|
||||
float Position;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Joystick buttons events parameters
|
||||
////////////////////////////////////////////////////////////
|
||||
struct sfJoyButtonEvent
|
||||
{
|
||||
sfEventType Type;
|
||||
unsigned int JoystickId;
|
||||
unsigned int Button;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Size events parameters
|
||||
////////////////////////////////////////////////////////////
|
||||
struct sfSizeEvent
|
||||
{
|
||||
sfEventType Type;
|
||||
unsigned int Width;
|
||||
unsigned int Height;
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfEvent defines a system event and its parameters
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef union
|
||||
{
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
sfEventType Type; ///< Type of the event
|
||||
struct sfKeyEvent Key;
|
||||
struct sfTextEvent Text;
|
||||
struct sfMouseMoveEvent MouseMove;
|
||||
struct sfMouseButtonEvent MouseButton;
|
||||
struct sfMouseWheelEvent MouseWheel;
|
||||
struct sfJoyMoveEvent JoyMove;
|
||||
struct sfJoyButtonEvent JoyButton;
|
||||
struct sfSizeEvent Size;
|
||||
} sfEvent;
|
||||
|
||||
|
||||
#endif // SFML_EVENT_H
|
102
bindings/c/include/SFML/Window/Input.h
Normal file
102
bindings/c/include/SFML/Window/Input.h
Normal file
|
@ -0,0 +1,102 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_INPUT_H
|
||||
#define SFML_INPUT_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Window/Event.h>
|
||||
#include <SFML/Window/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the state of a key
|
||||
///
|
||||
/// \param input : Input object
|
||||
/// \param code : Key to check
|
||||
///
|
||||
/// \return sfTrue if key is down, sfFalse if key is up
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfInput_IsKeyDown(const sfInput* input, sfKeyCode code);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the state of a mouse button
|
||||
///
|
||||
/// \param input : Input object
|
||||
/// \param button : Button to check
|
||||
///
|
||||
/// \return sfTrue if button is down, sfFalse if button is up
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfInput_IsMouseButtonDown(const sfInput* input, sfMouseButton button);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the state of a joystick button
|
||||
///
|
||||
/// \param input : Input object
|
||||
/// \param joyId : Identifier of the joystick to check (0 or 1)
|
||||
/// \param button : Button to check
|
||||
///
|
||||
/// \return sfTrue if button is down, sfFalse if button is up
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfInput_IsJoystickButtonDown(const sfInput* input, unsigned int joyId, unsigned int button);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the mouse X position
|
||||
///
|
||||
/// \param input : Input object
|
||||
///
|
||||
/// \return Current mouse left position, relative to owner window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API int sfInput_GetMouseX(const sfInput* input);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the mouse Y position
|
||||
///
|
||||
/// \param input : Input object
|
||||
///
|
||||
/// \return Current mouse top position, relative to owner window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API int sfInput_GetMouseY(const sfInput* input);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the joystick position on a given axis
|
||||
///
|
||||
/// \param input : Input object
|
||||
/// \param joyId : Identifier of the joystick to check (0 or 1)
|
||||
/// \param axis : Identifier of the axis to read
|
||||
///
|
||||
/// \return Current joystick position, in the range [-100, 100]
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfInput_GetJoystickAxis(const sfInput* input, unsigned int joyId, sfJoyAxis axis);
|
||||
|
||||
|
||||
#endif // SFML_INPUT_H
|
34
bindings/c/include/SFML/Window/Types.h
Normal file
34
bindings/c/include/SFML/Window/Types.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_WINDOW_TYPES_H
|
||||
#define SFML_WINDOW_TYPES_H
|
||||
|
||||
|
||||
typedef struct sfContext sfContext;
|
||||
typedef struct sfInput sfInput;
|
||||
typedef struct sfWindow sfWindow;
|
||||
|
||||
|
||||
#endif // SFML_WINDOW_TYPES_H
|
77
bindings/c/include/SFML/Window/VideoMode.h
Normal file
77
bindings/c/include/SFML/Window/VideoMode.h
Normal file
|
@ -0,0 +1,77 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_VIDEOMODE_H
|
||||
#define SFML_VIDEOMODE_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfVideoMode defines a video mode (width, height, bpp, frequency)
|
||||
/// and provides functions for getting modes supported
|
||||
/// by the display device
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
unsigned int Width; ///< Video mode width, in pixels
|
||||
unsigned int Height; ///< Video mode height, in pixels
|
||||
unsigned int BitsPerPixel; ///< Video mode pixel depth, in bits per pixels
|
||||
} sfVideoMode;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current desktop video mode
|
||||
///
|
||||
/// \return Current desktop video mode
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfVideoMode sfVideoMode_GetDesktopMode(void);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get all the supported video modes for fullscreen mode.
|
||||
/// Modes are sorted from best to worst.
|
||||
///
|
||||
/// \param Count : Variable that will be filled with the number of modes
|
||||
///
|
||||
/// \return Pointer to an array of \a count video modes
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const sfVideoMode* sfVideoMode_GetFullscreenModes(size_t* Count);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell whether or not a video mode is supported
|
||||
///
|
||||
/// \param mode : Video mode to check
|
||||
///
|
||||
///
|
||||
/// \return True if video mode is supported, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfVideoMode_IsValid(sfVideoMode mode);
|
||||
|
||||
|
||||
#endif // SFML_VIDEOMODE_H
|
310
bindings/c/include/SFML/Window/Window.h
Normal file
310
bindings/c/include/SFML/Window/Window.h
Normal file
|
@ -0,0 +1,310 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_WINDOW_H
|
||||
#define SFML_WINDOW_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Window/Event.h>
|
||||
#include <SFML/Window/VideoMode.h>
|
||||
#include <SFML/Window/WindowHandle.h>
|
||||
#include <SFML/Window/Types.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Enumeration of window creation styles
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
enum
|
||||
{
|
||||
sfNone = 0, ///< No border / title bar (this flag and all others are mutually exclusive)
|
||||
sfTitlebar = 1 << 0, ///< Title bar + fixed border
|
||||
sfResize = 1 << 1, ///< Titlebar + resizable border + maximize button
|
||||
sfClose = 1 << 2, ///< Titlebar + close button
|
||||
sfFullscreen = 1 << 3, ///< Fullscreen mode (this flag and all others are mutually exclusive)
|
||||
sfDefaultStyle = sfTitlebar | sfResize | sfClose ///< Default window style
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Structure defining the window's creation settings
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
unsigned int DepthBits; ///< Bits of the depth buffer
|
||||
unsigned int StencilBits; ///< Bits of the stencil buffer
|
||||
unsigned int AntialiasingLevel; ///< Level of antialiasing
|
||||
unsigned int MajorVersion; ///< Major number of the context version to create
|
||||
unsigned int MinorVersion; ///< Minor number of the context version to create
|
||||
} sfContextSettings;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new window
|
||||
///
|
||||
/// \param mode : Video mode to use
|
||||
/// \param title : Title of the window
|
||||
/// \param style : Window style
|
||||
/// \param settings : Creation settings (pass NULL to use default values)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfWindow* sfWindow_Create(sfVideoMode mode, const char* title, unsigned long style, const sfContextSettings* settings);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a window from an existing control
|
||||
///
|
||||
/// \param handle : Platform-specific handle of the control
|
||||
/// \param settings : Creation settings (pass NULL to use default values)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfWindow* sfWindow_CreateFromHandle(sfWindowHandle handle, const sfContextSettings* settings);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing window
|
||||
///
|
||||
/// \param window : Window to destroy
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_Destroy(sfWindow* window);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Close a window (but doesn't destroy the internal data)
|
||||
///
|
||||
/// \param window : Window to close
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_Close(sfWindow* window);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell whether or not a window is opened
|
||||
///
|
||||
/// \param window : Window object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfWindow_IsOpened(const sfWindow* window);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the width of the rendering region of a window
|
||||
///
|
||||
/// \param window : Window object
|
||||
///
|
||||
/// \return Width in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfWindow_GetWidth(const sfWindow* window);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the height of the rendering region of a window
|
||||
///
|
||||
/// \param window : Window object
|
||||
///
|
||||
/// \return Height in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfWindow_GetHeight(const sfWindow* window);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the creation settings of a window
|
||||
///
|
||||
/// \param window : Window object
|
||||
///
|
||||
/// \return Settings used to create the window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfContextSettings sfWindow_GetSettings(const sfWindow* window);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the event on top of events stack of a window, if any, and pop it
|
||||
///
|
||||
/// \param window : Window object
|
||||
/// \param event : Event to fill, if any
|
||||
///
|
||||
/// \return sfTrue if an event was returned, sfFalse if events stack was empty
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfWindow_GetEvent(sfWindow* window, sfEvent* event);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Wait for an event and return it
|
||||
///
|
||||
/// \param window : Window object
|
||||
/// \param event : Event to fill
|
||||
///
|
||||
/// \return sfFalse if an error occured
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfWindow_WaitEvent(sfWindow* window, sfEvent* event);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Enable / disable vertical synchronization on a window
|
||||
///
|
||||
/// \param window : Window object
|
||||
/// \param enabled : sfTrue to enable v-sync, sfFalse to deactivate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_UseVerticalSync(sfWindow* window, sfBool enabled);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Show or hide the mouse cursor on a window
|
||||
///
|
||||
/// \param window : Window object
|
||||
/// \param show : sfTrue to show, sfFalse to hide
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_ShowMouseCursor(sfWindow* window, sfBool show);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the position of the mouse cursor on a window
|
||||
///
|
||||
/// \param window : Window object
|
||||
/// \param left : Left coordinate of the cursor, relative to the window
|
||||
/// \param top : Top coordinate of the cursor, relative to the window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_SetCursorPosition(sfWindow* window, unsigned int left, unsigned int Top);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the position of a window on screen.
|
||||
/// Only works for top-level windows
|
||||
///
|
||||
/// \param window : Window object
|
||||
/// \param left : Left position
|
||||
/// \param top : Top position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_SetPosition(sfWindow* window, int left, int top);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the size of the rendering region of a window
|
||||
///
|
||||
/// \param window : Window object
|
||||
/// \param width : New Width
|
||||
/// \param height : New Height
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_SetSize(sfWindow* window, unsigned int width, unsigned int height);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Show or hide a window
|
||||
///
|
||||
/// \param window : Window object
|
||||
/// \param show : sfTrue to show, sfFalse to hide
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_Show(sfWindow* window, sfBool show);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Enable or disable automatic key-repeat for keydown events.
|
||||
/// Automatic key-repeat is enabled by default
|
||||
///
|
||||
/// \param window : Window object
|
||||
/// \param enabled : sfTrue to enable, sfFalse to disable
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_EnableKeyRepeat(sfWindow* window, sfBool enabled);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the window's icon
|
||||
///
|
||||
/// \param window : Window object
|
||||
/// \param width : Icon's width, in pixels
|
||||
/// \param height : Icon's height, in pixels
|
||||
/// \param pixels : Pointer to the pixels in memory, format must be RGBA 32 bits
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_SetIcon(sfWindow* window, unsigned int width, unsigned int height, const sfUint8* pixels);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Activate or deactivate a window as the current target for rendering
|
||||
///
|
||||
/// \param window : Window object
|
||||
/// \param active : sfTrue to activate, sfFalse to deactivate
|
||||
///
|
||||
/// \return True if operation was successful, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfWindow_SetActive(sfWindow* window, sfBool active);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Display a window on screen
|
||||
///
|
||||
/// \param window : Window object
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_Display(sfWindow* window);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the input manager of a window
|
||||
///
|
||||
/// \param window : Window object
|
||||
///
|
||||
/// \return Reference to the input
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const sfInput* sfWindow_GetInput(sfWindow* window);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Limit the framerate to a maximum fixed frequency for a window
|
||||
///
|
||||
/// \param window : Window object
|
||||
/// \param limit : Framerate limit, in frames per seconds (use 0 to disable limit)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_SetFramerateLimit(sfWindow* window, unsigned int limit);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get time elapsed since last frame of a window
|
||||
///
|
||||
/// \param window : Window object
|
||||
///
|
||||
/// \return Time elapsed, in seconds
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfWindow_GetFrameTime(const sfWindow* window);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change the joystick threshold, ie. the value below which
|
||||
/// no move event will be generated
|
||||
///
|
||||
/// \param window : Window object
|
||||
/// \param threshold : New threshold, in range [0, 100]
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfWindow_SetJoystickThreshold(sfWindow* window, float threshold);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Retrieve the Os-specific handle of a window
|
||||
///
|
||||
/// \param window : Window object
|
||||
///
|
||||
/// \return Window handle
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfWindowHandle sfWindow_GetSystemHandle(const sfWindow* window);
|
||||
|
||||
|
||||
#endif // SFML_WINDOW_H
|
57
bindings/c/include/SFML/Window/WindowHandle.h
Normal file
57
bindings/c/include/SFML/Window/WindowHandle.h
Normal file
|
@ -0,0 +1,57 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_WINDOWHANDLE_H
|
||||
#define SFML_WINDOWHANDLE_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Define a low-level window handle type, specific to
|
||||
/// each platform
|
||||
////////////////////////////////////////////////////////////
|
||||
#if defined(CSFML_SYSTEM_WINDOWS)
|
||||
|
||||
// Window handle is HWND (HWND__*) on Windows
|
||||
struct HWND__;
|
||||
typedef HWND__* sfWindowHandle;
|
||||
|
||||
#elif defined(CSFML_SYSTEM_LINUX) || defined(CSFML_SYSTEM_FREEBSD)
|
||||
|
||||
// Window handle is Window (unsigned long) on Unix - X11
|
||||
typedef unsigned long sfWindowHandle;
|
||||
|
||||
#elif defined(CSFML_SYSTEM_MACOS)
|
||||
|
||||
// Window handle is NSWindow (void*) on Mac OS X - Cocoa
|
||||
typedef void* sfWindowHandle;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif // SFML_WINDOWHANDLE_H
|
Loading…
Add table
Add a link
Reference in a new issue