[python-sfml] 03/08: Add patches to allow building for SFML 2.2
James Cowgill
jcowgill-guest at moszumanska.debian.org
Sat Mar 14 16:39:20 UTC 2015
This is an automated email from the git hooks/post-receive script.
jcowgill-guest pushed a commit to branch master
in repository python-sfml.
commit 820442eebb3f0315d48788854a9ff4e3c7b2facf
Author: James Cowgill <james410 at cowgill.org.uk>
Date: Sun Mar 8 23:11:44 2015 +0000
Add patches to allow building for SFML 2.2
---
debian/patches/05_Add-BlendMode-changes.patch | 159 +++++++++++++++++++++
debian/patches/06_Add-Float-Glyph-changes.patch | 97 +++++++++++++
.../07_Add-Ftp.ListingResponse-changes.patch | 38 +++++
debian/patches/series | 3 +
4 files changed, 297 insertions(+)
diff --git a/debian/patches/05_Add-BlendMode-changes.patch b/debian/patches/05_Add-BlendMode-changes.patch
new file mode 100644
index 0000000..2c2d31c
--- /dev/null
+++ b/debian/patches/05_Add-BlendMode-changes.patch
@@ -0,0 +1,159 @@
+From d4df28a46615b26d00cac621cea3be28cc7a08b8 Mon Sep 17 00:00:00 2001
+From: James Cowgill <james410 at cowgill.org.uk>
+Date: Sat, 7 Mar 2015 00:18:41 +0000
+Subject: [PATCH 2/4] Add BlendMode changes
+
+Upstream commit with some slight API changes:
+https://github.com/Sonkun/python-sfml/commit/0a0e54b23af1efd290b078b1a5f7af3cbb5fff34
+---
+ include/libcpp/blendmode.pxd | 22 ++++++++++++++++------
+ include/libcpp/sfml.pxd | 25 ++++++++++++++++++++++---
+ src/sfml/graphics.pyx | 36 ++++++++++++++++++++++++++----------
+ 3 files changed, 64 insertions(+), 19 deletions(-)
+
+diff --git a/include/libcpp/blendmode.pxd b/include/libcpp/blendmode.pxd
+index d5b0db9..a9ca3b0 100644
+--- a/include/libcpp/blendmode.pxd
++++ b/include/libcpp/blendmode.pxd
+@@ -8,9 +8,19 @@
+ # You should have received a copy of the GNU Lesser General Public License
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+-cdef extern from "SFML/Graphics.hpp" namespace "sf":
+- cdef enum BlendMode:
+- BlendAlpha
+- BlendAdd
+- BlendMultiply
+- BlendNone
++cdef extern from "SFML/Graphics.hpp" namespace "sf::BlendMode":
++ cdef enum Factor:
++ Zero
++ One
++ SrcColor
++ OneMinusSrcColor
++ DstColor
++ OneMinusDstColor
++ SrcAlpha
++ OneMinusSrcAlpha
++ DstAlpha
++ OneMinusDstAlpha
++
++ cdef enum Equation:
++ Add
++ Subtract
+diff --git a/include/libcpp/sfml.pxd b/include/libcpp/sfml.pxd
+index f12f179..f9e6b34 100644
+--- a/include/libcpp/sfml.pxd
++++ b/include/libcpp/sfml.pxd
+@@ -318,6 +318,25 @@ cdef extern from "SFML/Graphics.hpp" namespace "sf":
+ Transform operator*(Transform&)
+ #Transform operator*=(Transform&)
+
++ cdef cppclass BlendMode:
++ BlendMode()
++ BlendMode(blendmode.Factor, blendmode.Factor)
++ BlendMode(blendmode.Factor, blendmode.Factor, blendmode.Equation)
++ BlendMode(blendmode.Factor, blendmode.Factor, blendmode.Equation, blendmode.Factor, blendmode.Factor, blendmode.Equation)
++ bint operator==(BlendMode&)
++ bint operator!=(BlendMode&)
++ blendmode.Factor colorSrcFactor
++ blendmode.Factor colorDstFactor
++ blendmode.Equation colorEquation
++ blendmode.Factor alphaSrcFactor
++ blendmode.Factor alphaDstFactor
++ blendmode.Equation alphaEquation
++
++ cdef BlendMode BlendAlpha
++ cdef BlendMode BlendAdd
++ cdef BlendMode BlendMultiply
++ cdef BlendMode BlendNone
++
+ cdef cppclass Image:
+ Image()
+ void create(unsigned int, unsigned int)
+@@ -396,12 +415,12 @@ cdef extern from "SFML/Graphics.hpp" namespace "sf":
+
+ cdef cppclass RenderStates:
+ RenderStates()
+- RenderStates(blendmode.BlendMode)
++ RenderStates(BlendMode)
+ RenderStates(Transform&)
+ RenderStates(Texture*)
+ RenderStates(Shader*)
+- RenderStates(blendmode.BlendMode, Transform&, Texture*, Shader*)
+- blendmode.BlendMode blendMode
++ RenderStates(BlendMode, Transform&, Texture*, Shader*)
++ BlendMode blendMode
+ Transform transform
+ Texture* texture
+ Shader* shader
+diff --git a/src/sfml/graphics.pyx b/src/sfml/graphics.pyx
+index 68acb16..329ece7 100644
+--- a/src/sfml/graphics.pyx
++++ b/src/sfml/graphics.pyx
+@@ -74,10 +74,10 @@ cdef Pixels wrap_pixels(Uint8 *p, unsigned int w, unsigned int h):
+
+
+ class BlendMode:
+- BLEND_ALPHA = sf.blendmode.BlendAlpha
+- BLEND_ADD = sf.blendmode.BlendAdd
+- BLEND_MULTIPLY = sf.blendmode.BlendMultiply
+- BLEND_NONE = sf.blendmode.BlendNone
++ BLEND_ALPHA = 0
++ BLEND_ADD = 1
++ BLEND_MULTIPLY = 2
++ BLEND_NONE = 3
+
+
+ class PrimitiveType:
+@@ -1035,14 +1035,14 @@ cdef public class RenderStates[type PyRenderStatesType, object PyRenderStatesObj
+ cdef Texture m_texture
+ cdef Shader m_shader
+
+- def __init__(self, sf.blendmode.BlendMode blend_mode=sf.blendmode.BlendAlpha, Transform transform=None, Texture texture=None, Shader shader=None):
++ def __init__(self, int blend_mode=BlendMode.BLEND_ALPHA, Transform transform=None, Texture texture=None, Shader shader=None):
+ self.p_this = new sf.RenderStates()
+
+ self.m_transform = wrap_transform(&self.p_this.transform, False)
+ self.m_texture = None
+ self.m_shader = None
+
+- if blend_mode: self.blend_mode = blend_mode
++ self.blend_mode = blend_mode
+ if transform: self.transform = transform
+ if texture: self.texture = texture
+ if shader: self.shader = shader
+@@ -1052,10 +1052,26 @@ cdef public class RenderStates[type PyRenderStatesType, object PyRenderStatesObj
+
+ property blend_mode:
+ def __get__(self):
+- return self.p_this.blendMode
+-
+- def __set__(self, sf.blendmode.BlendMode blend_mode):
+- self.p_this.blendMode = blend_mode
++ if self.p_this.blendMode == sf.BlendAlpha:
++ return BlendMode.BLEND_ALPHA
++ elif self.p_this.blendMode == sf.BlendAdd:
++ return BlendMode.BLEND_ADD
++ elif self.p_this.blendMode == sf.BlendMultiply:
++ return BlendMode.BLEND_MULTIPLY
++ else:
++ return BlendMode.BLEND_NONE
++
++ def __set__(self, int blend_mode):
++ if blend_mode == BlendMode.BLEND_ALPHA:
++ self.p_this.blendMode = sf.BlendAlpha
++ elif blend_mode == BlendMode.BLEND_ADD:
++ self.p_this.blendMode = sf.BlendAdd
++ elif blend_mode == BlendMode.BLEND_MULTIPLY:
++ self.p_this.blendMode = sf.BlendMultiply
++ elif blend_mode == BlendMode.BLEND_NONE:
++ self.p_this.blendMode = sf.BlendNone
++ else:
++ raise ValueError("invalid blend mode")
+
+ property transform:
+ def __get__(self):
+--
+2.1.4
+
diff --git a/debian/patches/06_Add-Float-Glyph-changes.patch b/debian/patches/06_Add-Float-Glyph-changes.patch
new file mode 100644
index 0000000..fa52734
--- /dev/null
+++ b/debian/patches/06_Add-Float-Glyph-changes.patch
@@ -0,0 +1,97 @@
+From 65c688ccffcbc9a27df7de40559f0b0b05752ab5 Mon Sep 17 00:00:00 2001
+From: James Cowgill <james410 at cowgill.org.uk>
+Date: Sat, 7 Mar 2015 00:40:46 +0000
+Subject: [PATCH 3/4] Add Float / Glyph changes
+
+---
+ include/libcpp/sfml.pxd | 6 +++---
+ include/pysfml/graphics.pxd | 4 ++++
+ src/sfml/graphics.pyx | 12 ++++++------
+ 3 files changed, 13 insertions(+), 9 deletions(-)
+
+diff --git a/include/libcpp/sfml.pxd b/include/libcpp/sfml.pxd
+index f9e6b34..5d71dea 100644
+--- a/include/libcpp/sfml.pxd
++++ b/include/libcpp/sfml.pxd
+@@ -383,7 +383,7 @@ cdef extern from "SFML/Graphics.hpp" namespace "sf":
+ cdef cppclass Glyph:
+ Glyph()
+ int advance
+- IntRect bounds
++ FloatRect bounds
+ IntRect textureRect
+
+ cdef cppclass Font:
+@@ -392,8 +392,8 @@ cdef extern from "SFML/Graphics.hpp" namespace "sf":
+ bint loadFromFile(char*&)
+ bint loadFromMemory(void*, size_t)
+ Glyph& getGlyph(Uint32, unsigned int, bint)
+- int getKerning(Uint32, Uint32, unsigned int)
+- int getLineSpacing(unsigned int)
++ float getKerning(Uint32, Uint32, unsigned int)
++ float getLineSpacing(unsigned int)
+ Texture& getTexture(unsigned int)
+
+ cdef cppclass Shader:
+diff --git a/include/pysfml/graphics.pxd b/include/pysfml/graphics.pxd
+index d816b83..13ba83a 100644
+--- a/include/pysfml/graphics.pxd
++++ b/include/pysfml/graphics.pxd
+@@ -64,6 +64,10 @@ cdef inline Rectangle intrect_to_rectangle(sf.IntRect* intrect):
+ cdef inline Rectangle floatrect_to_rectangle(sf.FloatRect* floatrect):
+ return Rectangle((floatrect.left, floatrect.top), (floatrect.width, floatrect.height))
+
++# Converting SFML 2.2 FloatRects to IntRects for compatability
++cdef inline Rectangle floatrect_to_intrect_rectangle(sf.FloatRect* floatrect):
++ return Rectangle((<long>(floatrect.left), <long>(floatrect.top)), (<long>(floatrect.width), <long>(floatrect.height)))
++
+ cdef inline Color wrap_color(sf.Color *p):
+ cdef Color r = Color.__new__(Color)
+ r.p_this = p
+diff --git a/src/sfml/graphics.pyx b/src/sfml/graphics.pyx
+index 329ece7..3d049e0 100644
+--- a/src/sfml/graphics.pyx
++++ b/src/sfml/graphics.pyx
+@@ -65,7 +65,7 @@ from pysfml.system cimport Vector2, Vector3
+ from pysfml.system cimport to_vector2i, to_vector2f
+ from pysfml.window cimport VideoMode, ContextSettings, Pixels, Window
+ from pysfml.graphics cimport to_intrect, to_floatrect
+-from pysfml.graphics cimport intrect_to_rectangle, floatrect_to_rectangle
++from pysfml.graphics cimport intrect_to_rectangle, floatrect_to_rectangle, floatrect_to_intrect_rectangle
+
+ cdef Pixels wrap_pixels(Uint8 *p, unsigned int w, unsigned int h):
+ cdef Pixels r = Pixels.__new__(Pixels)
+@@ -743,14 +743,14 @@ cdef class Glyph:
+ return self.p_this.advance
+
+ def __set__(self, int advance):
+- self.p_this.advance = advance
++ self.p_this.advance = <long>(advance)
+
+ property bounds:
+ def __get__(self):
+- return intrect_to_rectangle(&self.p_this.bounds)
++ return floatrect_to_intrect_rectangle(&self.p_this.bounds)
+
+ def __set__(self, bounds):
+- self.p_this.bounds = to_intrect(bounds)
++ self.p_this.bounds = to_floatrect(bounds)
+
+ property texture_rectangle:
+ def __get__(self):
+@@ -807,10 +807,10 @@ cdef class Font:
+ return wrap_glyph(p)
+
+ def get_kerning(self, Uint32 first, Uint32 second, unsigned int character_size):
+- return self.p_this.getKerning(first, second, character_size)
++ return <long>(self.p_this.getKerning(first, second, character_size))
+
+ def get_line_spacing(self, unsigned int character_size):
+- return self.p_this.getLineSpacing(character_size)
++ return <long>(self.p_this.getLineSpacing(character_size))
+
+ def get_texture(self, unsigned int character_size):
+ cdef sf.Texture *p
+--
+2.1.4
+
diff --git a/debian/patches/07_Add-Ftp.ListingResponse-changes.patch b/debian/patches/07_Add-Ftp.ListingResponse-changes.patch
new file mode 100644
index 0000000..ba38635
--- /dev/null
+++ b/debian/patches/07_Add-Ftp.ListingResponse-changes.patch
@@ -0,0 +1,38 @@
+From 0cc5ab7bf831ffb5fe4589edc2a8130fd8795908 Mon Sep 17 00:00:00 2001
+From: James Cowgill <james410 at cowgill.org.uk>
+Date: Sat, 7 Mar 2015 00:44:15 +0000
+Subject: [PATCH 4/4] Add Ftp.ListingResponse changes
+
+---
+ include/libcpp/ftp.pxd | 2 +-
+ src/sfml/network.pyx | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/include/libcpp/ftp.pxd b/include/libcpp/ftp.pxd
+index c3f3b92..3886b83 100644
+--- a/include/libcpp/ftp.pxd
++++ b/include/libcpp/ftp.pxd
+@@ -35,6 +35,6 @@ cdef extern from "SFML/Network.hpp" namespace "sf::Ftp":
+
+ cdef cppclass ListingResponse:
+ ListingResponse()
+- ListingResponse(Response&, vector[char]&)
++ ListingResponse(Response&, string&)
+ vector[string]& getListing()
+ bint isOk()
+diff --git a/src/sfml/network.pyx b/src/sfml/network.pyx
+index ab4d4ed..fd4c290 100644
+--- a/src/sfml/network.pyx
++++ b/src/sfml/network.pyx
+@@ -543,7 +543,7 @@ cdef class Ftp:
+ # what we had allocated to cheat on when the ListingResponse
+ # is destroyed.
+ cdef sf.ftp.Response* response = new sf.ftp.Response()
+- cdef vector[char] falseList
++ cdef string falseList
+ cdef sf.ftp.ListingResponse* listing_response = new sf.ftp.ListingResponse(response[0], falseList)
+ del response
+
+--
+2.1.4
+
diff --git a/debian/patches/series b/debian/patches/series
index 1db649f..8a483d2 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,6 @@
02_disable-cython-headers.patch
03_disable-intersphinx.patch
04_Fixed-sf.Rectangle.interesects-method.patch
+05_Add-BlendMode-changes.patch
+06_Add-Float-Glyph-changes.patch
+07_Add-Ftp.ListingResponse-changes.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/python-sfml.git
More information about the Pkg-games-commits
mailing list