Added the trunk/branches/tags directories at repository root, and moved previous root into trunk/
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1002 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
commit
2f524481c1
974 changed files with 295448 additions and 0 deletions
46
CSFML/include/SFML/Graphics/BlendMode.h
Normal file
46
CSFML/include/SFML/Graphics/BlendMode.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008 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
CSFML/include/SFML/Graphics/Color.h
Normal file
107
CSFML/include/SFML/Graphics/Color.h
Normal file
|
@ -0,0 +1,107 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008 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 R : Red component (0 .. 255)
|
||||
/// \param G : Green component (0 .. 255)
|
||||
/// \param B : Blue component (0 .. 255)
|
||||
///
|
||||
/// \return sfColor constructed from the components
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfColor sfColor_FromRGB(sfUint8 R, sfUint8 G, sfUint8 B);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a color from its 4 RGBA components
|
||||
///
|
||||
/// \param R : Red component (0 .. 255)
|
||||
/// \param G : Green component (0 .. 255)
|
||||
/// \param B : Blue component (0 .. 255)
|
||||
/// \param A : Alpha component (0 .. 255)
|
||||
///
|
||||
/// \return sfColor constructed from the components
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfColor sfColor_FromRGBA(sfUint8 R, sfUint8 G, sfUint8 B, sfUint8 A);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// 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
|
102
CSFML/include/SFML/Graphics/Font.h
Normal file
102
CSFML/include/SFML/Graphics/Font.h
Normal file
|
@ -0,0 +1,102 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008 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>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfFont is the low-level class for loading and
|
||||
/// manipulating character fonts (see sfString)
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct sfFont sfFont;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new empty font
|
||||
///
|
||||
/// \return A new sfFont object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFont* sfFont_Create();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new font from a file
|
||||
///
|
||||
/// \param Filename : Path of the font file to load
|
||||
/// \param CharSize : Size of characters in bitmap - the bigger, the higher quality
|
||||
/// \param Charset : Characters set to generate (just pass NULL to get the default charset)
|
||||
///
|
||||
/// \return A new sfFont object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFont* sfFont_CreateFromFile(const char* Filename, unsigned int CharSize, const sfUint32* Charset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// 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
|
||||
/// \param CharSize : Size of characters in bitmap - the bigger, the higher quality
|
||||
/// \param Charset : Characters set to generate (just pass NULL to get the default charset)
|
||||
///
|
||||
/// \return A new sfFont object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFont* sfFont_CreateFromMemory(const char* Data, size_t SizeInBytes, unsigned int CharSize, const sfUint32* Charset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing font
|
||||
///
|
||||
/// \param Font : Font to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfFont_Destroy(sfFont* Font);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the base size of characters in a font;
|
||||
/// All glyphs dimensions are based on this value
|
||||
///
|
||||
/// \param Font : Font object
|
||||
///
|
||||
/// \return Base size of characters
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfFont_GetCharacterSize(sfFont* Font);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the built-in default font (Arial)
|
||||
///
|
||||
/// \return Pointer to the default font
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFont* sfFont_GetDefaultFont();
|
||||
|
||||
|
||||
#endif // SFML_IMAGE_H
|
45
CSFML/include/SFML/Graphics/Glyph.h
Normal file
45
CSFML/include/SFML/Graphics/Glyph.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008 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 Rectangle; ///< Bounding rectangle of the glyph, in relative coordinates
|
||||
sfFloatRect TexCoords; ///< Texture coordinates of the glyph inside the bitmap font
|
||||
} sfGlyph;
|
||||
|
||||
|
||||
#endif // SFML_GLYPH_H
|
239
CSFML/include/SFML/Graphics/Image.h
Normal file
239
CSFML/include/SFML/Graphics/Image.h
Normal file
|
@ -0,0 +1,239 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008 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>
|
||||
|
||||
|
||||
typedef struct sfRenderWindow sfRenderWindow;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfImage is the low-level class for loading and
|
||||
/// manipulating images
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct sfImage sfImage;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new empty image
|
||||
///
|
||||
/// \return A new sfImage object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfImage* sfImage_Create();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new image filled with a color
|
||||
///
|
||||
/// \param Width : Image width
|
||||
/// \param Height : Image height
|
||||
/// \param Col : 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 char* Data, size_t SizeInBytes);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// 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(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_Copy(sfImage* Image, 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
|
||||
/// Don't forget to call Update when you end modifying pixels
|
||||
///
|
||||
/// \param Image : Image to modify
|
||||
/// \param X : X coordinate of pixel in the image
|
||||
/// \param Y : Y coordinate of pixel in the image
|
||||
/// \param Col : 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(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() x sfImage_GetHeight() 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(sfImage* Image);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Bind the image for rendering
|
||||
///
|
||||
/// \param Image : Image to bind
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfImage_Bind(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(sfImage* Image);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the height of the image
|
||||
///
|
||||
/// \param Image : Image to read
|
||||
///
|
||||
/// \return Height in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned int sfImage_GetHeight(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(sfImage* Image);
|
||||
|
||||
|
||||
#endif // SFML_IMAGE_H
|
128
CSFML/include/SFML/Graphics/PostFX.h
Normal file
128
CSFML/include/SFML/Graphics/PostFX.h
Normal file
|
@ -0,0 +1,128 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008 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_POSTFX_H
|
||||
#define SFML_POSTFX_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Graphics/Image.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// PostFX is used to apply a post effect to a window
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct sfPostFX sfPostFX;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new post-fx from a file
|
||||
///
|
||||
/// \param Filename : File to load
|
||||
///
|
||||
/// \return A new sfPostFX object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfPostFX* sfPostFX_CreateFromFile(const char* Filename);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new post-fx from an effect source code
|
||||
///
|
||||
/// \param Effect : Source code of the effect
|
||||
///
|
||||
/// \return A new sfPostFX object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfPostFX* sfPostFX_CreateFromMemory(const char* Effect);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing post-fx
|
||||
///
|
||||
/// \param PostFX : PostFX to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfPostFX_Destroy(sfPostFX* PostFX);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change a parameter of a post-fx (1 float)
|
||||
///
|
||||
/// \param PostFX : Post-effect to modify
|
||||
/// \param Name : Parameter name in the effect
|
||||
/// \param X : Value to assign
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfPostFX_SetParameter1(sfPostFX* PostFX, const char* Name, float X);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change a parameter of a post-fx (2 floats)
|
||||
///
|
||||
/// \param PostFX : Post-effect to modify
|
||||
/// \param Name : Parameter name in the effect
|
||||
/// \param X, Y : Values to assign
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfPostFX_SetParameter2(sfPostFX* PostFX, const char* Name, float X, float Y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change a parameter of a post-fx (3 floats)
|
||||
///
|
||||
/// \param PostFX : Post-effect to modify
|
||||
/// \param Name : Parameter name in the effect
|
||||
/// \param X, Y, Z : Values to assign
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfPostFX_SetParameter3(sfPostFX* PostFX, const char* Name, float X, float Y, float Z);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Change a parameter of a post-fx (4 floats)
|
||||
///
|
||||
/// \param PostFX : Post-effect to modify
|
||||
/// \param Name : Parameter name in the effect
|
||||
/// \param X, Y, Z, W : Values to assign
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfPostFX_SetParameter4(sfPostFX* PostFX, const char* Name, float X, float Y, float Z, float W);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set a texture parameter in a post-fx
|
||||
///
|
||||
/// \param PostFX : Post-effect to modify
|
||||
/// \param Name : Texture name in the effect
|
||||
/// \param Texture : Image to set (pass NULL to use content of current framebuffer)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfPostFX_SetTexture(sfPostFX* PostFX, const char* Name, sfImage* Texture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell whether or not the system supports post-effects
|
||||
///
|
||||
/// \return sfTrue if the system can use post-effects
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfPostFX_CanUsePostFX();
|
||||
|
||||
|
||||
#endif // SFML_POSTFX_H
|
93
CSFML/include/SFML/Graphics/Rect.h
Normal file
93
CSFML/include/SFML/Graphics/Rect.h
Normal file
|
@ -0,0 +1,93 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008 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 Right;
|
||||
float Bottom;
|
||||
} sfFloatRect;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int Left;
|
||||
int Top;
|
||||
int Right;
|
||||
int Bottom;
|
||||
} sfIntRect;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Move a rectangle by the given offset
|
||||
///
|
||||
/// \param Rect : Rectangle to move
|
||||
/// \param OffsetX : Horizontal offset
|
||||
/// \param OffsetY : Vertical offset
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfFloatRect_Offset(sfFloatRect* Rect, float OffsetX, float OffsetY);
|
||||
CSFML_API void sfIntRect_Offset(sfIntRect* Rect, int OffsetX, int OffsetY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// 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(sfFloatRect* Rect, float X, float Y);
|
||||
CSFML_API sfBool sfIntRect_Contains(sfIntRect* Rect, int X, int Y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Check intersection between two rectangles
|
||||
///
|
||||
/// \param Rect1 : First rectangle to test
|
||||
/// \param Rect2 : Second rectangle to test
|
||||
/// \param OverlappingRect : Rectangle to be filled with overlapping rect (can be NULL)
|
||||
///
|
||||
/// \return sfTrue if rectangles overlap
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBool sfFloatRect_Intersects(sfFloatRect* Rect1, sfFloatRect* Rect2, sfFloatRect* OverlappingRect);
|
||||
CSFML_API sfBool sfIntRect_Intersects(sfIntRect* Rect1, sfIntRect* Rect2, sfIntRect* OverlappingRect);
|
||||
|
||||
|
||||
#endif // SFML_RECT_H
|
365
CSFML/include/SFML/Graphics/RenderWindow.h
Normal file
365
CSFML/include/SFML/Graphics/RenderWindow.h
Normal file
|
@ -0,0 +1,365 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008 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/Image.h>
|
||||
#include <SFML/Graphics/PostFX.h>
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
#include <SFML/Graphics/Shape.h>
|
||||
#include <SFML/Graphics/Sprite.h>
|
||||
#include <SFML/Graphics/String.h>
|
||||
#include <SFML/Graphics/View.h>
|
||||
#include <SFML/Window/Event.h>
|
||||
#include <SFML/Window/Input.h>
|
||||
#include <SFML/Window/VideoMode.h>
|
||||
#include <SFML/Window/Window.h>
|
||||
#include <SFML/Window/WindowHandle.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfRenderWindow is a simple wrapper for sfWindow that
|
||||
/// allows easy 2D rendering
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct sfRenderWindow sfRenderWindow;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a new renderwindow
|
||||
///
|
||||
/// \param Mode : Video mode to use
|
||||
/// \param Title : Title of the window
|
||||
/// \param Style : Window style
|
||||
/// \param Params : Creation settings
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfRenderWindow* sfRenderWindow_Create(sfVideoMode Mode, const char* Title, unsigned long Style, sfWindowSettings Params);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a renderwindow from an existing control
|
||||
///
|
||||
/// \param Handle : Platform-specific handle of the control
|
||||
/// \param Params : Creation settings
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfRenderWindow* sfRenderWindow_CreateFromHandle(sfWindowHandle Handle, sfWindowSettings Params);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// 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(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(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(sfRenderWindow* RenderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the creation settings of a window
|
||||
///
|
||||
/// \param RenderWindow : Renderwindow object
|
||||
///
|
||||
/// \return Settings used to create the window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfWindowSettings sfRenderWindow_GetSettings(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);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// 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 State : sfTrue to show, sfFalse to hide
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_Show(sfRenderWindow* RenderWindow, sfBool State);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// 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, 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);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// 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 sfInput* sfRenderWindow_GetInput(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(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);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Draw something on a renderwindow
|
||||
///
|
||||
/// \param RenderWindow : Renderwindow to draw in
|
||||
/// \param PostFX / Sprite / String / shape : Object to draw
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_DrawPostFX(sfRenderWindow* RenderWindow, sfPostFX* PostFX);
|
||||
CSFML_API void sfRenderWindow_DrawSprite(sfRenderWindow* RenderWindow, sfSprite* Sprite);
|
||||
CSFML_API void sfRenderWindow_DrawShape (sfRenderWindow* RenderWindow, sfShape* Shape);
|
||||
CSFML_API void sfRenderWindow_DrawString(sfRenderWindow* RenderWindow, sfString* String);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Save the content of a renderwindow to an image
|
||||
///
|
||||
/// \param RenderWindow : Renderwindow to capture
|
||||
///
|
||||
/// \return Image instance containing the contents of the screen
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfImage* sfRenderWindow_Capture(sfRenderWindow* RenderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// 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 NewView : Pointer to the new view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_SetView(sfRenderWindow* RenderWindow, sfView* View);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current active view of a renderwindow
|
||||
///
|
||||
/// \param RenderWindow : Renderwindow
|
||||
///
|
||||
/// \return Current active view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const sfView* sfRenderWindow_GetView(sfRenderWindow* RenderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the default view of a renderwindow
|
||||
///
|
||||
/// \param RenderWindow : Renderwindow
|
||||
///
|
||||
/// \return Default view of the render window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfView* sfRenderWindow_GetDefaultView(sfRenderWindow* RenderWindow);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// 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(sfRenderWindow* RenderWindow, unsigned int WindowX, unsigned int WindowY, float* ViewX, float* ViewY, sfView* TargetView);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Tell SFML to preserve external OpenGL states, at the expense of
|
||||
/// more CPU charge. Use this function if you don't want SFML
|
||||
/// to mess up your own OpenGL states (if any).
|
||||
/// Don't enable state preservation if not needed, as it will allow
|
||||
/// SFML to do internal optimizations and improve performances.
|
||||
/// This parameter is false by default
|
||||
///
|
||||
/// \param RenderWindow : Target Renderwindow
|
||||
/// \param Preserve : True to preserve OpenGL states, false to let SFML optimize
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfRenderWindow_PreserveOpenGLStates(sfRenderWindow* RenderWindow, sfBool Preserve);
|
||||
|
||||
|
||||
#endif // SFML_RENDERWINDOW_H
|
460
CSFML/include/SFML/Graphics/Shape.h
Normal file
460
CSFML/include/SFML/Graphics/Shape.h
Normal file
|
@ -0,0 +1,460 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008 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>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfShape defines a drawable convex Shape ; it also defines
|
||||
/// helper functions to draw simple Shapes like
|
||||
/// lines, rectangles, circles, etc.
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct sfShape sfShape;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new shape
|
||||
///
|
||||
/// \return A new sfShape object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfShape* sfShape_Create();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// 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 Col : Color used to draw the line
|
||||
/// \param Outline : Outline width
|
||||
/// \param OutlineCol : Color used to draw the outline
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfShape* sfShape_CreateLine(float P1X, float P1Y, float P2X, float P2Y, float Thickness, sfColor Col, float Outline, sfColor OutlineCol);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new shape made of a single rectangle
|
||||
///
|
||||
/// \param P1X, P1Y : Position of the first point
|
||||
/// \param P2X, P2Y : Position second point
|
||||
/// \param Col : Color used to fill the rectangle
|
||||
/// \param Outline : Outline width
|
||||
/// \param OutlineCol : Color used to draw the outline
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfShape* sfShape_CreateRectangle(float P1X, float P1Y, float P2X, float P2Y, sfColor Col, float Outline, sfColor OutlineCol);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new shape made of a single circle
|
||||
///
|
||||
/// \param X, Y : Position of the center
|
||||
/// \param Radius : Radius
|
||||
/// \param Col : Color used to fill the circle
|
||||
/// \param Outline : Outline width
|
||||
/// \param OutlineCol : Color used to draw the outline
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfShape* sfShape_CreateCircle(float X, float Y, float Radius, sfColor Col, float Outline, sfColor OutlineCol);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// 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 center of a shape, in coordinates relative to
|
||||
/// its left-top corner
|
||||
///
|
||||
/// \param Shape : Shape to modify
|
||||
/// \param X : X coordinate of the center
|
||||
/// \param Y : Y coordinate of the center
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_SetCenter(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(sfShape* Shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the Y position of a shape
|
||||
///
|
||||
/// \param Shape : Shape to read
|
||||
///
|
||||
/// \return Current Y position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfShape_GetY(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(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(sfShape* Shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the orientation of a shape
|
||||
///
|
||||
/// \param Shape : Shape to read
|
||||
///
|
||||
/// \return Current rotation, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfShape_GetRotation(sfShape* Shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the X position of the center a shape
|
||||
///
|
||||
/// \param Shape : Shape to read
|
||||
///
|
||||
/// \return Current X center
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfShape_GetCenterX(sfShape* Shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the Y position of the center a shape
|
||||
///
|
||||
/// \param Shape : Shape to read
|
||||
///
|
||||
/// \return Current Y center
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfShape_GetCenterY(sfShape* Shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the color of a shape
|
||||
///
|
||||
/// \param Shape : Shape to read
|
||||
///
|
||||
/// \return Current color
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfColor sfShape_GetColor(sfShape* Shape);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current blending mode of a shape
|
||||
///
|
||||
/// \param Shape : Shape to read
|
||||
///
|
||||
/// \return Current blending mode
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBlendMode sfShape_GetBlendMode(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 center, 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(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 center, 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(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 Col : Color of the point
|
||||
/// \param OutlineCol : Outline color of the point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfShape_AddPoint(sfShape* Shape, float X, float Y, sfColor Col, sfColor OutlineCol);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Enable or disable filling a shape.
|
||||
/// Fill is enabled by default
|
||||
///
|
||||
/// \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(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_GetNbPoints(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(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(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(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
|
399
CSFML/include/SFML/Graphics/Sprite.h
Normal file
399
CSFML/include/SFML/Graphics/Sprite.h
Normal file
|
@ -0,0 +1,399 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008 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/Image.h>
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfSprite defines a sprite : texture, transformations,
|
||||
/// color, and draw on screen
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct sfSprite sfSprite;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new sprite
|
||||
///
|
||||
/// \return A new sfSprite object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfSprite* sfSprite_Create();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// 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 center of a sprite, in coordinates relative to
|
||||
/// its left-top corner
|
||||
///
|
||||
/// \param Sprite : Sprite to modify
|
||||
/// \param X : X coordinate of the center
|
||||
/// \param Y : Y coordinate of the center
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSprite_SetCenter(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(sfSprite* Sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the Y position of a sprite
|
||||
///
|
||||
/// \param Sprite : Sprite to read
|
||||
///
|
||||
/// \return Current Y position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSprite_GetY(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(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(sfSprite* Sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the orientation of a sprite
|
||||
///
|
||||
/// \param Sprite : Sprite to read
|
||||
///
|
||||
/// \return Current rotation, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSprite_GetRotation(sfSprite* Sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the X position of the center a sprite
|
||||
///
|
||||
/// \param Sprite : Sprite to read
|
||||
///
|
||||
/// \return Current X center
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSprite_GetCenterX(sfSprite* Sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the Y position of the center a sprite
|
||||
///
|
||||
/// \param Sprite : Sprite to read
|
||||
///
|
||||
/// \return Current Y center
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSprite_GetCenterY(sfSprite* Sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the color of a sprite
|
||||
///
|
||||
/// \param Sprite : Sprite to read
|
||||
///
|
||||
/// \return Current color
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfColor sfSprite_GetColor(sfSprite* Sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current blending mode of a sprite
|
||||
///
|
||||
/// \param Sprite : Sprite to read
|
||||
///
|
||||
/// \return Current blending mode
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBlendMode sfSprite_GetBlendMode(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 center, 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(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 center, 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(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
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSprite_SetImage(sfSprite* Sprite, sfImage* Image);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the sub-rectangle of a sprite inside the source image
|
||||
///
|
||||
/// \param Sprite : Sprite to modify
|
||||
/// \param SubRect : New sub-rectangle
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfSprite_SetSubRect(sfSprite* Sprite, sfIntRect SubRect);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// 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 sfImage* sfSprite_GetImage(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(sfSprite* Sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get a sprite width
|
||||
///
|
||||
/// \param Sprite : Sprite to read
|
||||
///
|
||||
/// \return Width of the sprite
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSprite_GetWidth(sfSprite* Sprite);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get a sprite height
|
||||
///
|
||||
/// \param Sprite : Sprite to read
|
||||
///
|
||||
/// \return Height of the sprite
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfSprite_GetHeight(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(sfSprite* Sprite, unsigned int X, unsigned int Y);
|
||||
|
||||
|
||||
#endif // SFML_SPRITE_H
|
430
CSFML/include/SFML/Graphics/String.h
Normal file
430
CSFML/include/SFML/Graphics/String.h
Normal file
|
@ -0,0 +1,430 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008 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_STRING_H
|
||||
#define SFML_STRING_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Config.h>
|
||||
#include <SFML/Graphics/BlendMode.h>
|
||||
#include <SFML/Graphics/Color.h>
|
||||
#include <SFML/Graphics/Font.h>
|
||||
#include <SFML/Graphics/Rect.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfString defines a graphical 2D text, that can be drawn on screen
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct sfString sfString;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfString styles
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef enum
|
||||
{
|
||||
sfStringRegular = 0, ///< Regular characters, no style
|
||||
sfStringBold = 1 << 0, ///< Characters are bold
|
||||
sfStringItalic = 1 << 1, ///< Characters are in italic
|
||||
sfStringUnderlined = 1 << 2 ///< Characters are underlined
|
||||
} sfStringStyle;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new string
|
||||
///
|
||||
/// \return A new sfString object, or NULL if it failed
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfString* sfString_Create();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing string
|
||||
///
|
||||
/// \param String : String to delete
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_Destroy(sfString* String);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the X position of a string
|
||||
///
|
||||
/// \param String : String to modify
|
||||
/// \param X : New X coordinate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetX(sfString* String, float X);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the Y position of a string
|
||||
///
|
||||
/// \param String : String to modify
|
||||
/// \param Y : New Y coordinate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetY(sfString* String, float Y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the position of a string
|
||||
///
|
||||
/// \param String : String to modify
|
||||
/// \param Left : New left coordinate
|
||||
/// \param Top : New top coordinate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetPosition(sfString* String, float Left, float Top);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the horizontal scale of a string
|
||||
///
|
||||
/// \param String : String to modify
|
||||
/// \param Scale : New scale (must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetScaleX(sfString* String, float Scale);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the vertical scale of a string
|
||||
///
|
||||
/// \param String : String to modify
|
||||
/// \param Scale : New scale (must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetScaleY(sfString* String, float Scale);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the scale of a string
|
||||
///
|
||||
/// \param String : String to modify
|
||||
/// \param ScaleX : New horizontal scale (must be strictly positive)
|
||||
/// \param ScaleY : New vertical scale (must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetScale(sfString* String, float ScaleX, float ScaleY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the orientation of a string
|
||||
///
|
||||
/// \param String : String to modify
|
||||
/// \param Rotation : Angle of rotation, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetRotation(sfString* String, float Rotation);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the center of a string, in coordinates
|
||||
/// relative to its left-top corner
|
||||
///
|
||||
/// \param String : String to modify
|
||||
/// \param X : X coordinate of the center
|
||||
/// \param Y : Y coordinate of the center
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetCenter(sfString* String, float X, float Y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the color of a string
|
||||
///
|
||||
/// \param String : String to modify
|
||||
/// \param Color : New color
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetColor(sfString* String, sfColor Color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the blending mode for a string
|
||||
///
|
||||
/// \param String : String to modify
|
||||
/// \param Mode : New blending mode
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetBlendMode(sfString* String, sfBlendMode Mode);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the X position of a string
|
||||
///
|
||||
/// \param String : String to read
|
||||
///
|
||||
/// \return Current X position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfString_GetX(sfString* String);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the top Y of a string
|
||||
///
|
||||
/// \param String : String to read
|
||||
///
|
||||
/// \return Current Y position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfString_GetY(sfString* String);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the horizontal scale of a string
|
||||
///
|
||||
/// \param String : String to read
|
||||
///
|
||||
/// \return Current X scale factor (always positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfString_GetScaleX(sfString* String);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the vertical scale of a string
|
||||
///
|
||||
/// \param String : String to read
|
||||
///
|
||||
/// \return Current Y scale factor (always positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfString_GetScaleY(sfString* String);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the orientation of a string
|
||||
///
|
||||
/// \param String : String to read
|
||||
///
|
||||
/// \return Current rotation, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfString_GetRotation(sfString* String);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the X position of the center a string
|
||||
///
|
||||
/// \param String : String to read
|
||||
///
|
||||
/// \return Current X center position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfString_GetCenterX(sfString* String);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the top Y of the center of a string
|
||||
///
|
||||
/// \param String : String to read
|
||||
///
|
||||
/// \return Current Y center position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfString_GetCenterY(sfString* String);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the color of a string
|
||||
///
|
||||
/// \param String : String to read
|
||||
///
|
||||
/// \return Current color
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfColor sfString_GetColor(sfString* String);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the current blending mode of a string
|
||||
///
|
||||
/// \param String : String to read
|
||||
///
|
||||
/// \return Current blending mode
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfBlendMode sfString_GetBlendMode(sfString* String);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Move a string
|
||||
///
|
||||
/// \param String : String to modify
|
||||
/// \param OffsetX : Offset on the X axis
|
||||
/// \param OffsetY : Offset on the Y axis
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_Move(sfString* String, float OffsetX, float OffsetY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Scale a string
|
||||
///
|
||||
/// \param String : String to modify
|
||||
/// \param FactorX : Horizontal scaling factor (must be strictly positive)
|
||||
/// \param FactorY : Vertical scaling factor (must be strictly positive)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_Scale(sfString* String, float FactorX, float FactorY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Rotate a string
|
||||
///
|
||||
/// \param String : String to modify
|
||||
/// \param Angle : Angle of rotation, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_Rotate(sfString* String, float Angle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Transform a point from global coordinates into the string's local coordinates
|
||||
/// (ie it applies the inverse of object's center, translation, rotation and scale to the point)
|
||||
///
|
||||
/// \param String : 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 sfString_TransformToLocal(sfString* String, 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 center, translation, rotation and scale to the point)
|
||||
///
|
||||
/// \param String : 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 sfString_TransformToGlobal(sfString* String, float PointX, float PointY, float* X, float* Y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the text of a string (from a multibyte string)
|
||||
///
|
||||
/// \param String : String to modify
|
||||
/// \param Text : New text
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetText(sfString* String, const char* Text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the text of a string (from a unicode string)
|
||||
///
|
||||
/// \param String : String to modify
|
||||
/// \param Text : New text
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetUnicodeText(sfString* String, const sfUint32* Text);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the font of a string
|
||||
///
|
||||
/// \param String : String to modify
|
||||
/// \param Font : Font to use
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetFont(sfString* String, sfFont* Font);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the size of a string
|
||||
///
|
||||
/// \param String : String to modify
|
||||
/// \param Size : New size, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetSize(sfString* String, float Size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Set the style of a string
|
||||
///
|
||||
/// \param String : String to modify
|
||||
/// \param Size : New style (see sfStringStyle enum)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfString_SetStyle(sfString* String, unsigned long Style);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the text of a string (returns a unicode string)
|
||||
///
|
||||
/// \param String : String to read
|
||||
///
|
||||
/// \return Text as UTF-32
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const sfUint32* sfString_GetUnicodeText(sfString* String);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the text of a string (returns an ANSI string)
|
||||
///
|
||||
/// \param String : String to read
|
||||
///
|
||||
/// \return Text an a locale-dependant ANSI string
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API const char* sfString_GetText(sfString* String);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the font used by a string
|
||||
///
|
||||
/// \param String : String to read
|
||||
///
|
||||
/// \return Pointer to the font
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFont* sfString_GetFont(sfString* String);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the size of the characters of a string
|
||||
///
|
||||
/// \param String : String to read
|
||||
///
|
||||
/// \return Size of the characters
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfString_GetSize(sfString* String);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the style of a string
|
||||
///
|
||||
/// \param String : String to read
|
||||
///
|
||||
/// \return Current string style (see sfStringStyle enum)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API unsigned long sfString_GetStyle(sfString* String);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Return the visual position of the Index-th character of the string,
|
||||
/// in coordinates relative to the string
|
||||
/// (note : translation, center, rotation and scale are not applied)
|
||||
///
|
||||
/// \param String : 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 sfString_GetCharacterPos(sfString* String, size_t Index, float* X, float* Y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the bounding rectangle of a string on screen
|
||||
///
|
||||
/// \param String : String to read
|
||||
///
|
||||
/// \return Rectangle contaning the string in screen coordinates
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFloatRect sfString_GetRect(sfString* String);
|
||||
|
||||
|
||||
#endif // SFML_STRING_H
|
163
CSFML/include/SFML/Graphics/View.h
Normal file
163
CSFML/include/SFML/Graphics/View.h
Normal file
|
@ -0,0 +1,163 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2008 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>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// This class defines a view (position, size, etc.) ;
|
||||
/// you can consider it as a 2D camera
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct sfView sfView;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a default view (1000x1000)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfView* sfView_Create();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Construct a view from a rectangle
|
||||
///
|
||||
/// \param Rect : Rectangle defining the bounds of the view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfView* sfView_CreateFromRect(sfFloatRect Rect);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// 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 half-size of a view
|
||||
///
|
||||
/// \param View : View to modify
|
||||
/// \param HalfWidth : New half-width
|
||||
/// \param HalfHeight : New half-height
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfView_SetHalfSize(sfView* View, float HalfWidth, float HalfHeight);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Rebuild a view from a rectangle
|
||||
///
|
||||
/// \param View : View to modify
|
||||
/// \param ViewRect : Rectangle defining the position and size of the view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API void sfView_SetFromRect(sfView* View, sfFloatRect ViewRect);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// 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(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(sfView* View);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the half-width of the view
|
||||
///
|
||||
/// \param View : View to read
|
||||
///
|
||||
/// \return Half-width of the view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfView_GetHalfSizeX(sfView* View);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the half-height of the view
|
||||
///
|
||||
/// \param View : View to read
|
||||
///
|
||||
/// \return Half-height of the view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API float sfView_GetHalfSizeY(sfView* View);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the bounding rectangle of a view
|
||||
///
|
||||
/// \param View : View to read
|
||||
///
|
||||
/// \return Bounding rectangle of the view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_API sfFloatRect sfView_GetRect(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);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// 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
|
Loading…
Add table
Add a link
Reference in a new issue