Skip to content

Instantly share code, notes, and snippets.

@oprypin
Created August 13, 2016 07:48
Show Gist options
  • Save oprypin/a8bc3e28fe52076c2ca2a2c4bbcedc06 to your computer and use it in GitHub Desktop.
Save oprypin/a8bc3e28fe52076c2ca2a2c4bbcedc06 to your computer and use it in GitHub Desktop.
API changes between SFML 2.3 and 2.4
SoundBufferRecorder.hpp
+ ~SoundBufferRecorder();
SoundRecorder.hpp
+ void setChannelCount(unsigned int channelCount);
+ unsigned int getChannelCount() const;
SoundSource.hpp
+ SoundSource& operator =(const SoundSource& right);
BlendMode.hpp
- Add, ///< Pixel = Src * SrcFactor + Dst * DstFactor
- Subtract ///< Pixel = Src * SrcFactor - Dst * DstFactor
+ Add, ///< Pixel = Src * SrcFactor + Dst * DstFactor
+ Subtract, ///< Pixel = Src * SrcFactor - Dst * DstFactor
+ ReverseSubtract ///< Pixel = Dst * DstFactor - Src * SrcFactor
Font.hpp
- const Glyph& getGlyph(Uint32 codePoint, unsigned int characterSize, bool bold) const;
+ const Glyph& getGlyph(Uint32 codePoint, unsigned int characterSize, bool bold, float outlineThickness = 0) const;
- typedef std::map<Uint32, Glyph> GlyphTable; ///< Table mapping a codepoint to its glyph
+ typedef std::map<Uint64, Glyph> GlyphTable; ///< Table mapping a codepoint to its glyph
- Glyph loadGlyph(Uint32 codePoint, unsigned int characterSize, bool bold) const;
+ Glyph loadGlyph(Uint32 codePoint, unsigned int characterSize, bool bold, float outlineThickness) const;
Glsl.hpp
+namespace sf
+{
+namespace priv
+{
+ template <std::size_t Columns, std::size_t Rows>
+ struct Matrix;
+ template <typename T>
+ struct Vector4;
+#include <SFML/Graphics/Glsl.inl>
+} // namespace priv
+namespace Glsl
+{
+ typedef Vector2<float> Vec2;
+ typedef Vector2<int> Ivec2;
+ typedef Vector2<bool> Bvec2;
+ typedef Vector3<float> Vec3;
+ typedef Vector3<int> Ivec3;
+ typedef Vector3<bool> Bvec3;
+#ifdef SFML_DOXYGEN
+ typedef implementation-defined Vec4;
+ typedef implementation-defined Ivec4;
+ typedef implementation-defined Bvec4;
+ typedef implementation-defined Mat3;
+ typedef implementation-defined Mat4;
+#else // SFML_DOXYGEN
+ typedef priv::Vector4<float> Vec4;
+ typedef priv::Vector4<int> Ivec4;
+ typedef priv::Vector4<bool> Bvec4;
+ typedef priv::Matrix<3, 3> Mat3;
+ typedef priv::Matrix<4, 4> Mat4;
+#endif // SFML_DOXYGEN
+} // namespace Glsl
+} // namespace sf
+#endif // SFML_GLSL_HPP
Glsl.inl
+void SFML_GRAPHICS_API copyMatrix(const Transform& source, Matrix<3, 3>& dest);
+void SFML_GRAPHICS_API copyMatrix(const Transform& source, Matrix<4, 4>& dest);
+void SFML_GRAPHICS_API copyMatrix(const float* source, std::size_t elements, float* dest);
+void SFML_GRAPHICS_API copyVector(const Color& source, Vector4<float>& dest);
+void SFML_GRAPHICS_API copyVector(const Color& source, Vector4<int>& dest);
+template <std::size_t Columns, std::size_t Rows>
+struct Matrix
+{
+ explicit Matrix(const float* pointer)
+ {
+ copyMatrix(pointer, Columns * Rows, array);
+ }
+ Matrix(const Transform& transform)
+ {
+ copyMatrix(transform, *this);
+ }
+ float array[Columns * Rows]; ///< Array holding matrix data
+};
+template <typename T>
+struct Vector4
+{
+ Vector4() :
+ x(0),
+ y(0),
+ z(0),
+ w(0)
+ {
+ }
+ Vector4(T X, T Y, T Z, T W) :
+ x(X),
+ y(Y),
+ z(Z),
+ w(W)
+ {
+ }
+ template <typename U>
+ explicit Vector4(const Vector4<U>& other) :
+ x(static_cast<T>(other.x)),
+ y(static_cast<T>(other.y)),
+ z(static_cast<T>(other.z)),
+ w(static_cast<T>(other.w))
+ {
+ }
+ Vector4(const Color& color)
+ {
+ copyVector(color, *this);
+ }
+ T x; ///< 1st component (X) of the 4D vector
+ T y; ///< 2nd component (Y) of the 4D vector
+ T z; ///< 3rd component (Z) of the 4D vector
+ T w; ///< 4th component (W) of the 4D vector
+};
PrimitiveType.hpp
- Points, ///< List of individual points
- Lines, ///< List of individual lines
- LinesStrip, ///< List of connected lines, a point uses the previous point to form a line
- Triangles, ///< List of individual triangles
- TrianglesStrip, ///< List of connected triangles, a point uses the two previous points to form a triangle
- TrianglesFan, ///< List of connected triangles, a point uses the common center and the previous point to form a triangle
- Quads ///< List of individual quads (deprecated, don't work with OpenGL ES)
+ Points, ///< List of individual points
+ Lines, ///< List of individual lines
+ LineStrip, ///< List of connected lines, a point uses the previous point to form a line
+ Triangles, ///< List of individual triangles
+ TriangleStrip, ///< List of connected triangles, a point uses the two previous points to form a triangle
+ TriangleFan, ///< List of connected triangles, a point uses the common center and the previous point to form a triangle
+ Quads, ///< List of individual quads (deprecated, don't work with OpenGL ES)
+ LinesStrip = LineStrip, ///< \deprecated Use LineStrip instead
+ TrianglesStrip = TriangleStrip, ///< \deprecated Use TriangleStrip instead
+ TrianglesFan = TriangleFan ///< \deprecated Use TriangleFan instead
RenderTexture.hpp
+ bool generateMipmap();
RenderWindow.hpp
- Image capture() const;
+ SFML_DEPRECATED Image capture() const;
Shader.hpp
-#include <SFML/Graphics/Transform.hpp>
-#include <SFML/Graphics/Color.hpp>
+#include <SFML/Graphics/Glsl.hpp>
- Vertex, ///< Vertex shader
- Fragment ///< Fragment (pixel) shader
+ Vertex, ///< %Vertex shader
+ Geometry, ///< Geometry shader
+ Fragment ///< Fragment (pixel) shader
+ bool loadFromFile(const std::string& vertexShaderFilename, const std::string& geometryShaderFilename, const std::string& fragmentShaderFilename);
+ bool loadFromMemory(const std::string& vertexShader, const std::string& geometryShader, const std::string& fragmentShader);
- void setParameter(const std::string& name, float x);
+ bool loadFromStream(InputStream& vertexShaderStream, InputStream& geometryShaderStream, InputStream& fragmentShaderStream);
+ void setUniform(const std::string& name, float x);
- void setParameter(const std::string& name, float x, float y);
+ void setUniform(const std::string& name, const Glsl::Vec2& vector);
+ void setUniform(const std::string& name, const Glsl::Vec3& vector);
- void setParameter(const std::string& name, float x, float y, float z);
+ void setUniform(const std::string& name, const Glsl::Vec4& vector);
+ void setUniform(const std::string& name, int x);
- void setParameter(const std::string& name, float x, float y, float z, float w);
+ void setUniform(const std::string& name, const Glsl::Ivec2& vector);
+ void setUniform(const std::string& name, const Glsl::Ivec3& vector);
- void setParameter(const std::string& name, const Vector2f& vector);
+ void setUniform(const std::string& name, const Glsl::Ivec4& vector);
+ void setUniform(const std::string& name, bool x);
- void setParameter(const std::string& name, const Vector3f& vector);
+ void setUniform(const std::string& name, const Glsl::Bvec2& vector);
+ void setUniform(const std::string& name, const Glsl::Bvec3& vector);
- void setParameter(const std::string& name, const Color& color);
+ void setUniform(const std::string& name, const Glsl::Bvec4& vector);
+ void setUniform(const std::string& name, const Glsl::Mat3& matrix);
- void setParameter(const std::string& name, const Transform& transform);
+ void setUniform(const std::string& name, const Glsl::Mat4& matrix);
- void setParameter(const std::string& name, const Texture& texture);
+ void setUniform(const std::string& name, const Texture& texture);
- void setParameter(const std::string& name, CurrentTextureType);
+ void setUniform(const std::string& name, CurrentTextureType);
+ void setUniformArray(const std::string& name, const float* scalarArray, std::size_t length);
+ void setUniformArray(const std::string& name, const Glsl::Vec2* vectorArray, std::size_t length);
+ void setUniformArray(const std::string& name, const Glsl::Vec3* vectorArray, std::size_t length);
+ void setUniformArray(const std::string& name, const Glsl::Vec4* vectorArray, std::size_t length);
+ void setUniformArray(const std::string& name, const Glsl::Mat3* matrixArray, std::size_t length);
+ void setUniformArray(const std::string& name, const Glsl::Mat4* matrixArray, std::size_t length);
+ SFML_DEPRECATED void setParameter(const std::string& name, float x);
+ SFML_DEPRECATED void setParameter(const std::string& name, float x, float y);
+ SFML_DEPRECATED void setParameter(const std::string& name, float x, float y, float z);
+ SFML_DEPRECATED void setParameter(const std::string& name, float x, float y, float z, float w);
+ SFML_DEPRECATED void setParameter(const std::string& name, const Vector2f& vector);
+ SFML_DEPRECATED void setParameter(const std::string& name, const Vector3f& vector);
+ SFML_DEPRECATED void setParameter(const std::string& name, const Color& color);
+ SFML_DEPRECATED void setParameter(const std::string& name, const Transform& transform);
+ SFML_DEPRECATED void setParameter(const std::string& name, const Texture& texture);
+ SFML_DEPRECATED void setParameter(const std::string& name, CurrentTextureType);
+ static bool isAvailable();
- static bool isAvailable();
+ static bool isGeometryAvailable();
- bool compile(const char* vertexShaderCode, const char* fragmentShaderCode);
+ bool compile(const char* vertexShaderCode, const char* geometryShaderCode, const char* fragmentShaderCode);
- int getParamLocation(const std::string& name);
+ int getUniformLocation(const std::string& name);
+ struct UniformBinder;
- typedef std::map<std::string, int> ParamTable;
+ typedef std::map<std::string, int> UniformTable;
Text.hpp
+ SFML_DEPRECATED void setColor(const Color& color);
+ void setFillColor(const Color& color);
+ void setOutlineColor(const Color& color);
- void setColor(const Color& color);
+ void setOutlineThickness(float thickness);
+ SFML_DEPRECATED const Color& getColor() const;
+ const Color& getFillColor() const;
+ const Color& getOutlineColor() const;
- const Color& getColor() const;
+ float getOutlineThickness() const;
Texture.hpp
+ void setSrgb(bool sRgb);
+ bool isSrgb() const;
+ bool generateMipmap();
+ void invalidateMipmap();
IpAddress.hpp
+ static const IpAddress Any; ///< Value representing any address (0.0.0.0)
+ friend SFML_NETWORK_API bool operator <(const IpAddress& left, const IpAddress& right);
+ void resolve(const std::string& address);
TcpListener.hpp
- Status listen(unsigned short port);
+ Status listen(unsigned short port, const IpAddress& address = IpAddress::Any);
UdpSocket.hpp
-class IpAddress;
- Status bind(unsigned short port);
+ Status bind(unsigned short port, const IpAddress& address = IpAddress::Any);
NativeActivity.hpp
+#ifndef SFML_NATIVEACTIVITY_HPP
+#define SFML_NATIVEACTIVITY_HPP
+#include <SFML/System/Export.hpp>
+#if !defined(SFML_SYSTEM_ANDROID)
+#error NativeActivity.hpp: This header is Android only.
+#endif
+struct ANativeActivity;
+namespace sf
+{
+SFML_SYSTEM_API ANativeActivity* getNativeActivity();
+} // namespace sf
+#endif // SFML_NATIVEACTIVITY_HPP
Context.hpp
+ const ContextSettings& getSettings() const;
+ static bool isExtensionAvailable(const char* name);
+ static const Context* getActiveContext();
ContextSettings.hpp
- explicit ContextSettings(unsigned int depth = 0, unsigned int stencil = 0, unsigned int antialiasing = 0, unsigned int major = 1, unsigned int minor = 1, unsigned int attributes = Default) :
+ explicit ContextSettings(unsigned int depth = 0, unsigned int stencil = 0, unsigned int antialiasing = 0, unsigned int major = 1, unsigned int minor = 1, unsigned int attributes = Default, bool sRgb = false) :
Window.hpp
+ void setMouseCursorGrabbed(bool grabbed);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment