Changed the naming convention for public member variables/functions and free functions (using lowerCase instead of UpperCase)
This commit is contained in:
parent
ff5b69d312
commit
14ac411542
200 changed files with 4302 additions and 4320 deletions
|
@ -56,40 +56,40 @@ public :
|
|||
///
|
||||
/// \param radius New radius of the circle
|
||||
///
|
||||
/// \see GetRadius
|
||||
/// \see getRadius
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetRadius(float radius);
|
||||
void setRadius(float radius);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the radius of the circle
|
||||
///
|
||||
/// \return Radius of the circle
|
||||
///
|
||||
/// \see SetRadius
|
||||
/// \see setRadius
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
float GetRadius() const;
|
||||
float getRadius() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the number of points of the circle
|
||||
///
|
||||
/// \param count New number of points of the circle
|
||||
///
|
||||
/// \see GetPointCount
|
||||
/// \see getPointCount
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetPointCount(unsigned int count);
|
||||
void setPointCount(unsigned int count);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the number of points of the shape
|
||||
///
|
||||
/// \return Number of points of the shape
|
||||
///
|
||||
/// \see SetPointCount
|
||||
/// \see setPointCount
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual unsigned int GetPointCount() const;
|
||||
virtual unsigned int getPointCount() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get a point of the shape
|
||||
|
@ -101,7 +101,7 @@ public :
|
|||
/// \return Index-th point of the shape
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual Vector2f GetPoint(unsigned int index) const;
|
||||
virtual Vector2f getPoint(unsigned int index) const;
|
||||
|
||||
private :
|
||||
|
||||
|
@ -129,12 +129,12 @@ private :
|
|||
/// Usage example:
|
||||
/// \code
|
||||
/// sf::CircleShape circle;
|
||||
/// circle.SetRadius(150);
|
||||
/// circle.SetOutlineColor(sf::Color::Red);
|
||||
/// circle.SetOutlineThickness(5);
|
||||
/// circle.SetPosition(10, 20);
|
||||
/// circle.setRadius(150);
|
||||
/// circle.setOutlineColor(sf::Color::Red);
|
||||
/// circle.setOutlineThickness(5);
|
||||
/// circle.setPosition(10, 20);
|
||||
/// ...
|
||||
/// window.Draw(circle);
|
||||
/// window.draw(circle);
|
||||
/// \endcode
|
||||
///
|
||||
/// Since the graphics card can't draw perfect circles, we have to
|
||||
|
|
|
@ -58,20 +58,20 @@ public :
|
|||
///
|
||||
/// \param count New number of points of the polygon
|
||||
///
|
||||
/// \see GetPointCount
|
||||
/// \see getPointCount
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetPointCount(unsigned int count);
|
||||
void setPointCount(unsigned int count);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the number of points of the polygon
|
||||
///
|
||||
/// \return Number of points of the polygon
|
||||
///
|
||||
/// \see SetPointCount
|
||||
/// \see setPointCount
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual unsigned int GetPointCount() const;
|
||||
virtual unsigned int getPointCount() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the position of a point
|
||||
|
@ -85,10 +85,10 @@ public :
|
|||
/// \param index Index of the point to change, in range [0 .. GetPointCount() - 1]
|
||||
/// \param point New position of the point
|
||||
///
|
||||
/// \see GetPoint
|
||||
/// \see getPoint
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetPoint(unsigned int index, const Vector2f& point);
|
||||
void setPoint(unsigned int index, const Vector2f& point);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the position of a point
|
||||
|
@ -99,10 +99,10 @@ public :
|
|||
///
|
||||
/// \return Position of the index-th point of the polygon
|
||||
///
|
||||
/// \see SetPoint
|
||||
/// \see setPoint
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual Vector2f GetPoint(unsigned int index) const;
|
||||
virtual Vector2f getPoint(unsigned int index) const;
|
||||
|
||||
private :
|
||||
|
||||
|
@ -134,15 +134,15 @@ private :
|
|||
/// Usage example:
|
||||
/// \code
|
||||
/// sf::ConvexShape polygon;
|
||||
/// polygon.SetPointCount(3);
|
||||
/// polygon.SetPoint(0, sf::Vector2f(0, 0));
|
||||
/// polygon.SetPoint(1, sf::Vector2f(0, 10));
|
||||
/// polygon.SetPoint(2, sf::Vector2f(25, 5));
|
||||
/// polygon.SetOutlineColor(sf::Color::Red);
|
||||
/// polygon.SetOutlineThickness(5);
|
||||
/// polygon.SetPosition(10, 20);
|
||||
/// polygon.setPointCount(3);
|
||||
/// polygon.setPoint(0, sf::Vector2f(0, 0));
|
||||
/// polygon.setPoint(1, sf::Vector2f(0, 10));
|
||||
/// polygon.setPoint(2, sf::Vector2f(25, 5));
|
||||
/// polygon.setOutlineColor(sf::Color::Red);
|
||||
/// polygon.setOutlineThickness(5);
|
||||
/// polygon.setPosition(10, 20);
|
||||
/// ...
|
||||
/// window.Draw(polygon);
|
||||
/// window.draw(polygon);
|
||||
/// \endcode
|
||||
///
|
||||
/// \see sf::Shape, sf::RectangleShape, sf::CircleShape
|
||||
|
|
|
@ -66,7 +66,7 @@ private :
|
|||
/// \param states Current render states
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void Draw(RenderTarget& target, RenderStates states) const = 0;
|
||||
virtual void draw(RenderTarget& target, RenderStates states) const = 0;
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
@ -100,14 +100,14 @@ private :
|
|||
///
|
||||
/// private :
|
||||
///
|
||||
/// virtual void Draw(sf::RenderTarget& target, RenderStates states) const
|
||||
/// virtual void draw(sf::RenderTarget& target, RenderStates states) const
|
||||
/// {
|
||||
/// // You can draw other high-level objects
|
||||
/// target.Draw(m_sprite, states);
|
||||
/// target.draw(m_sprite, states);
|
||||
///
|
||||
/// // ... or use the low-level API
|
||||
/// states.Texture = &m_texture;
|
||||
/// target.Draw(m_vertices, states);
|
||||
/// target.draw(m_vertices, states);
|
||||
///
|
||||
/// // ... or draw with OpenGL directly
|
||||
/// glBegin(GL_QUADS);
|
||||
|
|
|
@ -88,10 +88,10 @@ public :
|
|||
///
|
||||
/// \return True if loading succeeded, false if it failed
|
||||
///
|
||||
/// \see LoadFromMemory, LoadFromStream
|
||||
/// \see loadFromMemory, loadFromStream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromFile(const std::string& filename);
|
||||
bool loadFromFile(const std::string& filename);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Load the font from a file in memory
|
||||
|
@ -107,10 +107,10 @@ public :
|
|||
///
|
||||
/// \return True if loading succeeded, false if it failed
|
||||
///
|
||||
/// \see LoadFromFile, LoadFromStream
|
||||
/// \see loadFromFile, loadFromStream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromMemory(const void* data, std::size_t sizeInBytes);
|
||||
bool loadFromMemory(const void* data, std::size_t sizeInBytes);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Load the font from a custom stream
|
||||
|
@ -125,10 +125,10 @@ public :
|
|||
///
|
||||
/// \return True if loading succeeded, false if it failed
|
||||
///
|
||||
/// \see LoadFromFile, LoadFromMemory
|
||||
/// \see loadFromFile, loadFromMemory
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromStream(InputStream& stream);
|
||||
bool loadFromStream(InputStream& stream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Retrieve a glyph of the font
|
||||
|
@ -140,7 +140,7 @@ public :
|
|||
/// \return The glyph corresponding to \a codePoint and \a characterSize
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Glyph& GetGlyph(Uint32 codePoint, unsigned int characterSize, bool bold) const;
|
||||
const Glyph& getGlyph(Uint32 codePoint, unsigned int characterSize, bool bold) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the kerning offset of two glyphs
|
||||
|
@ -158,7 +158,7 @@ public :
|
|||
/// \return Kerning value for \a first and \a second, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
int GetKerning(Uint32 first, Uint32 second, unsigned int characterSize) const;
|
||||
int getKerning(Uint32 first, Uint32 second, unsigned int characterSize) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the line spacing
|
||||
|
@ -171,7 +171,7 @@ public :
|
|||
/// \return Line spacing, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
int GetLineSpacing(unsigned int characterSize) const;
|
||||
int getLineSpacing(unsigned int characterSize) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Retrieve the texture containing the loaded glyphs of a certain size
|
||||
|
@ -185,7 +185,7 @@ public :
|
|||
/// \return Texture containing the glyphs of the requested size
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Texture& GetTexture(unsigned int characterSize) const;
|
||||
const Texture& getTexture(unsigned int characterSize) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Overload of assignment operator
|
||||
|
@ -209,7 +209,7 @@ public :
|
|||
/// \return Reference to the built-in default font
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static const Font& GetDefaultFont();
|
||||
static const Font& getDefaultFont();
|
||||
|
||||
private :
|
||||
|
||||
|
@ -219,11 +219,11 @@ private :
|
|||
////////////////////////////////////////////////////////////
|
||||
struct Row
|
||||
{
|
||||
Row(unsigned int top, unsigned int height) : Width(0), Top(top), Height(height) {}
|
||||
Row(unsigned int top, unsigned int height) : width(0), top(top), height(height) {}
|
||||
|
||||
unsigned int Width; ///< Current width of the row
|
||||
unsigned int Top; ///< Y position of the row into the texture
|
||||
unsigned int Height; ///< Height of the row
|
||||
unsigned int width; ///< Current width of the row
|
||||
unsigned int top; ///< Y position of the row into the texture
|
||||
unsigned int height; ///< Height of the row
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -239,17 +239,17 @@ private :
|
|||
{
|
||||
Page();
|
||||
|
||||
GlyphTable Glyphs; ///< Table mapping code points to their corresponding glyph
|
||||
sf::Texture Texture; ///< Texture containing the pixels of the glyphs
|
||||
unsigned int NextRow; ///< Y position of the next new row in the texture
|
||||
std::vector<Row> Rows; ///< List containing the position of all the existing rows
|
||||
GlyphTable glyphs; ///< Table mapping code points to their corresponding glyph
|
||||
sf::Texture texture; ///< Texture containing the pixels of the glyphs
|
||||
unsigned int nextRow; ///< Y position of the next new row in the texture
|
||||
std::vector<Row> rows; ///< List containing the position of all the existing rows
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Free all the internal resources
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Cleanup();
|
||||
void cleanup();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Load a new glyph and store it in the cache
|
||||
|
@ -261,7 +261,7 @@ private :
|
|||
/// \return The glyph corresponding to \a codePoint and \a characterSize
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Glyph LoadGlyph(Uint32 codePoint, unsigned int characterSize, bool bold) const;
|
||||
Glyph loadGlyph(Uint32 codePoint, unsigned int characterSize, bool bold) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Find a suitable rectangle within the texture for a glyph
|
||||
|
@ -273,7 +273,7 @@ private :
|
|||
/// \return Found rectangle within the texture
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
IntRect FindGlyphRect(Page& page, unsigned int width, unsigned int height) const;
|
||||
IntRect findGlyphRect(Page& page, unsigned int width, unsigned int height) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Make sure that the given size is the current one
|
||||
|
@ -283,7 +283,7 @@ private :
|
|||
/// \return True on success, false if any error happened
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool SetCurrentSize(unsigned int characterSize) const;
|
||||
bool setCurrentSize(unsigned int characterSize) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Types
|
||||
|
@ -313,7 +313,7 @@ private :
|
|||
///
|
||||
/// Fonts can be loaded from a file, from memory or from a custom
|
||||
/// stream, and supports the most common types of fonts. See
|
||||
/// the LoadFromFile function for the complete list of supported formats.
|
||||
/// the loadFromFile function for the complete list of supported formats.
|
||||
///
|
||||
/// Once it is loaded, a sf::Font instance provides three
|
||||
/// types of informations about the font:
|
||||
|
@ -347,22 +347,22 @@ private :
|
|||
/// sf::Font font;
|
||||
///
|
||||
/// // Load it from a file
|
||||
/// if (!font.LoadFromFile("arial.ttf"))
|
||||
/// if (!font.loadFromFile("arial.ttf"))
|
||||
/// {
|
||||
/// // error...
|
||||
/// }
|
||||
///
|
||||
/// // Create a text which uses our font
|
||||
/// sf::Text text1;
|
||||
/// text1.SetFont(font);
|
||||
/// text1.SetCharacterSize(30);
|
||||
/// text1.SetStyle(sf::Text::Regular);
|
||||
/// text1.setFont(font);
|
||||
/// text1.setCharacterSize(30);
|
||||
/// text1.setStyle(sf::Text::Regular);
|
||||
///
|
||||
/// // Create another text using the same font, but with different parameters
|
||||
/// sf::Text text2;
|
||||
/// text2.SetFont(font);
|
||||
/// text2.SetCharacterSize(50);
|
||||
/// text1.SetStyle(sf::Text::Italic);
|
||||
/// text2.setFont(font);
|
||||
/// text2.setCharacterSize(50);
|
||||
/// text1.setStyle(sf::Text::Italic);
|
||||
/// \endcode
|
||||
///
|
||||
/// Apart from loading font files, and passing them to instances
|
||||
|
|
|
@ -46,14 +46,14 @@ public :
|
|||
/// \brief Default constructor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Glyph() : Advance(0) {}
|
||||
Glyph() : advance(0) {}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
int Advance; ///< Offset to move horizontically to the next character
|
||||
IntRect Bounds; ///< Bounding rectangle of the glyph, in coordinates relative to the baseline
|
||||
IntRect TextureRect; ///< Texture coordinates of the glyph inside the font's texture
|
||||
int advance; ///< Offset to move horizontically to the next character
|
||||
IntRect bounds; ///< Bounding rectangle of the glyph, in coordinates relative to the baseline
|
||||
IntRect textureRect; ///< Texture coordinates of the glyph inside the font's texture
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
|
|
@ -63,7 +63,7 @@ public :
|
|||
/// \param color Fill color
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Create(unsigned int width, unsigned int height, const Color& color = Color(0, 0, 0));
|
||||
void create(unsigned int width, unsigned int height, const Color& color = Color(0, 0, 0));
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create the image from an array of pixels
|
||||
|
@ -78,7 +78,7 @@ public :
|
|||
/// \param pixels Array of pixels to copy to the image
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Create(unsigned int width, unsigned int height, const Uint8* pixels);
|
||||
void create(unsigned int width, unsigned int height, const Uint8* pixels);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Load the image from a file on disk
|
||||
|
@ -92,10 +92,10 @@ public :
|
|||
///
|
||||
/// \return True if loading was successful
|
||||
///
|
||||
/// \see LoadFromMemory, LoadFromStream, SaveToFile
|
||||
/// \see loadFromMemory, loadFromStream, saveToFile
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromFile(const std::string& filename);
|
||||
bool loadFromFile(const std::string& filename);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Load the image from a file in memory
|
||||
|
@ -110,10 +110,10 @@ public :
|
|||
///
|
||||
/// \return True if loading was successful
|
||||
///
|
||||
/// \see LoadFromFile, LoadFromStream
|
||||
/// \see loadFromFile, loadFromStream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromMemory(const void* data, std::size_t size);
|
||||
bool loadFromMemory(const void* data, std::size_t size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Load the image from a custom stream
|
||||
|
@ -127,10 +127,10 @@ public :
|
|||
///
|
||||
/// \return True if loading was successful
|
||||
///
|
||||
/// \see LoadFromFile, LoadFromMemory
|
||||
/// \see loadFromFile, loadFromMemory
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromStream(InputStream& stream);
|
||||
bool loadFromStream(InputStream& stream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Save the image to a file on disk
|
||||
|
@ -144,30 +144,30 @@ public :
|
|||
///
|
||||
/// \return True if saving was successful
|
||||
///
|
||||
/// \see Create, LoadFromFile, LoadFromMemory
|
||||
/// \see create, loadFromFile, loadFromMemory
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool SaveToFile(const std::string& filename) const;
|
||||
bool saveToFile(const std::string& filename) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the width of the image
|
||||
///
|
||||
/// \return Width in pixels
|
||||
///
|
||||
/// \see GetHeight
|
||||
/// \see getHeight
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int GetWidth() const;
|
||||
unsigned int getWidth() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the height of the image
|
||||
///
|
||||
/// \return Height in pixels
|
||||
///
|
||||
/// \see GetWidth
|
||||
/// \see getWidth
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int GetHeight() const;
|
||||
unsigned int getHeight() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Create a transparency mask from a specified color-key
|
||||
|
@ -180,7 +180,7 @@ public :
|
|||
/// \param alpha Alpha value to assign to transparent pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void CreateMaskFromColor(const Color& color, Uint8 alpha = 0);
|
||||
void createMaskFromColor(const Color& color, Uint8 alpha = 0);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Copy pixels from another image onto this one
|
||||
|
@ -202,7 +202,7 @@ public :
|
|||
/// \param applyAlpha Should the copy take in account the source transparency?
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Copy(const Image& source, unsigned int destX, unsigned int destY, const IntRect& sourceRect = IntRect(0, 0, 0, 0), bool applyAlpha = false);
|
||||
void copy(const Image& source, unsigned int destX, unsigned int destY, const IntRect& sourceRect = IntRect(0, 0, 0, 0), bool applyAlpha = false);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the color of a pixel
|
||||
|
@ -215,10 +215,10 @@ public :
|
|||
/// \param y Y coordinate of pixel to change
|
||||
/// \param color New color of the pixel
|
||||
///
|
||||
/// \see GetPixel
|
||||
/// \see getPixel
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetPixel(unsigned int x, unsigned int y, const Color& color);
|
||||
void setPixel(unsigned int x, unsigned int y, const Color& color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the color of a pixel
|
||||
|
@ -232,8 +232,10 @@ public :
|
|||
///
|
||||
/// \return Color of the pixel at coordinates (x, y)
|
||||
///
|
||||
/// \see setPixel
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Color GetPixel(unsigned int x, unsigned int y) const;
|
||||
Color getPixel(unsigned int x, unsigned int y) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get a read-only pointer to the array of pixels
|
||||
|
@ -248,19 +250,19 @@ public :
|
|||
/// \return Read-only pointer to the array of pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Uint8* GetPixelsPtr() const;
|
||||
const Uint8* getPixelsPtr() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Flip the image horizontally (left <-> right)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void FlipHorizontally();
|
||||
void flipHorizontally();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Flip the image vertically (top <-> bottom)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void FlipVertically();
|
||||
void flipVertically();
|
||||
|
||||
private :
|
||||
|
||||
|
@ -293,7 +295,7 @@ private :
|
|||
/// channels -- just like a sf::Color.
|
||||
/// All the functions that return an array of pixels follow
|
||||
/// this rule, and all parameters that you pass to sf::Image
|
||||
/// functions (such as LoadFromPixels) must use this
|
||||
/// functions (such as loadFromPixels) must use this
|
||||
/// representation as well.
|
||||
///
|
||||
/// A sf::Image can be copied, but it is a heavy resource and
|
||||
|
@ -304,24 +306,24 @@ private :
|
|||
/// \code
|
||||
/// // Load an image file from a file
|
||||
/// sf::Image background;
|
||||
/// if (!background.LoadFromFile("background.jpg"))
|
||||
/// if (!background.loadFromFile("background.jpg"))
|
||||
/// return -1;
|
||||
///
|
||||
/// // Create a 20x20 image filled with black color
|
||||
/// sf::Image image;
|
||||
/// if (!image.Create(20, 20, sf::Color::Black))
|
||||
/// if (!image.create(20, 20, sf::Color::Black))
|
||||
/// return -1;
|
||||
///
|
||||
/// // Copy image1 on image2 at position (10, 10)
|
||||
/// image.Copy(background, 10, 10);
|
||||
/// image.copy(background, 10, 10);
|
||||
///
|
||||
/// // Make the top-left pixel transparent
|
||||
/// sf::Color color = image.GetPixel(0, 0);
|
||||
/// sf::Color color = image.getPixel(0, 0);
|
||||
/// color.a = 0;
|
||||
/// image.SetPixel(0, 0, color);
|
||||
/// image.setPixel(0, 0, color);
|
||||
///
|
||||
/// // Save the image to a file
|
||||
/// if (!image.SaveToFile("result.png"))
|
||||
/// if (!image.saveToFile("result.png"))
|
||||
/// return -1;
|
||||
/// \endcode
|
||||
///
|
||||
|
|
|
@ -100,10 +100,10 @@ public :
|
|||
///
|
||||
/// \return True if the point is inside, false otherwise
|
||||
///
|
||||
/// \see Intersects
|
||||
/// \see intersects
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool Contains(T x, T y) const;
|
||||
bool contains(T x, T y) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check if a point is inside the rectangle's area
|
||||
|
@ -112,10 +112,10 @@ public :
|
|||
///
|
||||
/// \return True if the point is inside, false otherwise
|
||||
///
|
||||
/// \see Intersects
|
||||
/// \see intersects
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool Contains(const Vector2<T>& point) const;
|
||||
bool contains(const Vector2<T>& point) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check the intersection between two rectangles
|
||||
|
@ -124,10 +124,10 @@ public :
|
|||
///
|
||||
/// \return True if rectangles overlap, false otherwise
|
||||
///
|
||||
/// \see Contains
|
||||
/// \see contains
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool Intersects(const Rect<T>& rectangle) const;
|
||||
bool intersects(const Rect<T>& rectangle) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Check the intersection between two rectangles
|
||||
|
@ -140,18 +140,18 @@ public :
|
|||
///
|
||||
/// \return True if rectangles overlap, false otherwise
|
||||
///
|
||||
/// \see Contains
|
||||
/// \see contains
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool Intersects(const Rect<T>& rectangle, Rect<T>& intersection) const;
|
||||
bool intersects(const Rect<T>& rectangle, Rect<T>& intersection) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
T Left; ///< Left coordinate of the rectangle
|
||||
T Top; ///< Top coordinate of the rectangle
|
||||
T Width; ///< Width of the rectangle
|
||||
T Height; ///< Height of the rectangle
|
||||
T left; ///< Left coordinate of the rectangle
|
||||
T top; ///< Top coordinate of the rectangle
|
||||
T width; ///< Width of the rectangle
|
||||
T height; ///< Height of the rectangle
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -202,18 +202,18 @@ typedef Rect<float> FloatRect;
|
|||
///
|
||||
/// A rectangle is defined by its top-left corner and its size.
|
||||
/// It is a very simple class defined for convenience, so
|
||||
/// its member variables (Left, Top, Width and Height) are public
|
||||
/// its member variables (left, top, width and height) are public
|
||||
/// and can be accessed directly, just like the vector classes
|
||||
/// (Vector2 and Vector3).
|
||||
///
|
||||
/// To keep things simple, sf::Rect doesn't define
|
||||
/// functions to emulate the properties that are not directly
|
||||
/// members (such as Right, Bottom, Center, etc.), it rather
|
||||
/// members (such as right, bottom, center, etc.), it rather
|
||||
/// only provides intersection functions.
|
||||
///
|
||||
/// sf::Rect uses the usual rules for its boundaries:
|
||||
/// \li The Left and Top edges are included in the rectangle's area
|
||||
/// \li The right (Left + Width) and bottom (Top + Height) edges are excluded from the rectangle's area
|
||||
/// \li The left and top edges are included in the rectangle's area
|
||||
/// \li The right (left + width) and bottom (top + height) edges are excluded from the rectangle's area
|
||||
///
|
||||
/// This means that sf::IntRect(0, 0, 1, 1) and sf::IntRect(1, 1, 1, 1)
|
||||
/// don't intersect.
|
||||
|
@ -236,12 +236,12 @@ typedef Rect<float> FloatRect;
|
|||
/// sf::IntRect r2(position, size);
|
||||
///
|
||||
/// // Test intersections with the point (3, 1)
|
||||
/// bool b1 = r1.Contains(3, 1); // true
|
||||
/// bool b2 = r2.Contains(3, 1); // false
|
||||
/// bool b1 = r1.contains(3, 1); // true
|
||||
/// bool b2 = r2.contains(3, 1); // false
|
||||
///
|
||||
/// // Test the intersection between r1 and r2
|
||||
/// sf::IntRect result;
|
||||
/// bool b3 = r1.Intersects(r2, result); // true
|
||||
/// bool b3 = r1.intersects(r2, result); // true
|
||||
/// // result == (4, 2, 16, 3)
|
||||
/// \endcode
|
||||
///
|
||||
|
|
|
@ -26,10 +26,10 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Rect<T>::Rect() :
|
||||
Left (0),
|
||||
Top (0),
|
||||
Width (0),
|
||||
Height(0)
|
||||
left (0),
|
||||
top (0),
|
||||
width (0),
|
||||
height(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -38,10 +38,10 @@ Height(0)
|
|||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Rect<T>::Rect(T left, T top, T width, T height) :
|
||||
Left (left),
|
||||
Top (top),
|
||||
Width (width),
|
||||
Height(height)
|
||||
left (left),
|
||||
top (top),
|
||||
width (width),
|
||||
height(height)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -50,10 +50,10 @@ Height(height)
|
|||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
Rect<T>::Rect(const Vector2<T>& position, const Vector2<T>& size) :
|
||||
Left (position.x),
|
||||
Top (position.y),
|
||||
Width (size.x),
|
||||
Height(size.y)
|
||||
left (position.x),
|
||||
top (position.y),
|
||||
width (size.x),
|
||||
height(size.y)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -63,53 +63,53 @@ Height(size.y)
|
|||
template <typename T>
|
||||
template <typename U>
|
||||
Rect<T>::Rect(const Rect<U>& rectangle) :
|
||||
Left (static_cast<T>(rectangle.Left)),
|
||||
Top (static_cast<T>(rectangle.Top)),
|
||||
Width (static_cast<T>(rectangle.Width)),
|
||||
Height(static_cast<T>(rectangle.Height))
|
||||
left (static_cast<T>(rectangle.left)),
|
||||
top (static_cast<T>(rectangle.Top)),
|
||||
width (static_cast<T>(rectangle.Width)),
|
||||
height(static_cast<T>(rectangle.Height))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
bool Rect<T>::Contains(T x, T y) const
|
||||
bool Rect<T>::contains(T x, T y) const
|
||||
{
|
||||
return (x >= Left) && (x < Left + Width) && (y >= Top) && (y < Top + Height);
|
||||
return (x >= left) && (x < left + width) && (y >= top) && (y < top + height);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
bool Rect<T>::Contains(const Vector2<T>& point) const
|
||||
bool Rect<T>::contains(const Vector2<T>& point) const
|
||||
{
|
||||
return Contains(point.x, point.y);
|
||||
return contains(point.x, point.y);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
bool Rect<T>::Intersects(const Rect<T>& rectangle) const
|
||||
bool Rect<T>::intersects(const Rect<T>& rectangle) const
|
||||
{
|
||||
Rect<T> intersection;
|
||||
return Intersects(rectangle, intersection);
|
||||
return intersects(rectangle, intersection);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
bool Rect<T>::Intersects(const Rect<T>& rectangle, Rect<T>& intersection) const
|
||||
bool Rect<T>::intersects(const Rect<T>& rectangle, Rect<T>& intersection) const
|
||||
{
|
||||
// Compute the intersection boundaries
|
||||
T left = std::max(Left, rectangle.Left);
|
||||
T top = std::max(Top, rectangle.Top);
|
||||
T right = std::min(Left + Width, rectangle.Left + rectangle.Width);
|
||||
T bottom = std::min(Top + Height, rectangle.Top + rectangle.Height);
|
||||
T interLeft = std::max(left, rectangle.left);
|
||||
T interTop = std::max(top, rectangle.top);
|
||||
T interRight = std::min(left + width, rectangle.left + rectangle.width);
|
||||
T interBottom = std::min(top + height, rectangle.top + rectangle.height);
|
||||
|
||||
// If the intersection is valid (positive non zero area), then there is an intersection
|
||||
if ((left < right) && (top < bottom))
|
||||
if ((interLeft < interRight) && (interTop < interBottom))
|
||||
{
|
||||
intersection = Rect<T>(left, top, right - left, bottom - top);
|
||||
intersection = Rect<T>(interLeft, interTop, interRight - interLeft, interBottom - interTop);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
@ -124,8 +124,8 @@ bool Rect<T>::Intersects(const Rect<T>& rectangle, Rect<T>& intersection) const
|
|||
template <typename T>
|
||||
inline bool operator ==(const Rect<T>& left, const Rect<T>& right)
|
||||
{
|
||||
return (left.Left == right.Left) && (left.Width == right.Width) &&
|
||||
(left.Top == right.Top) && (left.Height == right.Height);
|
||||
return (left.left == right.left) && (left.width == right.width) &&
|
||||
(left.top == right.top) && (left.height == right.height);
|
||||
}
|
||||
|
||||
|
||||
|
@ -133,6 +133,5 @@ inline bool operator ==(const Rect<T>& left, const Rect<T>& right)
|
|||
template <typename T>
|
||||
inline bool operator !=(const Rect<T>& left, const Rect<T>& right)
|
||||
{
|
||||
return (left.Left != right.Left) || (left.Width != right.Width) ||
|
||||
(left.Top != right.Top) || (left.Height != right.Height);
|
||||
return !(left == right);
|
||||
}
|
||||
|
|
|
@ -55,20 +55,20 @@ public :
|
|||
///
|
||||
/// \param size New size of the rectangle
|
||||
///
|
||||
/// \see GetSize
|
||||
/// \see getSize
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetSize(const Vector2f& size);
|
||||
void setSize(const Vector2f& size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the size of the rectangle
|
||||
///
|
||||
/// \return Size of the rectangle
|
||||
///
|
||||
/// \see SetSize
|
||||
/// \see setSize
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Vector2f& GetSize() const;
|
||||
const Vector2f& getSize() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the number of points defining the shape
|
||||
|
@ -76,7 +76,7 @@ public :
|
|||
/// \return Number of points of the shape
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual unsigned int GetPointCount() const;
|
||||
virtual unsigned int getPointCount() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get a point of the shape
|
||||
|
@ -88,7 +88,7 @@ public :
|
|||
/// \return Index-th point of the shape
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual Vector2f GetPoint(unsigned int index) const;
|
||||
virtual Vector2f getPoint(unsigned int index) const;
|
||||
|
||||
private :
|
||||
|
||||
|
@ -115,12 +115,12 @@ private :
|
|||
/// Usage example:
|
||||
/// \code
|
||||
/// sf::RectangleShape rectangle;
|
||||
/// rectangle.SetSize(sf::Vector2f(100, 50));
|
||||
/// rectangle.SetOutlineColor(sf::Color::Red);
|
||||
/// rectangle.SetOutlineThickness(5);
|
||||
/// rectangle.SetPosition(10, 20);
|
||||
/// rectangle.setSize(sf::Vector2f(100, 50));
|
||||
/// rectangle.setOutlineColor(sf::Color::Red);
|
||||
/// rectangle.setOutlineThickness(5);
|
||||
/// rectangle.setPosition(10, 20);
|
||||
/// ...
|
||||
/// window.Draw(rectangle);
|
||||
/// window.draw(rectangle);
|
||||
/// \endcode
|
||||
///
|
||||
/// \see sf::Shape, sf::CircleShape, sf::ConvexShape
|
||||
|
|
|
@ -66,7 +66,7 @@ public :
|
|||
/// \param blendMode Blend mode to use
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderStates(sf::BlendMode blendMode);
|
||||
RenderStates(BlendMode blendMode);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct a default set of render states with a custom transform
|
||||
|
@ -74,7 +74,7 @@ public :
|
|||
/// \param transform Transform to use
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderStates(const sf::Transform& transform);
|
||||
RenderStates(const Transform& transform);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct a default set of render states with a custom texture
|
||||
|
@ -82,7 +82,7 @@ public :
|
|||
/// \param texture Texture to use
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderStates(const sf::Texture* texture);
|
||||
RenderStates(const Texture* texture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct a default set of render states with a custom shader
|
||||
|
@ -90,7 +90,7 @@ public :
|
|||
/// \param shader Shader to use
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderStates(const sf::Shader* shader);
|
||||
RenderStates(const Shader* shader);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct a set of render states with all its attributes
|
||||
|
@ -101,8 +101,8 @@ public :
|
|||
/// \param shader Shader to use
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderStates(sf::BlendMode blendMode, const sf::Transform& transform,
|
||||
const sf::Texture* texture, const sf::Shader* shader);
|
||||
RenderStates(BlendMode blendMode, const Transform& transform,
|
||||
const Texture* texture, const Shader* shader);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Static member data
|
||||
|
@ -112,10 +112,10 @@ public :
|
|||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
sf::BlendMode BlendMode; ///< Blending mode
|
||||
sf::Transform Transform; ///< Transform
|
||||
const sf::Texture* Texture; ///< Texture
|
||||
const sf::Shader* Shader; ///< Shader
|
||||
BlendMode blendMode; ///< Blending mode
|
||||
Transform transform; ///< Transform
|
||||
const Texture* texture; ///< Texture
|
||||
const Shader* shader; ///< Shader
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
@ -158,7 +158,7 @@ public :
|
|||
/// function: sf::RenderStates has an implicit one-argument
|
||||
/// constructor for each state.
|
||||
/// \code
|
||||
/// window.Draw(sprite, shader);
|
||||
/// window.draw(sprite, shader);
|
||||
/// \endcode
|
||||
///
|
||||
/// When you're inside the Draw function of a drawable
|
||||
|
|
|
@ -67,7 +67,7 @@ public :
|
|||
/// \param color Fill color to use to clear the render target
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Clear(const Color& color = Color(0, 0, 0, 255));
|
||||
void clear(const Color& color = Color(0, 0, 0, 255));
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change the current active view
|
||||
|
@ -81,24 +81,24 @@ public :
|
|||
/// so it is not necessary to keep the original one alive
|
||||
/// after calling this function.
|
||||
/// To restore the original view of the target, you can pass
|
||||
/// the result of GetDefaultView() to this function.
|
||||
/// the result of getDefaultView() to this function.
|
||||
///
|
||||
/// \param view New view to use
|
||||
///
|
||||
/// \see GetView, GetDefaultView
|
||||
/// \see getView, getDefaultView
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetView(const View& view);
|
||||
void setView(const View& view);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the view currently in use in the render target
|
||||
///
|
||||
/// \return The view object that is currently used
|
||||
///
|
||||
/// \see SetView, GetDefaultView
|
||||
/// \see setView, getDefaultView
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const View& GetView() const;
|
||||
const View& getView() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the default view of the render target
|
||||
|
@ -108,10 +108,10 @@ public :
|
|||
///
|
||||
/// \return The default view of the render target
|
||||
///
|
||||
/// \see SetView, GetView
|
||||
/// \see setView, getView
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const View& GetDefaultView() const;
|
||||
const View& getDefaultView() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the viewport of a view, applied to this render target
|
||||
|
@ -126,7 +126,7 @@ public :
|
|||
/// \return Viewport rectangle, expressed in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
IntRect GetViewport(const View& view) const;
|
||||
IntRect getViewport(const View& view) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Convert a point from target coordinates to view coordinates
|
||||
|
@ -150,7 +150,7 @@ public :
|
|||
/// \return The converted point, in "world" units
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Vector2f ConvertCoords(unsigned int x, unsigned int y) const;
|
||||
Vector2f convertCoords(unsigned int x, unsigned int y) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Convert a point from target coordinates to view coordinates
|
||||
|
@ -176,7 +176,7 @@ public :
|
|||
/// \return The converted point, in "world" units
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Vector2f ConvertCoords(unsigned int x, unsigned int y, const View& view) const;
|
||||
Vector2f convertCoords(unsigned int x, unsigned int y, const View& view) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Draw a drawable object to the render-target
|
||||
|
@ -185,7 +185,7 @@ public :
|
|||
/// \param states Render states to use for drawing
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Draw(const Drawable& drawable, const RenderStates& states = RenderStates::Default);
|
||||
void draw(const Drawable& drawable, const RenderStates& states = RenderStates::Default);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Draw primitives defined by an array of vertices
|
||||
|
@ -196,7 +196,7 @@ public :
|
|||
/// \param states Render states to use for drawing
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Draw(const Vertex* vertices, unsigned int vertexCount,
|
||||
void draw(const Vertex* vertices, unsigned int vertexCount,
|
||||
PrimitiveType type, const RenderStates& states = RenderStates::Default);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -204,10 +204,8 @@ public :
|
|||
///
|
||||
/// \return Size in pixels
|
||||
///
|
||||
/// \see GetHeight
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual Vector2u GetSize() const = 0;
|
||||
virtual Vector2u getSize() const = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Save the current OpenGL render states and matrices
|
||||
|
@ -222,10 +220,10 @@ public :
|
|||
/// calls Draw functions. Example:
|
||||
/// \code
|
||||
/// // OpenGL code here...
|
||||
/// window.PushGLStates();
|
||||
/// window.Draw(...);
|
||||
/// window.Draw(...);
|
||||
/// window.PopGLStates();
|
||||
/// window.pushGLStates();
|
||||
/// window.draw(...);
|
||||
/// window.draw(...);
|
||||
/// window.popGLStates();
|
||||
/// // OpenGL code here...
|
||||
/// \endcode
|
||||
///
|
||||
|
@ -238,44 +236,44 @@ public :
|
|||
/// saved and restored). Take a look at the ResetGLStates
|
||||
/// function if you do so.
|
||||
///
|
||||
/// \see PopGLStates
|
||||
/// \see popGLStates
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void PushGLStates();
|
||||
void pushGLStates();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Restore the previously saved OpenGL render states and matrices
|
||||
///
|
||||
/// See the description of PushGLStates to get a detailed
|
||||
/// See the description of pushGLStates to get a detailed
|
||||
/// description of these functions.
|
||||
///
|
||||
/// \see PushGLStates
|
||||
/// \see pushGLStates
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void PopGLStates();
|
||||
void popGLStates();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Reset the internal OpenGL states so that the target is ready for drawing
|
||||
///
|
||||
/// This function can be used when you mix SFML drawing
|
||||
/// and direct OpenGL rendering, if you choose not to use
|
||||
/// PushGLStates/PopGLStates. It makes sure that all OpenGL
|
||||
/// states needed by SFML are set, so that subsequent Draw()
|
||||
/// pushGLStates/popGLStates. It makes sure that all OpenGL
|
||||
/// states needed by SFML are set, so that subsequent draw()
|
||||
/// calls will work as expected.
|
||||
///
|
||||
/// Example:
|
||||
/// \code
|
||||
/// // OpenGL code here...
|
||||
/// glPushAttrib(...);
|
||||
/// window.ResetGLStates();
|
||||
/// window.Draw(...);
|
||||
/// window.Draw(...);
|
||||
/// window.resetGLStates();
|
||||
/// window.draw(...);
|
||||
/// window.draw(...);
|
||||
/// glPopAttrib(...);
|
||||
/// // OpenGL code here...
|
||||
/// \endcode
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void ResetGLStates();
|
||||
void resetGLStates();
|
||||
|
||||
protected :
|
||||
|
||||
|
@ -292,13 +290,13 @@ protected :
|
|||
/// target is created and ready for drawing.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Initialize();
|
||||
void initialize();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Apply the current view
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void ApplyCurrentView();
|
||||
void applyCurrentView();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Apply a new blending mode
|
||||
|
@ -306,7 +304,7 @@ protected :
|
|||
/// \param mode Blending mode to apply
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void ApplyBlendMode(BlendMode mode);
|
||||
void applyBlendMode(BlendMode mode);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Apply a new transform
|
||||
|
@ -314,7 +312,7 @@ protected :
|
|||
/// \param transform Transform to apply
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void ApplyTransform(const Transform& transform);
|
||||
void applyTransform(const Transform& transform);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Apply a new texture
|
||||
|
@ -322,7 +320,7 @@ protected :
|
|||
/// \param texture Texture to apply
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void ApplyTexture(const Texture* texture);
|
||||
void applyTexture(const Texture* texture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Apply a new shader
|
||||
|
@ -330,7 +328,7 @@ protected :
|
|||
/// \param shader Shader to apply
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void ApplyShader(const Shader* shader);
|
||||
void applyShader(const Shader* shader);
|
||||
|
||||
private :
|
||||
|
||||
|
@ -346,7 +344,7 @@ private :
|
|||
/// \return True if the function succeeded
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual bool Activate(bool active) = 0;
|
||||
virtual bool activate(bool active) = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Render states cache
|
||||
|
@ -356,11 +354,11 @@ private :
|
|||
{
|
||||
enum {VertexCacheSize = 4};
|
||||
|
||||
bool ViewChanged; ///< Has the current view changed since last draw?
|
||||
BlendMode LastBlendMode; ///< Cached blending mode
|
||||
Uint64 LastTextureId; ///< Cached texture
|
||||
bool UseVertexCache; ///< Did we previously use the vertex cache?
|
||||
Vertex VertexCache[VertexCacheSize]; ///< Pre-transformed vertices cache
|
||||
bool viewChanged; ///< Has the current view changed since last draw?
|
||||
BlendMode lastBlendMode; ///< Cached blending mode
|
||||
Uint64 lastTextureId; ///< Cached texture
|
||||
bool useVertexCache; ///< Did we previously use the vertex cache?
|
||||
Vertex vertexCache[VertexCacheSize]; ///< Pre-transformed vertices cache
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -397,7 +395,7 @@ private :
|
|||
/// OpenGL stuff. It is even possible to mix together OpenGL calls
|
||||
/// and regular SFML drawing commands. When doing so, make sure that
|
||||
/// OpenGL states are not messed up by calling the
|
||||
/// PushGLStates/PopGLStates functions.
|
||||
/// pushGLStates/popGLStates functions.
|
||||
///
|
||||
/// \see sf::RenderWindow, sf::RenderTexture, sf::View
|
||||
///
|
||||
|
|
|
@ -52,9 +52,9 @@ public :
|
|||
/// \brief Default constructor
|
||||
///
|
||||
/// Constructs an empty, invalid render-texture. You must
|
||||
/// call Create to have a valid render-texture.
|
||||
/// call create to have a valid render-texture.
|
||||
///
|
||||
/// \see Create
|
||||
/// \see create
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
RenderTexture();
|
||||
|
@ -76,37 +76,37 @@ public :
|
|||
/// a depth-buffer. Otherwise it is unnecessary, and you should
|
||||
/// leave this parameter to false (which is its default value).
|
||||
///
|
||||
/// \param width Width of the render-texture
|
||||
/// \param height Height of the render-texture
|
||||
/// \param depthBuffer Do you want this render-texture to have a depth buffer?
|
||||
/// \param width Width of the render-texture
|
||||
/// \param height Height of the render-texture
|
||||
/// \param depthBuffer Do you want this render-texture to have a depth buffer?
|
||||
///
|
||||
/// \return True if creation has been successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool Create(unsigned int width, unsigned int height, bool depthBuffer = false);
|
||||
bool create(unsigned int width, unsigned int height, bool depthBuffer = false);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enable or disable texture smoothing
|
||||
///
|
||||
/// This function is similar to Texture::SetSmooth.
|
||||
/// This function is similar to Texture::setSmooth.
|
||||
/// This parameter is disabled by default.
|
||||
///
|
||||
/// \param smooth True to enable smoothing, false to disable it
|
||||
///
|
||||
/// \see IsSmooth
|
||||
/// \see isSmooth
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetSmooth(bool smooth);
|
||||
void setSmooth(bool smooth);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether the smooth filtering is enabled or not
|
||||
///
|
||||
/// \return True if texture smoothing is enabled
|
||||
///
|
||||
/// \see SetSmooth
|
||||
/// \see setSmooth
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool IsSmooth() const;
|
||||
bool isSmooth() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Activate of deactivate the render-texture for rendering
|
||||
|
@ -123,7 +123,7 @@ public :
|
|||
/// \return True if operation was successful, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool SetActive(bool active = true);
|
||||
bool setActive(bool active = true);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Update the contents of the target texture
|
||||
|
@ -134,18 +134,18 @@ public :
|
|||
/// it may leave the texture in an undefined state.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Display();
|
||||
void display();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the size of the rendering region of the texture
|
||||
///
|
||||
/// The returned value is the size that you passed to
|
||||
/// the Create function.
|
||||
/// the create function.
|
||||
///
|
||||
/// \return Size in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual Vector2u GetSize() const;
|
||||
virtual Vector2u getSize() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get a read-only reference to the target texture
|
||||
|
@ -161,7 +161,7 @@ public :
|
|||
/// \return Const reference to the texture
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Texture& GetTexture() const;
|
||||
const Texture& getTexture() const;
|
||||
|
||||
private :
|
||||
|
||||
|
@ -176,7 +176,7 @@ private :
|
|||
/// \return True if the function succeeded
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual bool Activate(bool active);
|
||||
virtual bool activate(bool active);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
|
@ -215,35 +215,35 @@ private :
|
|||
///
|
||||
/// // Create a new render-texture
|
||||
/// sf::RenderTexture texture;
|
||||
/// if (!texture.Create(500, 500))
|
||||
/// if (!texture.create(500, 500))
|
||||
/// return -1
|
||||
///
|
||||
/// // The main loop
|
||||
/// while (window.IsOpen())
|
||||
/// while (window.isOpen())
|
||||
/// {
|
||||
/// // Event processing
|
||||
/// // ...
|
||||
///
|
||||
/// // Clear the whole texture with red color
|
||||
/// texture.Clear(sf::Color::Red);
|
||||
/// texture.clear(sf::Color::Red);
|
||||
///
|
||||
/// // Draw stuff to the texture
|
||||
/// texture.Draw(sprite); // sprite is a sf::Sprite
|
||||
/// texture.Draw(shape); // shape is a sf::Shape
|
||||
/// texture.Draw(text); // text is a sf::Text
|
||||
/// texture.draw(sprite); // sprite is a sf::Sprite
|
||||
/// texture.draw(shape); // shape is a sf::Shape
|
||||
/// texture.draw(text); // text is a sf::Text
|
||||
///
|
||||
/// // We're done drawing to the texture
|
||||
/// texture.Display();
|
||||
/// texture.display();
|
||||
///
|
||||
/// // Now we start rendering to the window, clear it first
|
||||
/// window.Clear();
|
||||
/// window.clear();
|
||||
///
|
||||
/// // Draw the texture
|
||||
/// sf::Sprite sprite(texture.GetTexture());
|
||||
/// window.Draw(sprite);
|
||||
/// sf::Sprite sprite(texture.getTexture());
|
||||
/// window.draw(sprite);
|
||||
///
|
||||
/// // End the current frame and display its contents on screen
|
||||
/// window.Display();
|
||||
/// window.display();
|
||||
/// }
|
||||
/// \endcode
|
||||
///
|
||||
|
|
|
@ -109,7 +109,7 @@ public :
|
|||
/// \return Size in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual Vector2u GetSize() const;
|
||||
virtual Vector2u getSize() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Copy the current contents of the window to an image
|
||||
|
@ -118,14 +118,14 @@ public :
|
|||
/// screenshots of the application. If you want to update an
|
||||
/// image with the contents of the window and then use it for
|
||||
/// drawing, you should rather use a sf::Texture and its
|
||||
/// Update(Window&) function.
|
||||
/// update(Window&) function.
|
||||
/// You can also draw things directly to a texture with the
|
||||
/// sf::RenderTexture class.
|
||||
///
|
||||
/// \return Image containing the captured contents
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Image Capture() const;
|
||||
Image capture() const;
|
||||
|
||||
private :
|
||||
|
||||
|
@ -137,7 +137,7 @@ private :
|
|||
/// the window is created.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void OnCreate();
|
||||
virtual void onCreate();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Function called after the window has been resized
|
||||
|
@ -146,7 +146,7 @@ private :
|
|||
/// perform custom actions when the size of the window changes.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void OnResize();
|
||||
virtual void onResize();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Activate the target for rendering
|
||||
|
@ -156,7 +156,7 @@ private :
|
|||
/// \return True if the function succeeded
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual bool Activate(bool active);
|
||||
virtual bool activate(bool active);
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
@ -188,30 +188,30 @@ private :
|
|||
/// sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
|
||||
///
|
||||
/// // Limit the framerate to 60 frames per second (this step is optional)
|
||||
/// window.SetFramerateLimit(60);
|
||||
/// window.setFramerateLimit(60);
|
||||
///
|
||||
/// // The main loop - ends as soon as the window is closed
|
||||
/// while (window.IsOpen())
|
||||
/// while (window.isOpen())
|
||||
/// {
|
||||
/// // Event processing
|
||||
/// sf::Event event;
|
||||
/// while (window.PollEvent(event))
|
||||
/// while (window.pollEvent(event))
|
||||
/// {
|
||||
/// // Request for closing the window
|
||||
/// if (event.Type == sf::Event::Closed)
|
||||
/// window.Close();
|
||||
/// if (event.type == sf::Event::Closed)
|
||||
/// window.close();
|
||||
/// }
|
||||
///
|
||||
/// // Clear the whole window before rendering a new frame
|
||||
/// window.Clear();
|
||||
/// window.clear();
|
||||
///
|
||||
/// // Draw some graphical entities
|
||||
/// window.Draw(sprite);
|
||||
/// window.Draw(circle);
|
||||
/// window.Draw(text);
|
||||
/// window.draw(sprite);
|
||||
/// window.draw(circle);
|
||||
/// window.draw(text);
|
||||
///
|
||||
/// // End the current frame and display its contents on screen
|
||||
/// window.Display();
|
||||
/// window.display();
|
||||
/// }
|
||||
/// \endcode
|
||||
///
|
||||
|
@ -233,15 +233,15 @@ private :
|
|||
/// ...
|
||||
///
|
||||
/// // Start the rendering loop
|
||||
/// while (window.IsOpen())
|
||||
/// while (window.isOpen())
|
||||
/// {
|
||||
/// // Process events
|
||||
/// ...
|
||||
///
|
||||
/// // Draw a background sprite
|
||||
/// window.PushGLStates();
|
||||
/// window.Draw(sprite);
|
||||
/// window.PopGLStates();
|
||||
/// window.pushGLStates();
|
||||
/// window.draw(sprite);
|
||||
/// window.popGLStates();
|
||||
///
|
||||
/// // Draw a 3D object using OpenGL
|
||||
/// glBegin(GL_QUADS);
|
||||
|
@ -250,12 +250,12 @@ private :
|
|||
/// glEnd();
|
||||
///
|
||||
/// // Draw text on top of the 3D object
|
||||
/// window.PushGLStates();
|
||||
/// window.Draw(text);
|
||||
/// window.PopGLStates();
|
||||
/// window.pushGLStates();
|
||||
/// window.draw(text);
|
||||
/// window.popGLStates();
|
||||
///
|
||||
/// // Finally, display the rendered frame on screen
|
||||
/// window.Display();
|
||||
/// window.display();
|
||||
/// }
|
||||
/// \endcode
|
||||
///
|
||||
|
|
|
@ -63,7 +63,7 @@ public :
|
|||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Special type/value that can be passed to SetParameter,
|
||||
/// \brief Special type/value that can be passed to setParameter,
|
||||
/// and that represents the texture of the object being drawn
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
|
@ -102,10 +102,10 @@ public :
|
|||
///
|
||||
/// \return True if loading succeeded, false if it failed
|
||||
///
|
||||
/// \see LoadFromMemory, LoadFromStream
|
||||
/// \see loadFromMemory, loadFromStream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromFile(const std::string& filename, Type type);
|
||||
bool loadFromFile(const std::string& filename, Type type);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Load both the vertex and fragment shaders from files
|
||||
|
@ -123,10 +123,10 @@ public :
|
|||
///
|
||||
/// \return True if loading succeeded, false if it failed
|
||||
///
|
||||
/// \see LoadFromMemory, LoadFromStream
|
||||
/// \see loadFromMemory, loadFromStream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromFile(const std::string& vertexShaderFilename, const std::string& fragmentShaderFilename);
|
||||
bool loadFromFile(const std::string& vertexShaderFilename, const std::string& fragmentShaderFilename);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Load either the vertex or fragment shader from a source code in memory
|
||||
|
@ -143,10 +143,10 @@ public :
|
|||
///
|
||||
/// \return True if loading succeeded, false if it failed
|
||||
///
|
||||
/// \see LoadFromFile, LoadFromStream
|
||||
/// \see loadFromFile, loadFromStream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromMemory(const std::string& shader, Type type);
|
||||
bool loadFromMemory(const std::string& shader, Type type);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Load both the vertex and fragment shaders from source codes in memory
|
||||
|
@ -164,10 +164,10 @@ public :
|
|||
///
|
||||
/// \return True if loading succeeded, false if it failed
|
||||
///
|
||||
/// \see LoadFromFile, LoadFromStream
|
||||
/// \see loadFromFile, loadFromStream
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromMemory(const std::string& vertexShader, const std::string& fragmentShader);
|
||||
bool loadFromMemory(const std::string& vertexShader, const std::string& fragmentShader);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Load either the vertex or fragment shader from a custom stream
|
||||
|
@ -184,10 +184,10 @@ public :
|
|||
///
|
||||
/// \return True if loading succeeded, false if it failed
|
||||
///
|
||||
/// \see LoadFromFile, LoadFromMemory
|
||||
/// \see loadFromFile, loadFromMemory
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromStream(InputStream& stream, Type type);
|
||||
bool loadFromStream(InputStream& stream, Type type);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Load both the vertex and fragment shaders from custom streams
|
||||
|
@ -205,10 +205,10 @@ public :
|
|||
///
|
||||
/// \return True if loading succeeded, false if it failed
|
||||
///
|
||||
/// \see LoadFromFile, LoadFromMemory
|
||||
/// \see loadFromFile, loadFromMemory
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromStream(InputStream& vertexShaderStream, InputStream& fragmentShaderStream);
|
||||
bool loadFromStream(InputStream& vertexShaderStream, InputStream& fragmentShaderStream);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change a float parameter of the shader
|
||||
|
@ -222,14 +222,14 @@ public :
|
|||
/// uniform float myparam; // this is the variable in the shader
|
||||
/// \endcode
|
||||
/// \code
|
||||
/// shader.SetParameter("myparam", 5.2f);
|
||||
/// shader.setParameter("myparam", 5.2f);
|
||||
/// \endcode
|
||||
///
|
||||
/// \param name Name of the parameter in the shader
|
||||
/// \param x Value to assign
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetParameter(const std::string& name, float x);
|
||||
void setParameter(const std::string& name, float x);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change a 2-components vector parameter of the shader
|
||||
|
@ -243,7 +243,7 @@ public :
|
|||
/// uniform vec2 myparam; // this is the variable in the shader
|
||||
/// \endcode
|
||||
/// \code
|
||||
/// shader.SetParameter("myparam", 5.2f, 6.0f);
|
||||
/// shader.setParameter("myparam", 5.2f, 6.0f);
|
||||
/// \endcode
|
||||
///
|
||||
/// \param name Name of the parameter in the shader
|
||||
|
@ -251,7 +251,7 @@ public :
|
|||
/// \param y Second component of the value to assign
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetParameter(const std::string& name, float x, float y);
|
||||
void setParameter(const std::string& name, float x, float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change a 3-components vector parameter of the shader
|
||||
|
@ -265,7 +265,7 @@ public :
|
|||
/// uniform vec3 myparam; // this is the variable in the shader
|
||||
/// \endcode
|
||||
/// \code
|
||||
/// shader.SetParameter("myparam", 5.2f, 6.0f, -8.1f);
|
||||
/// shader.setParameter("myparam", 5.2f, 6.0f, -8.1f);
|
||||
/// \endcode
|
||||
///
|
||||
/// \param name Name of the parameter in the shader
|
||||
|
@ -274,7 +274,7 @@ public :
|
|||
/// \param z Third component of the value to assign
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetParameter(const std::string& name, float x, float y, float z);
|
||||
void setParameter(const std::string& name, float x, float y, float z);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change a 4-components vector parameter of the shader
|
||||
|
@ -288,7 +288,7 @@ public :
|
|||
/// uniform vec4 myparam; // this is the variable in the shader
|
||||
/// \endcode
|
||||
/// \code
|
||||
/// shader.SetParameter("myparam", 5.2f, 6.0f, -8.1f, 0.4f);
|
||||
/// shader.setParameter("myparam", 5.2f, 6.0f, -8.1f, 0.4f);
|
||||
/// \endcode
|
||||
///
|
||||
/// \param name Name of the parameter in the shader
|
||||
|
@ -298,7 +298,7 @@ public :
|
|||
/// \param w Fourth component of the value to assign
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetParameter(const std::string& name, float x, float y, float z, float w);
|
||||
void setParameter(const std::string& name, float x, float y, float z, float w);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change a 2-components vector parameter of the shader
|
||||
|
@ -312,14 +312,14 @@ public :
|
|||
/// uniform vec2 myparam; // this is the variable in the shader
|
||||
/// \endcode
|
||||
/// \code
|
||||
/// shader.SetParameter("myparam", sf::Vector2f(5.2f, 6.0f));
|
||||
/// shader.setParameter("myparam", sf::Vector2f(5.2f, 6.0f));
|
||||
/// \endcode
|
||||
///
|
||||
/// \param name Name of the parameter in the shader
|
||||
/// \param vector Vector to assign
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetParameter(const std::string& name, const Vector2f& vector);
|
||||
void setParameter(const std::string& name, const Vector2f& vector);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change a 3-components vector parameter of the shader
|
||||
|
@ -333,14 +333,14 @@ public :
|
|||
/// uniform vec3 myparam; // this is the variable in the shader
|
||||
/// \endcode
|
||||
/// \code
|
||||
/// shader.SetParameter("myparam", sf::Vector3f(5.2f, 6.0f, -8.1f));
|
||||
/// shader.setParameter("myparam", sf::Vector3f(5.2f, 6.0f, -8.1f));
|
||||
/// \endcode
|
||||
///
|
||||
/// \param name Name of the parameter in the shader
|
||||
/// \param vector Vector to assign
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetParameter(const std::string& name, const Vector3f& vector);
|
||||
void setParameter(const std::string& name, const Vector3f& vector);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change a color parameter of the shader
|
||||
|
@ -360,14 +360,14 @@ public :
|
|||
/// uniform vec4 color; // this is the variable in the shader
|
||||
/// \endcode
|
||||
/// \code
|
||||
/// shader.SetParameter("color", sf::Color(255, 128, 0, 255));
|
||||
/// shader.setParameter("color", sf::Color(255, 128, 0, 255));
|
||||
/// \endcode
|
||||
///
|
||||
/// \param name Name of the parameter in the shader
|
||||
/// \param color Color to assign
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetParameter(const std::string& name, const Color& color);
|
||||
void setParameter(const std::string& name, const Color& color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change a matrix parameter of the shader
|
||||
|
@ -383,14 +383,14 @@ public :
|
|||
/// \code
|
||||
/// sf::Transform transform;
|
||||
/// transform.Translate(5, 10);
|
||||
/// shader.SetParameter("matrix", transform);
|
||||
/// shader.setParameter("matrix", transform);
|
||||
/// \endcode
|
||||
///
|
||||
/// \param name Name of the parameter in the shader
|
||||
/// \param transform Transform to assign
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetParameter(const std::string& name, const sf::Transform& transform);
|
||||
void setParameter(const std::string& name, const sf::Transform& transform);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change a texture parameter of the shader
|
||||
|
@ -406,7 +406,7 @@ public :
|
|||
/// \code
|
||||
/// sf::Texture texture;
|
||||
/// ...
|
||||
/// shader.SetParameter("the_texture", texture);
|
||||
/// shader.setParameter("the_texture", texture);
|
||||
/// \endcode
|
||||
/// It is important to note that \a texture must remain alive as long
|
||||
/// as the shader uses it, no copy is made internally.
|
||||
|
@ -415,14 +415,14 @@ public :
|
|||
/// known in advance, you can pass the special value
|
||||
/// sf::Shader::CurrentTexture:
|
||||
/// \code
|
||||
/// shader.SetParameter("the_texture", sf::Shader::CurrentTexture).
|
||||
/// shader.setParameter("the_texture", sf::Shader::CurrentTexture).
|
||||
/// \endcode
|
||||
///
|
||||
/// \param name Name of the texture in the shader
|
||||
/// \param texture Texture to assign
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetParameter(const std::string& name, const Texture& texture);
|
||||
void setParameter(const std::string& name, const Texture& texture);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Change a texture parameter of the shader
|
||||
|
@ -439,13 +439,13 @@ public :
|
|||
/// uniform sampler2D current; // this is the variable in the shader
|
||||
/// \endcode
|
||||
/// \code
|
||||
/// shader.SetParameter("current", sf::Shader::CurrentTexture);
|
||||
/// shader.setParameter("current", sf::Shader::CurrentTexture);
|
||||
/// \endcode
|
||||
///
|
||||
/// \param name Name of the texture in the shader
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetParameter(const std::string& name, CurrentTextureType);
|
||||
void setParameter(const std::string& name, CurrentTextureType);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Bind the shader for rendering (activate it)
|
||||
|
@ -454,16 +454,16 @@ public :
|
|||
/// you want to use the shader with a custom OpenGL rendering
|
||||
/// instead of a SFML drawable.
|
||||
/// \code
|
||||
/// window.SetActive();
|
||||
/// shader.Bind();
|
||||
/// window.setActive();
|
||||
/// shader.bind();
|
||||
/// ... render OpenGL geometry ...
|
||||
/// shader.Unbind();
|
||||
/// shader.unbind();
|
||||
/// \endcode
|
||||
///
|
||||
/// \see Unbind
|
||||
/// \see unbind
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Bind() const;
|
||||
void bind() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Unbind the shader (deactivate it)
|
||||
|
@ -472,10 +472,10 @@ public :
|
|||
/// you want to use the shader with a custom OpenGL rendering
|
||||
/// instead of a SFML drawable.
|
||||
///
|
||||
/// \see Bind
|
||||
/// \see bind
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Unbind() const;
|
||||
void unbind() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether or not the system supports shaders
|
||||
|
@ -487,7 +487,7 @@ public :
|
|||
/// \return True if shaders are supported, false otherwise
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static bool IsAvailable();
|
||||
static bool isAvailable();
|
||||
|
||||
private :
|
||||
|
||||
|
@ -503,7 +503,7 @@ private :
|
|||
/// \return True on success, false if any error happened
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool Compile(const char* vertexShaderCode, const char* fragmentShaderCode);
|
||||
bool compile(const char* vertexShaderCode, const char* fragmentShaderCode);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Bind all the textures used by the shader
|
||||
|
@ -512,7 +512,7 @@ private :
|
|||
/// updates the corresponding variables in the shader accordingly.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void BindTextures() const;
|
||||
void bindTextures() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Types
|
||||
|
@ -563,13 +563,13 @@ private :
|
|||
/// \li transforms (matrices)
|
||||
///
|
||||
/// The value of the variables can be changed at any time
|
||||
/// with either the various overloads of the SetParameter function:
|
||||
/// with either the various overloads of the setParameter function:
|
||||
/// \code
|
||||
/// shader.SetParameter("offset", 2.f);
|
||||
/// shader.SetParameter("color", 0.5f, 0.8f, 0.3f);
|
||||
/// shader.SetParameter("matrix", transform); // transform is a sf::Transform
|
||||
/// shader.SetParameter("overlay", texture); // texture is a sf::Texture
|
||||
/// shader.SetParameter("texture", sf::Shader::CurrentTexture);
|
||||
/// shader.setParameter("offset", 2.f);
|
||||
/// shader.setParameter("color", 0.5f, 0.8f, 0.3f);
|
||||
/// shader.setParameter("matrix", transform); // transform is a sf::Transform
|
||||
/// shader.setParameter("overlay", texture); // texture is a sf::Texture
|
||||
/// shader.setParameter("texture", sf::Shader::CurrentTexture);
|
||||
/// \endcode
|
||||
///
|
||||
/// The special Shader::CurrentTexture argument maps the
|
||||
|
@ -579,14 +579,14 @@ private :
|
|||
/// To apply a shader to a drawable, you must pass it as an
|
||||
/// additional parameter to the Draw function:
|
||||
/// \code
|
||||
/// window.Draw(sprite, shader);
|
||||
/// window.draw(sprite, shader);
|
||||
/// \endcode
|
||||
///
|
||||
/// ... which is in fact just a shortcut for this:
|
||||
/// \code
|
||||
/// sf::RenderStates states;
|
||||
/// states.Shader = shader;
|
||||
/// window.Draw(sprite, states);
|
||||
/// states.shader = shader;
|
||||
/// window.draw(sprite, states);
|
||||
/// \endcode
|
||||
///
|
||||
/// Shaders can be used on any drawable, but some combinations are
|
||||
|
@ -605,7 +605,7 @@ private :
|
|||
/// \li draw everything to a sf::RenderTexture, then draw it to
|
||||
/// the main target using the shader
|
||||
/// \li draw everything directly to the main target, then use
|
||||
/// sf::Texture::Update(Window&) to copy its contents to a texture
|
||||
/// sf::Texture::update(Window&) to copy its contents to a texture
|
||||
/// and draw it to the main target using the shader
|
||||
///
|
||||
/// The first technique is more optimized because it doesn't involve
|
||||
|
@ -617,10 +617,10 @@ private :
|
|||
/// sf::Shader can also be used directly as a raw shader for
|
||||
/// custom OpenGL geometry.
|
||||
/// \code
|
||||
/// window.SetActive();
|
||||
/// shader.Bind();
|
||||
/// window.setActive();
|
||||
/// shader.bind();
|
||||
/// ... render OpenGL geometry ...
|
||||
/// shader.Unbind();
|
||||
/// shader.unbind();
|
||||
/// \endcode
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -68,10 +68,10 @@ public :
|
|||
/// \param texture New texture
|
||||
/// \param resetRect Should the texture rect be reset to the size of the new texture?
|
||||
///
|
||||
/// \see GetTexture, SetTextureRect
|
||||
/// \see getTexture, setTextureRect
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetTexture(const Texture* texture, bool resetRect = false);
|
||||
void setTexture(const Texture* texture, bool resetRect = false);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the sub-rectangle of the texture that the shape will display
|
||||
|
@ -82,10 +82,10 @@ public :
|
|||
///
|
||||
/// \param rect Rectangle defining the region of the texture to display
|
||||
///
|
||||
/// \see GetTextureRect, SetTexture
|
||||
/// \see getTextureRect, setTexture
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetTextureRect(const IntRect& rect);
|
||||
void setTextureRect(const IntRect& rect);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the fill color of the shape
|
||||
|
@ -99,10 +99,10 @@ public :
|
|||
///
|
||||
/// \param color New color of the shape
|
||||
///
|
||||
/// \see GetFillColor, SetOutlineColor
|
||||
/// \see getFillColor, setOutlineColor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetFillColor(const Color& color);
|
||||
void setFillColor(const Color& color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the outline color of the shape
|
||||
|
@ -112,10 +112,10 @@ public :
|
|||
///
|
||||
/// \param color New outline color of the shape
|
||||
///
|
||||
/// \see GetOutlineColor, SetFillColor
|
||||
/// \see getOutlineColor, setFillColor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetOutlineColor(const Color& color);
|
||||
void setOutlineColor(const Color& color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the thickness of the shape's outline
|
||||
|
@ -126,10 +126,10 @@ public :
|
|||
///
|
||||
/// \param thickness New outline thickness
|
||||
///
|
||||
/// \see GetOutlineThickness
|
||||
/// \see getOutlineThickness
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetOutlineThickness(float thickness);
|
||||
void setOutlineThickness(float thickness);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the source texture of the shape
|
||||
|
@ -140,58 +140,60 @@ public :
|
|||
///
|
||||
/// \return Pointer to the shape's texture
|
||||
///
|
||||
/// \see SetTexture
|
||||
/// \see setTexture
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Texture* GetTexture() const;
|
||||
const Texture* getTexture() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the sub-rectangle of the texture displayed by the shape
|
||||
///
|
||||
/// \return Texture rectangle of the shape
|
||||
///
|
||||
/// \see SetTextureRect
|
||||
/// \see setTextureRect
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const IntRect& GetTextureRect() const;
|
||||
const IntRect& getTextureRect() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the fill color of the shape
|
||||
///
|
||||
/// \return Fill color of the shape
|
||||
///
|
||||
/// \see SetFillColor
|
||||
/// \see setFillColor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Color& GetFillColor() const;
|
||||
const Color& getFillColor() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the outline color of the shape
|
||||
///
|
||||
/// \return Outline color of the shape
|
||||
///
|
||||
/// \see SetOutlineColor
|
||||
/// \see setOutlineColor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Color& GetOutlineColor() const;
|
||||
const Color& getOutlineColor() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the outline thickness of the shape
|
||||
///
|
||||
/// \return Outline thickness of the shape
|
||||
///
|
||||
/// \see SetOutlineThickness
|
||||
/// \see setOutlineThickness
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
float GetOutlineThickness() const;
|
||||
float getOutlineThickness() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the total number of points of the shape
|
||||
///
|
||||
/// \return Number of points of the shape
|
||||
///
|
||||
/// \see getPoint
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual unsigned int GetPointCount() const = 0;
|
||||
virtual unsigned int getPointCount() const = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get a point of the shape
|
||||
|
@ -202,8 +204,10 @@ public :
|
|||
///
|
||||
/// \return Index-th point of the shape
|
||||
///
|
||||
/// \see getPointCount
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual Vector2f GetPoint(unsigned int index) const = 0;
|
||||
virtual Vector2f getPoint(unsigned int index) const = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the local bounding rectangle of the entity
|
||||
|
@ -217,7 +221,7 @@ public :
|
|||
/// \return Local bounding rectangle of the entity
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
FloatRect GetLocalBounds() const;
|
||||
FloatRect getLocalBounds() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the global bounding rectangle of the entity
|
||||
|
@ -231,7 +235,7 @@ public :
|
|||
/// \return Global bounding rectangle of the entity
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
FloatRect GetGlobalBounds() const;
|
||||
FloatRect getGlobalBounds() const;
|
||||
|
||||
protected :
|
||||
|
||||
|
@ -246,10 +250,10 @@ protected :
|
|||
///
|
||||
/// This function must be called by the derived class everytime
|
||||
/// the shape's points change (ie. the result of either
|
||||
/// GetPointCount or GetPoint is different).
|
||||
/// getPointCount or getPoint is different).
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Update();
|
||||
void update();
|
||||
|
||||
private :
|
||||
|
||||
|
@ -260,31 +264,31 @@ private :
|
|||
/// \param states Current render states
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void Draw(RenderTarget& target, RenderStates states) const;
|
||||
virtual void draw(RenderTarget& target, RenderStates states) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Update the fill vertices' color
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void UpdateFillColors();
|
||||
void updateFillColors();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Update the fill vertices' texture coordinates
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void UpdateTexCoords();
|
||||
void updateTexCoords();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Update the outline vertices' position
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void UpdateOutline();
|
||||
void updateOutline();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Update the outline vertices' color
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void UpdateOutlineColors();
|
||||
void updateOutlineColors();
|
||||
|
||||
private :
|
||||
|
||||
|
@ -333,8 +337,8 @@ private :
|
|||
///
|
||||
/// You can write your own derived shape class, there are only
|
||||
/// two virtual functions to override:
|
||||
/// \li GetOutlinePointCount must return the number of points of the shape
|
||||
/// \li GetOutlinePoint must return the points of the shape
|
||||
/// \li getPointCount must return the number of points of the shape
|
||||
/// \li getPoint must return the points of the shape
|
||||
///
|
||||
/// \see sf::RectangleShape, sf::CircleShape, sf::ConvexShape, sf::Transformable
|
||||
///
|
||||
|
|
|
@ -61,7 +61,7 @@ public :
|
|||
///
|
||||
/// \param texture Source texture
|
||||
///
|
||||
/// \see SetTexture
|
||||
/// \see setTexture
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
explicit Sprite(const Texture& texture);
|
||||
|
@ -72,7 +72,7 @@ public :
|
|||
/// \param texture Source texture
|
||||
/// \param rectangle Sub-rectangle of the texture to assign to the sprite
|
||||
///
|
||||
/// \see SetTexture, SetTextureRect
|
||||
/// \see setTexture, setTextureRect
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Sprite(const Texture& texture, const IntRect& rectangle);
|
||||
|
@ -93,10 +93,10 @@ public :
|
|||
/// \param texture New texture
|
||||
/// \param resetRect Should the texture rect be reset to the size of the new texture?
|
||||
///
|
||||
/// \see GetTexture, SetTextureRect
|
||||
/// \see getTexture, setTextureRect
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetTexture(const Texture& texture, bool resetRect = false);
|
||||
void setTexture(const Texture& texture, bool resetRect = false);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the sub-rectangle of the texture that the sprite will display
|
||||
|
@ -107,10 +107,10 @@ public :
|
|||
///
|
||||
/// \param rectangle Rectangle defining the region of the texture to display
|
||||
///
|
||||
/// \see GetTextureRect, SetTexture
|
||||
/// \see getTextureRect, setTexture
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetTextureRect(const IntRect& rectangle);
|
||||
void setTextureRect(const IntRect& rectangle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the global color of the sprite
|
||||
|
@ -122,10 +122,10 @@ public :
|
|||
///
|
||||
/// \param color New color of the sprite
|
||||
///
|
||||
/// \see GetColor
|
||||
/// \see getColor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetColor(const Color& color);
|
||||
void setColor(const Color& color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the source texture of the sprite
|
||||
|
@ -136,30 +136,30 @@ public :
|
|||
///
|
||||
/// \return Pointer to the sprite's texture
|
||||
///
|
||||
/// \see SetTexture
|
||||
/// \see setTexture
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Texture* GetTexture() const;
|
||||
const Texture* getTexture() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the sub-rectangle of the texture displayed by the sprite
|
||||
///
|
||||
/// \return Texture rectangle of the sprite
|
||||
///
|
||||
/// \see SetTextureRect
|
||||
/// \see setTextureRect
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const IntRect& GetTextureRect() const;
|
||||
const IntRect& getTextureRect() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the global color of the sprite
|
||||
///
|
||||
/// \return Global color of the sprite
|
||||
///
|
||||
/// \see SetColor
|
||||
/// \see setColor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Color& GetColor() const;
|
||||
const Color& getColor() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the local bounding rectangle of the entity
|
||||
|
@ -173,7 +173,7 @@ public :
|
|||
/// \return Local bounding rectangle of the entity
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
FloatRect GetLocalBounds() const;
|
||||
FloatRect getLocalBounds() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the global bounding rectangle of the entity
|
||||
|
@ -187,7 +187,7 @@ public :
|
|||
/// \return Global bounding rectangle of the entity
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
FloatRect GetGlobalBounds() const;
|
||||
FloatRect getGlobalBounds() const;
|
||||
|
||||
private :
|
||||
|
||||
|
@ -198,19 +198,19 @@ private :
|
|||
/// \param states Current render states
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void Draw(RenderTarget& target, RenderStates states) const;
|
||||
virtual void draw(RenderTarget& target, RenderStates states) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Update the vertices' positions
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void UpdatePositions();
|
||||
void updatePositions();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Update the vertices' texture coordinates
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void UpdateTexCoords();
|
||||
void updateTexCoords();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
|
@ -259,17 +259,17 @@ private :
|
|||
/// \code
|
||||
/// // Declare and load a texture
|
||||
/// sf::Texture texture;
|
||||
/// texture.LoadFromFile("texture.png");
|
||||
/// texture.loadFromFile("texture.png");
|
||||
///
|
||||
/// // Create a sprite
|
||||
/// sf::Sprite sprite;
|
||||
/// sprite.SetTexture(texture);
|
||||
/// sprite.SetTextureRect(sf::IntRect(10, 10, 50, 30));
|
||||
/// sprite.SetColor(sf::Color(255, 255, 255, 200));
|
||||
/// sprite.SetPosition(100, 25);
|
||||
/// sprite.setTexture(texture);
|
||||
/// sprite.setTextureRect(sf::IntRect(10, 10, 50, 30));
|
||||
/// sprite.setColor(sf::Color(255, 255, 255, 200));
|
||||
/// sprite.setPosition(100, 25);
|
||||
///
|
||||
/// // Draw it
|
||||
/// window.Draw(sprite);
|
||||
/// window.draw(sprite);
|
||||
/// \endcode
|
||||
///
|
||||
/// \see sf::Texture, sf::Transformable
|
||||
|
|
|
@ -77,7 +77,7 @@ public :
|
|||
/// \param characterSize Base size of characters, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
explicit Text(const String& string, const Font& font = Font::GetDefaultFont(), unsigned int characterSize = 30);
|
||||
explicit Text(const String& string, const Font& font = Font::getDefaultFont(), unsigned int characterSize = 30);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the text's string
|
||||
|
@ -95,10 +95,10 @@ public :
|
|||
///
|
||||
/// \param string New string
|
||||
///
|
||||
/// \see GetString
|
||||
/// \see getString
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetString(const String& string);
|
||||
void setString(const String& string);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the text's font
|
||||
|
@ -110,14 +110,14 @@ public :
|
|||
/// If the font is destroyed and the text tries to
|
||||
/// use it, the behaviour is undefined.
|
||||
/// Texts have a valid font by default, which the built-in
|
||||
/// Font::GetDefaultFont().
|
||||
/// Font::getDefaultFont().
|
||||
///
|
||||
/// \param font New font
|
||||
///
|
||||
/// \see GetFont
|
||||
/// \see getFont
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetFont(const Font& font);
|
||||
void setFont(const Font& font);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the character size
|
||||
|
@ -126,10 +126,10 @@ public :
|
|||
///
|
||||
/// \param size New character size, in pixels
|
||||
///
|
||||
/// \see GetCharacterSize
|
||||
/// \see getCharacterSize
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetCharacterSize(unsigned int size);
|
||||
void setCharacterSize(unsigned int size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the text's style
|
||||
|
@ -140,10 +140,10 @@ public :
|
|||
///
|
||||
/// \param style New style
|
||||
///
|
||||
/// \see GetStyle
|
||||
/// \see getStyle
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetStyle(Uint32 style);
|
||||
void setStyle(Uint32 style);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the global color of the text
|
||||
|
@ -152,10 +152,10 @@ public :
|
|||
///
|
||||
/// \param color New color of the text
|
||||
///
|
||||
/// \see GetColor
|
||||
/// \see getColor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetColor(const Color& color);
|
||||
void setColor(const Color& color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the text's string
|
||||
|
@ -164,17 +164,17 @@ public :
|
|||
/// be converted to standard string types. So, the following
|
||||
/// lines of code are all valid:
|
||||
/// \code
|
||||
/// sf::String s1 = text.GetString();
|
||||
/// std::string s2 = text.GetString();
|
||||
/// std::wstring s3 = text.GetString();
|
||||
/// sf::String s1 = text.getString();
|
||||
/// std::string s2 = text.getString();
|
||||
/// std::wstring s3 = text.getString();
|
||||
/// \endcode
|
||||
///
|
||||
/// \return Text's string
|
||||
///
|
||||
/// \see GetString
|
||||
/// \see setString
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const String& GetString() const;
|
||||
const String& getString() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the text's font
|
||||
|
@ -184,40 +184,40 @@ public :
|
|||
///
|
||||
/// \return Text's font
|
||||
///
|
||||
/// \see SetFont
|
||||
/// \see setFont
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Font& GetFont() const;
|
||||
const Font& getFont() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the character size
|
||||
///
|
||||
/// \return Size of the characters, in pixels
|
||||
///
|
||||
/// \see SetCharacterSize
|
||||
/// \see setCharacterSize
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int GetCharacterSize() const;
|
||||
unsigned int getCharacterSize() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the text's style
|
||||
///
|
||||
/// \return Text's style
|
||||
///
|
||||
/// \see SetStyle
|
||||
/// \see setStyle
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Uint32 GetStyle() const;
|
||||
Uint32 getStyle() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the global color of the text
|
||||
///
|
||||
/// \return Global color of the text
|
||||
///
|
||||
/// \see SetColor
|
||||
/// \see setColor
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Color& GetColor() const;
|
||||
const Color& getColor() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the position of the \a index-th character
|
||||
|
@ -234,7 +234,7 @@ public :
|
|||
/// \return Position of the character
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Vector2f FindCharacterPos(std::size_t index) const;
|
||||
Vector2f findCharacterPos(std::size_t index) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the local bounding rectangle of the entity
|
||||
|
@ -248,7 +248,7 @@ public :
|
|||
/// \return Local bounding rectangle of the entity
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
FloatRect GetLocalBounds() const;
|
||||
FloatRect getLocalBounds() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the global bounding rectangle of the entity
|
||||
|
@ -262,7 +262,7 @@ public :
|
|||
/// \return Global bounding rectangle of the entity
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
FloatRect GetGlobalBounds() const;
|
||||
FloatRect getGlobalBounds() const;
|
||||
|
||||
private :
|
||||
|
||||
|
@ -273,13 +273,13 @@ private :
|
|||
/// \param states Current render states
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void Draw(RenderTarget& target, RenderStates states) const;
|
||||
virtual void draw(RenderTarget& target, RenderStates states) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Update the text's geometry
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void UpdateGeometry();
|
||||
void updateGeometry();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
|
@ -335,17 +335,17 @@ private :
|
|||
/// \code
|
||||
/// // Declare and load a font
|
||||
/// sf::Font font;
|
||||
/// font.LoadFromFile("arial.ttf");
|
||||
/// font.loadFromFile("arial.ttf");
|
||||
///
|
||||
/// // Create a text
|
||||
/// sf::Text text("hello");
|
||||
/// text.SetFont(font);
|
||||
/// text.SetCharacterSize(30);
|
||||
/// text.SetStyle(sf::Text::Bold);
|
||||
/// text.SetColor(sf::Color::Red);
|
||||
/// text.setFont(font);
|
||||
/// text.setCharacterSize(30);
|
||||
/// text.setStyle(sf::Text::Bold);
|
||||
/// text.setColor(sf::Color::Red);
|
||||
///
|
||||
/// // Draw it
|
||||
/// window.Draw(text);
|
||||
/// window.draw(text);
|
||||
/// \endcode
|
||||
///
|
||||
/// Note that you don't need to load a font to draw text,
|
||||
|
|
|
@ -93,7 +93,7 @@ public :
|
|||
/// \return True if creation was successful
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool Create(unsigned int width, unsigned int height);
|
||||
bool create(unsigned int width, unsigned int height);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Load the texture from a file on disk
|
||||
|
@ -101,8 +101,8 @@ public :
|
|||
/// This function is a shortcut for the following code:
|
||||
/// \code
|
||||
/// sf::Image image;
|
||||
/// image.LoadFromFile(filename);
|
||||
/// texture.LoadFromImage(image, area);
|
||||
/// image.loadFromFile(filename);
|
||||
/// texture.loadFromImage(image, area);
|
||||
/// \endcode
|
||||
///
|
||||
/// The \a area argument can be used to load only a sub-rectangle
|
||||
|
@ -112,7 +112,7 @@ public :
|
|||
/// is adjusted to fit the image size.
|
||||
///
|
||||
/// The maximum size for a texture depends on the graphics
|
||||
/// driver and can be retrieved with the GetMaximumSize function.
|
||||
/// driver and can be retrieved with the getMaximumSize function.
|
||||
///
|
||||
/// If this function fails, the texture is left unchanged.
|
||||
///
|
||||
|
@ -121,10 +121,10 @@ public :
|
|||
///
|
||||
/// \return True if loading was successful
|
||||
///
|
||||
/// \see LoadFromMemory, LoadFromStream, LoadFromImage
|
||||
/// \see loadFromMemory, loadFromStream, loadFromImage
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromFile(const std::string& filename, const IntRect& area = IntRect());
|
||||
bool loadFromFile(const std::string& filename, const IntRect& area = IntRect());
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Load the texture from a file in memory
|
||||
|
@ -132,8 +132,8 @@ public :
|
|||
/// This function is a shortcut for the following code:
|
||||
/// \code
|
||||
/// sf::Image image;
|
||||
/// image.LoadFromMemory(data, size);
|
||||
/// texture.LoadFromImage(image, area);
|
||||
/// image.loadFromMemory(data, size);
|
||||
/// texture.loadFromImage(image, area);
|
||||
/// \endcode
|
||||
///
|
||||
/// The \a area argument can be used to load only a sub-rectangle
|
||||
|
@ -143,7 +143,7 @@ public :
|
|||
/// is adjusted to fit the image size.
|
||||
///
|
||||
/// The maximum size for a texture depends on the graphics
|
||||
/// driver and can be retrieved with the GetMaximumSize function.
|
||||
/// driver and can be retrieved with the getMaximumSize function.
|
||||
///
|
||||
/// If this function fails, the texture is left unchanged.
|
||||
///
|
||||
|
@ -153,10 +153,10 @@ public :
|
|||
///
|
||||
/// \return True if loading was successful
|
||||
///
|
||||
/// \see LoadFromFile, LoadFromStream, LoadFromImage
|
||||
/// \see loadFromFile, loadFromStream, loadFromImage
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromMemory(const void* data, std::size_t size, const IntRect& area = IntRect());
|
||||
bool loadFromMemory(const void* data, std::size_t size, const IntRect& area = IntRect());
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Load the texture from a file in memory
|
||||
|
@ -164,8 +164,8 @@ public :
|
|||
/// This function is a shortcut for the following code:
|
||||
/// \code
|
||||
/// sf::Image image;
|
||||
/// image.LoadFromStream(stream);
|
||||
/// texture.LoadFromImage(image, area);
|
||||
/// image.loadFromStream(stream);
|
||||
/// texture.loadFromImage(image, area);
|
||||
/// \endcode
|
||||
///
|
||||
/// The \a area argument can be used to load only a sub-rectangle
|
||||
|
@ -175,7 +175,7 @@ public :
|
|||
/// is adjusted to fit the image size.
|
||||
///
|
||||
/// The maximum size for a texture depends on the graphics
|
||||
/// driver and can be retrieved with the GetMaximumSize function.
|
||||
/// driver and can be retrieved with the getMaximumSize function.
|
||||
///
|
||||
/// If this function fails, the texture is left unchanged.
|
||||
///
|
||||
|
@ -184,10 +184,10 @@ public :
|
|||
///
|
||||
/// \return True if loading was successful
|
||||
///
|
||||
/// \see LoadFromFile, LoadFromMemory, LoadFromImage
|
||||
/// \see loadFromFile, loadFromMemory, loadFromImage
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromStream(sf::InputStream& stream, const IntRect& area = IntRect());
|
||||
bool loadFromStream(sf::InputStream& stream, const IntRect& area = IntRect());
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Load the texture from an image
|
||||
|
@ -199,7 +199,7 @@ public :
|
|||
/// is adjusted to fit the image size.
|
||||
///
|
||||
/// The maximum size for a texture depends on the graphics
|
||||
/// driver and can be retrieved with the GetMaximumSize function.
|
||||
/// driver and can be retrieved with the getMaximumSize function.
|
||||
///
|
||||
/// If this function fails, the texture is left unchanged.
|
||||
///
|
||||
|
@ -208,30 +208,30 @@ public :
|
|||
///
|
||||
/// \return True if loading was successful
|
||||
///
|
||||
/// \see LoadFromFile, LoadFromMemory
|
||||
/// \see loadFromFile, loadFromMemory
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool LoadFromImage(const Image& image, const IntRect& area = IntRect());
|
||||
bool loadFromImage(const Image& image, const IntRect& area = IntRect());
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the width of the texture
|
||||
///
|
||||
/// \return Width in pixels
|
||||
///
|
||||
/// \see GetHeight
|
||||
/// \see getHeight
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int GetWidth() const;
|
||||
unsigned int getWidth() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the height of the texture
|
||||
///
|
||||
/// \return Height in pixels
|
||||
///
|
||||
/// \see GetWidth
|
||||
/// \see getWidth
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int GetHeight() const;
|
||||
unsigned int getHeight() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Copy the texture pixels to an image
|
||||
|
@ -243,10 +243,10 @@ public :
|
|||
///
|
||||
/// \return Image containing the texture's pixels
|
||||
///
|
||||
/// \see LoadFromImage
|
||||
/// \see loadFromImage
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Image CopyToImage() const;
|
||||
Image copyToImage() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Update the whole texture from an array of pixels
|
||||
|
@ -264,7 +264,7 @@ public :
|
|||
/// \param pixels Array of pixels to copy to the texture
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Update(const Uint8* pixels);
|
||||
void update(const Uint8* pixels);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Update a part of the texture from an array of pixels
|
||||
|
@ -286,7 +286,7 @@ public :
|
|||
/// \param y Y offset in the texture where to copy the source pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Update(const Uint8* pixels, unsigned int width, unsigned int height, unsigned int x, unsigned int y);
|
||||
void update(const Uint8* pixels, unsigned int width, unsigned int height, unsigned int x, unsigned int y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Update the texture from an image
|
||||
|
@ -306,7 +306,7 @@ public :
|
|||
/// \param image Image to copy to the texture
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Update(const Image& image);
|
||||
void update(const Image& image);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Update a part of the texture from an image
|
||||
|
@ -323,7 +323,7 @@ public :
|
|||
/// \param y Y offset in the texture where to copy the source image
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Update(const Image& image, unsigned int x, unsigned int y);
|
||||
void update(const Image& image, unsigned int x, unsigned int y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Update the texture from the contents of a window
|
||||
|
@ -343,7 +343,7 @@ public :
|
|||
/// \param window Window to copy to the texture
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Update(const Window& window);
|
||||
void update(const Window& window);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Update a part of the texture from the contents of a window
|
||||
|
@ -360,7 +360,7 @@ public :
|
|||
/// \param y Y offset in the texture where to copy the source window
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Update(const Window& window, unsigned int x, unsigned int y);
|
||||
void update(const Window& window, unsigned int x, unsigned int y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Activate the texture for rendering
|
||||
|
@ -382,7 +382,7 @@ public :
|
|||
/// \param coordinateType Type of texture coordinates to use
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Bind(CoordinateType coordinateType = Normalized) const;
|
||||
void bind(CoordinateType coordinateType = Normalized) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enable or disable the smooth filter
|
||||
|
@ -395,20 +395,20 @@ public :
|
|||
///
|
||||
/// \param smooth True to enable smoothing, false to disable it
|
||||
///
|
||||
/// \see IsSmooth
|
||||
/// \see isSmooth
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetSmooth(bool smooth);
|
||||
void setSmooth(bool smooth);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether the smooth filter is enabled or not
|
||||
///
|
||||
/// \return True if smoothing is enabled, false if it is disabled
|
||||
///
|
||||
/// \see SetSmooth
|
||||
/// \see setSmooth
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool IsSmooth() const;
|
||||
bool isSmooth() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Enable or disable repeating
|
||||
|
@ -429,20 +429,20 @@ public :
|
|||
///
|
||||
/// \param repeated True to repeat the texture, false to disable repeating
|
||||
///
|
||||
/// \see IsRepeated
|
||||
/// \see isRepeated
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetRepeated(bool repeated);
|
||||
void setRepeated(bool repeated);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Tell whether the texture is repeated or not
|
||||
///
|
||||
/// \return True if repeat mode is enabled, false if it is disabled
|
||||
///
|
||||
/// \see SetRepeated
|
||||
/// \see setRepeated
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
bool IsRepeated() const;
|
||||
bool isRepeated() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Overload of assignment operator
|
||||
|
@ -464,7 +464,7 @@ public :
|
|||
/// \return Maximum size allowed for textures, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static unsigned int GetMaximumSize();
|
||||
static unsigned int getMaximumSize();
|
||||
|
||||
private :
|
||||
|
||||
|
@ -484,7 +484,7 @@ private :
|
|||
/// \return Valid nearest size (greater than or equal to specified size)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static unsigned int GetValidSize(unsigned int size);
|
||||
static unsigned int getValidSize(unsigned int size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
|
@ -518,7 +518,7 @@ private :
|
|||
/// Being stored in the graphics card memory has some drawbacks.
|
||||
/// A texture cannot be manipulated as freely as a sf::Image,
|
||||
/// you need to prepare the pixels first and then upload them
|
||||
/// to the texture in a single operation (see Texture::Update).
|
||||
/// to the texture in a single operation (see Texture::update).
|
||||
///
|
||||
/// sf::Texture makes it easy to convert from/to sf::Image, but
|
||||
/// keep in mind that these calls require transfers between
|
||||
|
@ -531,7 +531,7 @@ private :
|
|||
/// However, if you want to perform some modifications on the pixels
|
||||
/// before creating the final texture, you can load your file to a
|
||||
/// sf::Image, do whatever you need with the pixels, and then call
|
||||
/// Texture::LoadFromImage.
|
||||
/// Texture::loadFromImage.
|
||||
///
|
||||
/// Since they live in the graphics card memory, the pixels of a texture
|
||||
/// cannot be accessed without a slow copy first. And they cannot be
|
||||
|
@ -552,15 +552,15 @@ private :
|
|||
///
|
||||
/// // Load a texture from a file
|
||||
/// sf::Texture texture;
|
||||
/// if (!texture.LoadFromFile("texture.png"))
|
||||
/// if (!texture.loadFromFile("texture.png"))
|
||||
/// return -1;
|
||||
///
|
||||
/// // Assign it to a sprite
|
||||
/// sf::Sprite sprite;
|
||||
/// sprite.SetTexture(texture);
|
||||
/// sprite.setTexture(texture);
|
||||
///
|
||||
/// // Draw the textured sprite
|
||||
/// window.Draw(sprite);
|
||||
/// window.draw(sprite);
|
||||
/// \endcode
|
||||
///
|
||||
/// \code
|
||||
|
@ -569,7 +569,7 @@ private :
|
|||
///
|
||||
/// // Create an empty texture
|
||||
/// sf::Texture texture;
|
||||
/// if (!texture.Create(640, 480))
|
||||
/// if (!texture.create(640, 480))
|
||||
/// return -1;
|
||||
///
|
||||
/// // Create a sprite that will display the texture
|
||||
|
@ -581,10 +581,10 @@ private :
|
|||
///
|
||||
/// // update the texture
|
||||
/// sf::Uint8* pixels = ...; // get a fresh chunk of pixels (the next frame of a movie, for example)
|
||||
/// texture.Update(pixels);
|
||||
/// texture.update(pixels);
|
||||
///
|
||||
/// // draw it
|
||||
/// window.Draw(sprite);
|
||||
/// window.draw(sprite);
|
||||
///
|
||||
/// ...
|
||||
/// }
|
||||
|
|
|
@ -78,13 +78,13 @@ public :
|
|||
///
|
||||
/// \code
|
||||
/// sf::Transform transform = ...;
|
||||
/// glLoadMatrixf(transform.GetMatrix());
|
||||
/// glLoadMatrixf(transform.getMatrix());
|
||||
/// \endcode
|
||||
///
|
||||
/// \return Pointer to a 4x4 matrix
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const float* GetMatrix() const;
|
||||
const float* getMatrix() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Return the inverse of the transform
|
||||
|
@ -95,7 +95,7 @@ public :
|
|||
/// \return A new transform which is the inverse of self
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Transform GetInverse() const;
|
||||
Transform getInverse() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Transform a 2D point
|
||||
|
@ -106,7 +106,7 @@ public :
|
|||
/// \return Transformed point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Vector2f TransformPoint(float x, float y) const;
|
||||
Vector2f transformPoint(float x, float y) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Transform a 2D point
|
||||
|
@ -116,7 +116,7 @@ public :
|
|||
/// \return Transformed point
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Vector2f TransformPoint(const Vector2f& point) const;
|
||||
Vector2f transformPoint(const Vector2f& point) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Transform a rectangle
|
||||
|
@ -132,7 +132,7 @@ public :
|
|||
/// \return Transformed rectangle
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
FloatRect TransformRect(const FloatRect& rectangle) const;
|
||||
FloatRect transformRect(const FloatRect& rectangle) const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Combine the current transform with another one
|
||||
|
@ -146,7 +146,7 @@ public :
|
|||
/// \return Reference to *this
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Transform& Combine(const Transform& transform);
|
||||
Transform& combine(const Transform& transform);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Combine the current transform with a translation
|
||||
|
@ -155,7 +155,7 @@ public :
|
|||
/// can be chained.
|
||||
/// \code
|
||||
/// sf::Transform transform;
|
||||
/// transform.Translate(100, 200).Rotate(45);
|
||||
/// transform.translate(100, 200).rotate(45);
|
||||
/// \endcode
|
||||
///
|
||||
/// \param x Offset to apply on X axis
|
||||
|
@ -163,10 +163,10 @@ public :
|
|||
///
|
||||
/// \return Reference to *this
|
||||
///
|
||||
/// \see Rotate, Scale
|
||||
/// \see rotate, scale
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Transform& Translate(float x, float y);
|
||||
Transform& translate(float x, float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Combine the current transform with a translation
|
||||
|
@ -175,17 +175,17 @@ public :
|
|||
/// can be chained.
|
||||
/// \code
|
||||
/// sf::Transform transform;
|
||||
/// transform.Translate(sf::Vector2f(100, 200)).Rotate(45);
|
||||
/// transform.translate(sf::Vector2f(100, 200)).rotate(45);
|
||||
/// \endcode
|
||||
///
|
||||
/// \param offset Translation offset to apply
|
||||
///
|
||||
/// \return Reference to *this
|
||||
///
|
||||
/// \see Rotate, Scale
|
||||
/// \see rotate, scale
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Transform& Translate(const Vector2f& offset);
|
||||
Transform& translate(const Vector2f& offset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Combine the current transform with a rotation
|
||||
|
@ -194,17 +194,17 @@ public :
|
|||
/// can be chained.
|
||||
/// \code
|
||||
/// sf::Transform transform;
|
||||
/// transform.Rotate(90).Translate(50, 20);
|
||||
/// transform.rotate(90).translate(50, 20);
|
||||
/// \endcode
|
||||
///
|
||||
/// \param angle Rotation angle, in degrees
|
||||
///
|
||||
/// \return Reference to *this
|
||||
///
|
||||
/// \see Translate, Scale
|
||||
/// \see translate, scale
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Transform& Rotate(float angle);
|
||||
Transform& rotate(float angle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Combine the current transform with a rotation
|
||||
|
@ -212,13 +212,13 @@ public :
|
|||
/// The center of rotation is provided for convenience as a second
|
||||
/// argument, so that you can build rotations around arbitrary points
|
||||
/// more easily (and efficiently) than the usual
|
||||
/// Translate(-center).Rotate(angle).Translate(center).
|
||||
/// translate(-center).rotate(angle).translate(center).
|
||||
///
|
||||
/// This function returns a reference to *this, so that calls
|
||||
/// can be chained.
|
||||
/// \code
|
||||
/// sf::Transform transform;
|
||||
/// transform.Rotate(90, 8, 3).Translate(50, 20);
|
||||
/// transform.rotate(90, 8, 3).translate(50, 20);
|
||||
/// \endcode
|
||||
///
|
||||
/// \param angle Rotation angle, in degrees
|
||||
|
@ -227,10 +227,10 @@ public :
|
|||
///
|
||||
/// \return Reference to *this
|
||||
///
|
||||
/// \see Translate, Scale
|
||||
/// \see translate, scale
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Transform& Rotate(float angle, float centerX, float centerY);
|
||||
Transform& rotate(float angle, float centerX, float centerY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Combine the current transform with a rotation
|
||||
|
@ -238,13 +238,13 @@ public :
|
|||
/// The center of rotation is provided for convenience as a second
|
||||
/// argument, so that you can build rotations around arbitrary points
|
||||
/// more easily (and efficiently) than the usual
|
||||
/// Translate(-center).Rotate(angle).Translate(center).
|
||||
/// translate(-center).rotate(angle).translate(center).
|
||||
///
|
||||
/// This function returns a reference to *this, so that calls
|
||||
/// can be chained.
|
||||
/// \code
|
||||
/// sf::Transform transform;
|
||||
/// transform.Rotate(90, sf::Vector2f(8, 3)).Translate(sf::Vector2f(50, 20));
|
||||
/// transform.rotate(90, sf::Vector2f(8, 3)).translate(sf::Vector2f(50, 20));
|
||||
/// \endcode
|
||||
///
|
||||
/// \param angle Rotation angle, in degrees
|
||||
|
@ -252,10 +252,10 @@ public :
|
|||
///
|
||||
/// \return Reference to *this
|
||||
///
|
||||
/// \see Translate, Scale
|
||||
/// \see translate, scale
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Transform& Rotate(float angle, const Vector2f& center);
|
||||
Transform& rotate(float angle, const Vector2f& center);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Combine the current transform with a scaling
|
||||
|
@ -264,7 +264,7 @@ public :
|
|||
/// can be chained.
|
||||
/// \code
|
||||
/// sf::Transform transform;
|
||||
/// transform.Scale(2, 1).Rotate(45);
|
||||
/// transform.scale(2, 1).rotate(45);
|
||||
/// \endcode
|
||||
///
|
||||
/// \param scaleX Scaling factor on the X axis
|
||||
|
@ -272,10 +272,10 @@ public :
|
|||
///
|
||||
/// \return Reference to *this
|
||||
///
|
||||
/// \see Translate, Rotate
|
||||
/// \see translate, rotate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Transform& Scale(float scaleX, float scaleY);
|
||||
Transform& scale(float scaleX, float scaleY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Combine the current transform with a scaling
|
||||
|
@ -283,13 +283,13 @@ public :
|
|||
/// The center of scaling is provided for convenience as a second
|
||||
/// argument, so that you can build scaling around arbitrary points
|
||||
/// more easily (and efficiently) than the usual
|
||||
/// Translate(-center).Scale(factors).Translate(center).
|
||||
/// translate(-center).scale(factors).translate(center).
|
||||
///
|
||||
/// This function returns a reference to *this, so that calls
|
||||
/// can be chained.
|
||||
/// \code
|
||||
/// sf::Transform transform;
|
||||
/// transform.Scale(2, 1, 8, 3).Rotate(45);
|
||||
/// transform.scale(2, 1, 8, 3).rotate(45);
|
||||
/// \endcode
|
||||
///
|
||||
/// \param scaleX Scaling factor on X axis
|
||||
|
@ -299,10 +299,10 @@ public :
|
|||
///
|
||||
/// \return Reference to *this
|
||||
///
|
||||
/// \see Translate, Rotate
|
||||
/// \see translate, rotate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Transform& Scale(float scaleX, float scaleY, float centerX, float centerY);
|
||||
Transform& scale(float scaleX, float scaleY, float centerX, float centerY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Combine the current transform with a scaling
|
||||
|
@ -311,17 +311,17 @@ public :
|
|||
/// can be chained.
|
||||
/// \code
|
||||
/// sf::Transform transform;
|
||||
/// transform.Scale(sf::Vector2f(2, 1)).Rotate(45);
|
||||
/// transform.scale(sf::Vector2f(2, 1)).rotate(45);
|
||||
/// \endcode
|
||||
///
|
||||
/// \param factors Scaling factors
|
||||
///
|
||||
/// \return Reference to *this
|
||||
///
|
||||
/// \see Translate, Rotate
|
||||
/// \see translate, rotate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Transform& Scale(const Vector2f& factors);
|
||||
Transform& scale(const Vector2f& factors);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Combine the current transform with a scaling
|
||||
|
@ -329,13 +329,13 @@ public :
|
|||
/// The center of scaling is provided for convenience as a second
|
||||
/// argument, so that you can build scaling around arbitrary points
|
||||
/// more easily (and efficiently) than the usual
|
||||
/// Translate(-center).Scale(factors).Translate(center).
|
||||
/// translate(-center).scale(factors).translate(center).
|
||||
///
|
||||
/// This function returns a reference to *this, so that calls
|
||||
/// can be chained.
|
||||
/// \code
|
||||
/// sf::Transform transform;
|
||||
/// transform.Scale(sf::Vector2f(2, 1), sf::Vector2f(8, 3)).Rotate(45);
|
||||
/// transform.scale(sf::Vector2f(2, 1), sf::Vector2f(8, 3)).rotate(45);
|
||||
/// \endcode
|
||||
///
|
||||
/// \param factors Scaling factors
|
||||
|
@ -343,10 +343,10 @@ public :
|
|||
///
|
||||
/// \return Reference to *this
|
||||
///
|
||||
/// \see Translate, Rotate
|
||||
/// \see translate, rotate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Transform& Scale(const Vector2f& factors, const Vector2f& center);
|
||||
Transform& scale(const Vector2f& factors, const Vector2f& center);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Static member data
|
||||
|
@ -365,7 +365,7 @@ private:
|
|||
/// \relates sf::Transform
|
||||
/// \brief Overload of binary operator * to combine two transforms
|
||||
///
|
||||
/// This call is equivalent to calling Transform(left).Combine(right).
|
||||
/// This call is equivalent to calling Transform(left).combine(right).
|
||||
///
|
||||
/// \param left Left operand (the first transform)
|
||||
/// \param right Right operand (the second transform)
|
||||
|
@ -379,7 +379,7 @@ SFML_GRAPHICS_API Transform operator *(const Transform& left, const Transform& r
|
|||
/// \relates sf::Transform
|
||||
/// \brief Overload of binary operator *= to combine two transforms
|
||||
///
|
||||
/// This call is equivalent to calling left.Combine(right).
|
||||
/// This call is equivalent to calling left.combine(right).
|
||||
///
|
||||
/// \param left Left operand (the first transform)
|
||||
/// \param right Right operand (the second transform)
|
||||
|
@ -393,7 +393,7 @@ SFML_GRAPHICS_API Transform& operator *=(Transform& left, const Transform& right
|
|||
/// \relates sf::Transform
|
||||
/// \brief Overload of binary operator * to transform a point
|
||||
///
|
||||
/// This call is equivalent to calling left.TransformPoint(right).
|
||||
/// This call is equivalent to calling left.transformPoint(right).
|
||||
///
|
||||
/// \param left Left operand (the transform)
|
||||
/// \param right Right operand (the point to transform)
|
||||
|
@ -431,18 +431,18 @@ SFML_GRAPHICS_API Vector2f operator *(const Transform& left, const Vector2f& rig
|
|||
/// \code
|
||||
/// // define a translation transform
|
||||
/// sf::Transform translation;
|
||||
/// translation.Translate(20, 50);
|
||||
/// translation.translate(20, 50);
|
||||
///
|
||||
/// // define a rotation transform
|
||||
/// sf::Transform rotation;
|
||||
/// rotation.Rotate(45);
|
||||
/// rotation.rotate(45);
|
||||
///
|
||||
/// // combine them
|
||||
/// sf::Transform transform = translation * rotation;
|
||||
///
|
||||
/// // use the result to transform stuff...
|
||||
/// sf::Vector2f point = transform.TransformPoint(10, 20);
|
||||
/// sf::FloatRect rect = transform.TransformRect(sf::FloatRect(0, 0, 10, 100));
|
||||
/// sf::Vector2f point = transform.transformPoint(10, 20);
|
||||
/// sf::FloatRect rect = transform.transformRect(sf::FloatRect(0, 0, 10, 100));
|
||||
/// \endcode
|
||||
///
|
||||
/// \see sf::Transformable, sf::RenderStates
|
||||
|
|
|
@ -55,7 +55,7 @@ public :
|
|||
virtual ~Transformable();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the position of the object
|
||||
/// \brief set the position of the object
|
||||
///
|
||||
/// This function completely overwrites the previous position.
|
||||
/// See Move to apply an offset based on the previous position instead.
|
||||
|
@ -64,13 +64,13 @@ public :
|
|||
/// \param x X coordinate of the new position
|
||||
/// \param y Y coordinate of the new position
|
||||
///
|
||||
/// \see Move, GetPosition
|
||||
/// \see move, getPosition
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetPosition(float x, float y);
|
||||
void setPosition(float x, float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the position of the object
|
||||
/// \brief set the position of the object
|
||||
///
|
||||
/// This function completely overwrites the previous position.
|
||||
/// See Move to apply an offset based on the previous position instead.
|
||||
|
@ -78,13 +78,13 @@ public :
|
|||
///
|
||||
/// \param position New position
|
||||
///
|
||||
/// \see Move, GetPosition
|
||||
/// \see move, getPosition
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetPosition(const Vector2f& position);
|
||||
void setPosition(const Vector2f& position);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the orientation of the object
|
||||
/// \brief set the orientation of the object
|
||||
///
|
||||
/// This function completely overwrites the previous rotation.
|
||||
/// See Rotate to add an angle based on the previous rotation instead.
|
||||
|
@ -92,13 +92,13 @@ public :
|
|||
///
|
||||
/// \param angle New rotation, in degrees
|
||||
///
|
||||
/// \see Rotate, GetRotation
|
||||
/// \see rotate, getRotation
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetRotation(float angle);
|
||||
void setRotation(float angle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the scale factors of the object
|
||||
/// \brief set the scale factors of the object
|
||||
///
|
||||
/// This function completely overwrites the previous scale.
|
||||
/// See Scale to add a factor based on the previous scale instead.
|
||||
|
@ -107,13 +107,13 @@ public :
|
|||
/// \param factorX New horizontal scale factor
|
||||
/// \param factorY New vertical scale factor
|
||||
///
|
||||
/// \see Scale, GetScale
|
||||
/// \see scale, getScale
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetScale(float factorX, float factorY);
|
||||
void setScale(float factorX, float factorY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the scale factors of the object
|
||||
/// \brief set the scale factors of the object
|
||||
///
|
||||
/// This function completely overwrites the previous scale.
|
||||
/// See Scale to add a factor based on the previous scale instead.
|
||||
|
@ -121,13 +121,13 @@ public :
|
|||
///
|
||||
/// \param factors New scale factors
|
||||
///
|
||||
/// \see Scale, GetScale
|
||||
/// \see scale, getScale
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetScale(const Vector2f& factors);
|
||||
void setScale(const Vector2f& factors);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the local origin of the object
|
||||
/// \brief set the local origin of the object
|
||||
///
|
||||
/// The origin of an object defines the center point for
|
||||
/// all transformations (position, scale, rotation).
|
||||
|
@ -139,13 +139,13 @@ public :
|
|||
/// \param x X coordinate of the new origin
|
||||
/// \param y Y coordinate of the new origin
|
||||
///
|
||||
/// \see GetOrigin
|
||||
/// \see getOrigin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetOrigin(float x, float y);
|
||||
void setOrigin(float x, float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the local origin of the object
|
||||
/// \brief set the local origin of the object
|
||||
///
|
||||
/// The origin of an object defines the center point for
|
||||
/// all transformations (position, scale, rotation).
|
||||
|
@ -156,160 +156,160 @@ public :
|
|||
///
|
||||
/// \param origin New origin
|
||||
///
|
||||
/// \see GetOrigin
|
||||
/// \see getOrigin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetOrigin(const Vector2f& origin);
|
||||
void setOrigin(const Vector2f& origin);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the position of the object
|
||||
/// \brief get the position of the object
|
||||
///
|
||||
/// \return Current position
|
||||
///
|
||||
/// \see SetPosition
|
||||
/// \see setPosition
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Vector2f& GetPosition() const;
|
||||
const Vector2f& getPosition() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the orientation of the object
|
||||
/// \brief get the orientation of the object
|
||||
///
|
||||
/// The rotation is always in the range [0, 360].
|
||||
///
|
||||
/// \return Current rotation, in degrees
|
||||
///
|
||||
/// \see SetRotation
|
||||
/// \see setRotation
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
float GetRotation() const;
|
||||
float getRotation() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current scale of the object
|
||||
/// \brief get the current scale of the object
|
||||
///
|
||||
/// \return Current scale factors
|
||||
///
|
||||
/// \see SetScale
|
||||
/// \see setScale
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Vector2f& GetScale() const;
|
||||
const Vector2f& getScale() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the local origin of the object
|
||||
/// \brief get the local origin of the object
|
||||
///
|
||||
/// \return Current origin
|
||||
///
|
||||
/// \see SetOrigin
|
||||
/// \see setOrigin
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Vector2f& GetOrigin() const;
|
||||
const Vector2f& getOrigin() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Move the object by a given offset
|
||||
///
|
||||
/// This function adds to the current position of the object,
|
||||
/// unlike SetPosition which overwrites it.
|
||||
/// unlike setPosition which overwrites it.
|
||||
/// Thus, it is equivalent to the following code:
|
||||
/// \code
|
||||
/// sf::Vector2f pos = object.GetPosition();
|
||||
/// object.SetPosition(pos.x + offsetX, pos.y + offsetY);
|
||||
/// sf::Vector2f pos = object.getPosition();
|
||||
/// object.setPosition(pos.x + offsetX, pos.y + offsetY);
|
||||
/// \endcode
|
||||
///
|
||||
/// \param offsetX X offset
|
||||
/// \param offsetY Y offset
|
||||
///
|
||||
/// \see SetPosition
|
||||
/// \see setPosition
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Move(float offsetX, float offsetY);
|
||||
void move(float offsetX, float offsetY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Move the object by a given offset
|
||||
///
|
||||
/// This function adds to the current position of the object,
|
||||
/// unlike SetPosition which overwrites it.
|
||||
/// unlike setPosition which overwrites it.
|
||||
/// Thus, it is equivalent to the following code:
|
||||
/// \code
|
||||
/// object.SetPosition(object.GetPosition() + offset);
|
||||
/// object.setPosition(object.getPosition() + offset);
|
||||
/// \endcode
|
||||
///
|
||||
/// \param offset Offset
|
||||
///
|
||||
/// \see SetPosition
|
||||
/// \see setPosition
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Move(const Vector2f& offset);
|
||||
void move(const Vector2f& offset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Rotate the object
|
||||
///
|
||||
/// This function adds to the current rotation of the object,
|
||||
/// unlike SetRotation which overwrites it.
|
||||
/// unlike setRotation which overwrites it.
|
||||
/// Thus, it is equivalent to the following code:
|
||||
/// \code
|
||||
/// object.SetRotation(object.GetRotation() + angle);
|
||||
/// object.setRotation(object.getRotation() + angle);
|
||||
/// \endcode
|
||||
///
|
||||
/// \param angle Angle of rotation, in degrees
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Rotate(float angle);
|
||||
void rotate(float angle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Scale the object
|
||||
///
|
||||
/// This function multiplies the current scale of the object,
|
||||
/// unlike SetScale which overwrites it.
|
||||
/// unlike setScale which overwrites it.
|
||||
/// Thus, it is equivalent to the following code:
|
||||
/// \code
|
||||
/// sf::Vector2f scale = object.GetScale();
|
||||
/// object.SetScale(scale.x * factorX, scale.y * factorY);
|
||||
/// sf::Vector2f scale = object.getScale();
|
||||
/// object.setScale(scale.x * factorX, scale.y * factorY);
|
||||
/// \endcode
|
||||
///
|
||||
/// \param factorX Horizontal scale factor
|
||||
/// \param factorY Vertical scale factor
|
||||
///
|
||||
/// \see SetScale
|
||||
/// \see setScale
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Scale(float factorX, float factorY);
|
||||
void scale(float factorX, float factorY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Scale the object
|
||||
///
|
||||
/// This function multiplies the current scale of the object,
|
||||
/// unlike SetScale which overwrites it.
|
||||
/// unlike setScale which overwrites it.
|
||||
/// Thus, it is equivalent to the following code:
|
||||
/// \code
|
||||
/// sf::Vector2f scale = object.GetScale();
|
||||
/// object.SetScale(scale.x * factor.x, scale.y * factor.y);
|
||||
/// sf::Vector2f scale = object.getScale();
|
||||
/// object.setScale(scale.x * factor.x, scale.y * factor.y);
|
||||
/// \endcode
|
||||
///
|
||||
/// \param factor Scale factors
|
||||
///
|
||||
/// \see SetScale
|
||||
/// \see setScale
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Scale(const Vector2f& factor);
|
||||
void scale(const Vector2f& factor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the combined transform of the object
|
||||
/// \brief get the combined transform of the object
|
||||
///
|
||||
/// \return Transform combining the position/rotation/scale/origin of the object
|
||||
///
|
||||
/// \see GetInverseTransform
|
||||
/// \see getInverseTransform
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Transform& GetTransform() const;
|
||||
const Transform& getTransform() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the inverse of the combined transform of the object
|
||||
/// \brief get the inverse of the combined transform of the object
|
||||
///
|
||||
/// \return Inverse of the combined transformations applied to the object
|
||||
///
|
||||
/// \see GetTransform
|
||||
/// \see getTransform
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Transform& GetInverseTransform() const;
|
||||
const Transform& getInverseTransform() const;
|
||||
|
||||
private :
|
||||
|
||||
|
@ -377,17 +377,17 @@ private :
|
|||
/// \code
|
||||
/// class MyEntity : public sf::Transformable, public sf::Drawable
|
||||
/// {
|
||||
/// virtual void Draw(sf::RenderTarget& target, sf::RenderStates states) const
|
||||
/// virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const
|
||||
/// {
|
||||
/// states.Transform *= GetTransform();
|
||||
/// target.Draw(..., states);
|
||||
/// states.transform *= getTransform();
|
||||
/// target.draw(..., states);
|
||||
/// }
|
||||
/// };
|
||||
///
|
||||
/// MyEntity entity;
|
||||
/// entity.SetPosition(10, 20);
|
||||
/// entity.SetRotation(45);
|
||||
/// window.Draw(entity);
|
||||
/// entity.setPosition(10, 20);
|
||||
/// entity.setRotation(45);
|
||||
/// window.draw(entity);
|
||||
/// \endcode
|
||||
///
|
||||
/// It can also be used as a member, if you don't want to use
|
||||
|
@ -397,18 +397,18 @@ private :
|
|||
/// class MyEntity
|
||||
/// {
|
||||
/// public :
|
||||
/// void setPosition(const MyVector& v)
|
||||
/// void SetPosition(const MyVector& v)
|
||||
/// {
|
||||
/// m_transform.SetPosition(v.x(), v.y());
|
||||
/// myTransform.setPosition(v.x(), v.y());
|
||||
/// }
|
||||
///
|
||||
/// void draw(sf::RenderTarget& target) const
|
||||
/// void Draw(sf::RenderTarget& target) const
|
||||
/// {
|
||||
/// target.Draw(..., m_transform.GetTransform());
|
||||
/// target.draw(..., myTransform.getTransform());
|
||||
/// }
|
||||
///
|
||||
/// private :
|
||||
/// sf::Transformable m_transform;
|
||||
/// sf::Transformable myTransform;
|
||||
/// };
|
||||
/// \endcode
|
||||
///
|
||||
|
|
|
@ -68,7 +68,7 @@ public :
|
|||
/// \param color Vertex color
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Vertex(const Vector2f& position, const sf::Color& color);
|
||||
Vertex(const Vector2f& position, const Color& color);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Construct the vertex from its position and texture coordinates
|
||||
|
@ -89,14 +89,14 @@ public :
|
|||
/// \param texCoords Vertex texture coordinates
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Vertex(const Vector2f& position, const sf::Color& color, const Vector2f& texCoords);
|
||||
Vertex(const Vector2f& position, const Color& color, const Vector2f& texCoords);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
Vector2f Position; ///< 2D position of the vertex
|
||||
sf::Color Color; ///< Color of the vertex
|
||||
Vector2f TexCoords; ///< Coordinates of the texture's pixel to map to the vertex
|
||||
Vector2f position; ///< 2D position of the vertex
|
||||
Color color; ///< Color of the vertex
|
||||
Vector2f texCoords; ///< Coordinates of the texture's pixel to map to the vertex
|
||||
};
|
||||
|
||||
} // namespace sf
|
||||
|
@ -136,7 +136,7 @@ public :
|
|||
/// };
|
||||
///
|
||||
/// // draw it
|
||||
/// window.Draw(vertices, 4, sf::Quads);
|
||||
/// window.draw(vertices, 4, sf::Quads);
|
||||
/// \endcode
|
||||
///
|
||||
/// Note: although texture coordinates are supposed to be an integer
|
||||
|
|
|
@ -69,7 +69,7 @@ public :
|
|||
/// \return Number of vertices in the array
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
unsigned int GetVertexCount() const;
|
||||
unsigned int getVertexCount() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get a read-write access to a vertex by its index
|
||||
|
@ -82,7 +82,7 @@ public :
|
|||
///
|
||||
/// \return Reference to the index-th vertex
|
||||
///
|
||||
/// \see GetVertexCount
|
||||
/// \see getVertexCount
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Vertex& operator [](unsigned int index);
|
||||
|
@ -98,7 +98,7 @@ public :
|
|||
///
|
||||
/// \return Const reference to the index-th vertex
|
||||
///
|
||||
/// \see GetVertexCount
|
||||
/// \see getVertexCount
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Vertex& operator [](unsigned int index) const;
|
||||
|
@ -112,7 +112,7 @@ public :
|
|||
/// reallocating all the memory.
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Clear();
|
||||
void clear();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Resize the vertex array
|
||||
|
@ -126,7 +126,7 @@ public :
|
|||
/// \param vertexCount New size of the array (number of vertices)
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Resize(unsigned int vertexCount);
|
||||
void resize(unsigned int vertexCount);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Add a vertex to the array
|
||||
|
@ -134,7 +134,7 @@ public :
|
|||
/// \param vertex Vertex to add
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Append(const Vertex& vertex);
|
||||
void append(const Vertex& vertex);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the type of primitives to draw
|
||||
|
@ -150,7 +150,7 @@ public :
|
|||
/// \param type Type of primitive
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetPrimitiveType(PrimitiveType type);
|
||||
void setPrimitiveType(PrimitiveType type);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the type of primitives drawn by the vertex array
|
||||
|
@ -158,7 +158,7 @@ public :
|
|||
/// \return Primitive type
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
PrimitiveType GetPrimitiveType() const;
|
||||
PrimitiveType getPrimitiveType() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Compute the bounding rectangle of the vertex array
|
||||
|
@ -169,7 +169,7 @@ public :
|
|||
/// \return Bounding rectangle of the vertex array
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
FloatRect GetBounds() const;
|
||||
FloatRect getBounds() const;
|
||||
|
||||
private :
|
||||
|
||||
|
@ -180,7 +180,7 @@ private :
|
|||
/// \param states Current render states
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
virtual void Draw(RenderTarget& target, RenderStates states) const;
|
||||
virtual void draw(RenderTarget& target, RenderStates states) const;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -210,12 +210,12 @@ private:
|
|||
/// Example:
|
||||
/// \code
|
||||
/// sf::VertexArray lines(sf::LinesStrip, 4);
|
||||
/// lines[0].Position = sf::Vector2f(10, 0);
|
||||
/// lines[1].Position = sf::Vector2f(20, 0);
|
||||
/// lines[2].Position = sf::Vector2f(30, 5);
|
||||
/// lines[3].Position = sf::Vector2f(40, 2);
|
||||
/// lines[0].position = sf::Vector2f(10, 0);
|
||||
/// lines[1].position = sf::Vector2f(20, 0);
|
||||
/// lines[2].position = sf::Vector2f(30, 5);
|
||||
/// lines[3].position = sf::Vector2f(40, 2);
|
||||
///
|
||||
/// window.Draw(lines);
|
||||
/// window.draw(lines);
|
||||
/// \endcode
|
||||
///
|
||||
/// \see sf::Vertex
|
||||
|
|
|
@ -75,20 +75,20 @@ public :
|
|||
/// \param x X coordinate of the new center
|
||||
/// \param y Y coordinate of the new center
|
||||
///
|
||||
/// \see SetSize, GetCenter
|
||||
/// \see setSize, getCenter
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetCenter(float x, float y);
|
||||
void setCenter(float x, float y);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the center of the view
|
||||
///
|
||||
/// \param center New center
|
||||
///
|
||||
/// \see SetSize, GetCenter
|
||||
/// \see setSize, getCenter
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetCenter(const Vector2f& center);
|
||||
void setCenter(const Vector2f& center);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the size of the view
|
||||
|
@ -96,20 +96,20 @@ public :
|
|||
/// \param width New width of the view
|
||||
/// \param height New height of the view
|
||||
///
|
||||
/// \see SetCenter, GetCenter
|
||||
/// \see setCenter, getCenter
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetSize(float width, float height);
|
||||
void setSize(float width, float height);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the size of the view
|
||||
///
|
||||
/// \param size New size
|
||||
///
|
||||
/// \see SetCenter, GetCenter
|
||||
/// \see setCenter, getCenter
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetSize(const Vector2f& size);
|
||||
void setSize(const Vector2f& size);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the orientation of the view
|
||||
|
@ -118,10 +118,10 @@ public :
|
|||
///
|
||||
/// \param angle New angle, in degrees
|
||||
///
|
||||
/// \see GetRotation
|
||||
/// \see getRotation
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetRotation(float angle);
|
||||
void setRotation(float angle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Set the target viewport
|
||||
|
@ -130,15 +130,15 @@ public :
|
|||
/// view are displayed, expressed as a factor (between 0 and 1)
|
||||
/// of the size of the RenderTarget to which the view is applied.
|
||||
/// For example, a view which takes the left side of the target would
|
||||
/// be defined with View.SetViewport(sf::FloatRect(0, 0, 0.5, 1)).
|
||||
/// be defined with View.setViewport(sf::FloatRect(0, 0, 0.5, 1)).
|
||||
/// By default, a view has a viewport which covers the entire target.
|
||||
///
|
||||
/// \param viewport New viewport rectangle
|
||||
///
|
||||
/// \see GetViewport
|
||||
/// \see getViewport
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void SetViewport(const FloatRect& viewport);
|
||||
void setViewport(const FloatRect& viewport);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Reset the view to the given rectangle
|
||||
|
@ -147,50 +147,50 @@ public :
|
|||
///
|
||||
/// \param rectangle Rectangle defining the zone to display
|
||||
///
|
||||
/// \see SetCenter, SetSize, SetRotation
|
||||
/// \see setCenter, setSize, setRotation
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Reset(const FloatRect& rectangle);
|
||||
void reset(const FloatRect& rectangle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the center of the view
|
||||
///
|
||||
/// \return Center of the view
|
||||
///
|
||||
/// \see GetSize, SetCenter
|
||||
/// \see getSize, setCenter
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Vector2f& GetCenter() const;
|
||||
const Vector2f& getCenter() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the size of the view
|
||||
///
|
||||
/// \return Size of the view
|
||||
///
|
||||
/// \see GetCenter, SetSize
|
||||
/// \see getCenter, setSize
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Vector2f& GetSize() const;
|
||||
const Vector2f& getSize() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the current orientation of the view
|
||||
///
|
||||
/// \return Rotation angle of the view, in degrees
|
||||
///
|
||||
/// \see SetRotation
|
||||
/// \see setRotation
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
float GetRotation() const;
|
||||
float getRotation() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the target viewport rectangle of the view
|
||||
///
|
||||
/// \return Viewport rectangle, expressed as a factor of the target size
|
||||
///
|
||||
/// \see SetViewport
|
||||
/// \see setViewport
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const FloatRect& GetViewport() const;
|
||||
const FloatRect& getViewport() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Move the view relatively to its current position
|
||||
|
@ -198,30 +198,30 @@ public :
|
|||
/// \param offsetX X coordinate of the move offset
|
||||
/// \param offsetY Y coordinate of the move offset
|
||||
///
|
||||
/// \see SetCenter, Rotate, Zoom
|
||||
/// \see setCenter, rotate, zoom
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Move(float offsetX, float offsetY);
|
||||
void move(float offsetX, float offsetY);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Move the view relatively to its current position
|
||||
///
|
||||
/// \param offset Move offset
|
||||
///
|
||||
/// \see SetCenter, Rotate, Zoom
|
||||
/// \see setCenter, rotate, zoom
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Move(const Vector2f& offset);
|
||||
void move(const Vector2f& offset);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Rotate the view relatively to its current orientation
|
||||
///
|
||||
/// \param angle Angle to rotate, in degrees
|
||||
///
|
||||
/// \see SetRotation, Move, Zoom
|
||||
/// \see setRotation, move, zoom
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Rotate(float angle);
|
||||
void rotate(float angle);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Resize the view rectangle relatively to its current size
|
||||
|
@ -235,10 +235,10 @@ public :
|
|||
///
|
||||
/// \param factor Zoom factor to apply
|
||||
///
|
||||
/// \see SetSize, Move, Rotate
|
||||
/// \see setSize, move, rotate
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void Zoom(float factor);
|
||||
void zoom(float factor);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the projection transform of the view
|
||||
|
@ -247,10 +247,10 @@ public :
|
|||
///
|
||||
/// \return Projection transform defining the view
|
||||
///
|
||||
/// \see GetInverseTransform
|
||||
/// \see getInverseTransform
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Transform& GetTransform() const;
|
||||
const Transform& getTransform() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the inverse projection transform of the view
|
||||
|
@ -259,10 +259,10 @@ public :
|
|||
///
|
||||
/// \return Inverse of the projection transform defining the view
|
||||
///
|
||||
/// \see GetTransform
|
||||
/// \see getTransform
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
const Transform& GetInverseTransform() const;
|
||||
const Transform& getInverseTransform() const;
|
||||
|
||||
private :
|
||||
|
||||
|
@ -315,25 +315,25 @@ private :
|
|||
/// sf::View view;
|
||||
///
|
||||
/// // Initialize the view to a rectangle located at (100, 100) and with a size of 400x200
|
||||
/// view.Reset(sf::FloatRect(100, 100, 400, 200));
|
||||
/// view.reset(sf::FloatRect(100, 100, 400, 200));
|
||||
///
|
||||
/// // Rotate it by 45 degrees
|
||||
/// view.Rotate(45);
|
||||
/// view.rotate(45);
|
||||
///
|
||||
/// // Set its target viewport to be half of the window
|
||||
/// view.SetViewport(sf::FloatRect(0.f, 0.f, 0.5f, 1.f));
|
||||
/// view.setViewport(sf::FloatRect(0.f, 0.f, 0.5f, 1.f));
|
||||
///
|
||||
/// // Apply it
|
||||
/// window.SetView(view);
|
||||
/// window.setView(view);
|
||||
///
|
||||
/// // Render stuff
|
||||
/// window.Draw(someSprite);
|
||||
/// window.draw(someSprite);
|
||||
///
|
||||
/// // Set the default view back
|
||||
/// window.SetView(window.GetDefaultView());
|
||||
/// window.setView(window.getDefaultView());
|
||||
///
|
||||
/// // Render stuff not affected by the view
|
||||
/// window.Draw(someText);
|
||||
/// window.draw(someText);
|
||||
/// \endcode
|
||||
///
|
||||
/// \see sf::RenderWindow, sf::RenderTexture
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue