Skip to content
Browse files

Merge branch 'master' of git://github.com/bastienleonard/pysfml2-cython

  • Loading branch information...
2 parents bc466c0 + 4deb28e commit da186e5182a53c5d32f10be13d2af75177511aff @mkeeter committed
Showing with 29 additions and 23 deletions.
  1. +2 −3 MANIFEST.in
  2. +2 −1 README.txt
  3. +4 −3 decl.pxd
  4. +4 −4 declaudio.pxd
  5. +4 −1 decljoy.pxd
  6. +2 −1 doc/sphinx/source/graphics.rst
  7. +5 −0 doc/sphinx/source/system.rst
  8. +4 −4 examples/pong/main.py
  9. +0 −4 examples/renderimage.py
  10. +2 −2 sf.pyx
View
5 MANIFEST.in
@@ -1,6 +1,5 @@
-include LICENSE.txt
-include sf.cpp
-include examples/*.py
+include setup.py setup3k.py *.txt sf.cpp *.pxd
+recursive-include examples *.py *.txt *.png *.jpg *.bmp *.sfx *.wav *.ttf
include doc/sphinx/source/*.rst
include doc/sphinx/source/conf.py
include doc/sphinx/Makefile
View
3 README.txt
@@ -1,4 +1,5 @@
-This project is Python binding for SFML 2.
+This is a pythonic binding for SFML 2, which supports Python 2 and 3.
The current project page is https://github.com/bastienleonard/pysfml2-cython.
Please read doc/sphinx/source/introduction.rst for more information.
+You can also read the HTML documentation at http://bastien-leonard.alwaysdata.net/pysfml/doc/index.html, which is normally up-to-date.
View
7 decl.pxd
@@ -33,6 +33,7 @@ from libcpp.vector cimport vector
cimport declblendmode
cimport declkey
+cimport decljoy
cimport declmouse
@@ -152,7 +153,7 @@ cdef extern from "SFML/Graphics.hpp" namespace "sf":
cdef cppclass Clock:
Clock()
- float GetElapsedTime()
+ Uint32 GetElapsedTime()
void Reset()
cdef cppclass Color:
@@ -183,7 +184,7 @@ cdef extern from "SFML/Graphics.hpp" namespace "sf":
bint IsJoystickButtonDown(unsigned int JoyId, unsigned int Button)
int GetMouseX()
int GetMouseY()
- float GetJoystickAxis(unsigned int JoyId, int Axis)
+ float GetJoystickAxis(unsigned int JoyId, decljoy.Axis Axis)
cdef cppclass VideoMode:
VideoMode()
@@ -394,7 +395,7 @@ cdef extern from "SFML/Graphics.hpp" namespace "sf":
void Draw(Drawable&, Shader&)
void EnableKeyRepeat(bint)
View& GetDefaultView()
- float GetFrameTime()
+ Uint32 GetFrameTime()
Input& GetInput()
unsigned int GetHeight()
ContextSettings& GetSettings()
View
8 declaudio.pxd
@@ -44,7 +44,7 @@ cdef extern from "SFML/Audio.hpp" namespace "sf":
cdef cppclass SoundBuffer:
SoundBuffer()
unsigned int GetChannelsCount()
- float GetDuration()
+ decl.Uint32 GetDuration()
decl.Int16* GetSamples()
unsigned int GetSampleRate()
size_t GetSamplesCount()
@@ -65,7 +65,7 @@ cdef extern from "SFML/Audio.hpp" namespace "sf":
bint GetLoop()
float GetMinDistance()
float GetPitch()
- float GetPlayingOffset()
+ decl.Uint32 GetPlayingOffset()
decl.Vector3f GetPosition()
float GetVolume()
Status GetStatus()
@@ -77,7 +77,7 @@ cdef extern from "SFML/Audio.hpp" namespace "sf":
void SetLoop(bint)
void SetMinDistance(float)
void SetPitch(float)
- void SetPlayingOffset(float)
+ void SetPlayingOffset(decl.Uint32)
void SetPosition(float, float, float)
void SetPosition(decl.Vector3f&)
void SetRelativeToListener(bint)
@@ -89,7 +89,7 @@ cdef extern from "SFML/Audio.hpp" namespace "sf":
float GetAttenuation()
unsigned int GetChannelsCount()
unsigned int GetSampleRate()
- float GetDuration()
+ decl.Uint32 GetDuration()
bint GetLoop()
float GetMinDistance()
float GetPitch()
View
5 decljoy.pxd
@@ -46,4 +46,7 @@ cdef extern from "SFML/Graphics.hpp" namespace "sf::Joy":
int ButtonCount
-
+# Alias for the sf::Joy::Axis enum
+cdef extern from "SFML/Window.hpp" namespace "sf::Joy":
+ cdef cppclass Axis:
+ pass
View
3 doc/sphinx/source/graphics.rst
@@ -263,7 +263,8 @@ Windowing
---------
-.. class:: RenderWindow(VideoMode mode, title[, style])
+.. class:: RenderWindow(VideoMode mode, title\
+ [, style[, ContextSettings settings]])
*style* can be one of:
View
5 doc/sphinx/source/system.rst
@@ -22,3 +22,8 @@ System
.. attribute:: y
.. classmethod:: from_tuple(t)
+
+ .. method:: copy()
+
+ Return a new :class:`Vector2f` with ``x`` and ``y`` set to the
+ value of ``self``.
View
8 examples/pong/main.py
@@ -45,12 +45,12 @@ def main():
# Define the paddles properties
ai_timer = sf.Clock()
- ai_time= 0.1;
- left_paddle_speed = 400.0;
- right_paddle_speed = 400.0;
+ ai_time= 100
+ left_paddle_speed = 0.4
+ right_paddle_speed = 0.4
# Define the ball properties
- ball_speed = 400.0
+ ball_speed = 0.4
ball_angle = 0.0
while True:
View
4 examples/renderimage.py
@@ -6,10 +6,6 @@
def main():
- if not sf.RenderImage.IS_AVAILABLE:
- print "Your system doesn't support RenderImage"
- sys.exit(1)
-
window = sf.RenderWindow(sf.VideoMode(640, 480), 'RenderImage example')
window.framerate_limit = 60
running = True
View
4 sf.pyx
@@ -809,7 +809,7 @@ cdef class Sound:
def __get__(self):
return self.p_this.GetPlayingOffset()
- def __set__(self, float value):
+ def __set__(self, int value):
self.p_this.SetPlayingOffset(value)
property position:
@@ -1115,7 +1115,7 @@ cdef class Input:
return self.get_mouse_y()
def get_joystick_axis(self, unsigned int joy_id, int axis):
- return self.GetJoystickAxis(joy_id, axis)
+ return self.p_this.GetJoystickAxis(joy_id, <decljoy.Axis>axis)
def get_mouse_x(self):
return self.p_this.GetMouseX()

0 comments on commit da186e5

Please sign in to comment.
Something went wrong with that request. Please try again.