From 839c80556db2bd0728a167cc515f1f124c9f9486 Mon Sep 17 00:00:00 2001 From: tankbo Date: Mon, 7 Dec 2009 11:53:38 +0000 Subject: [PATCH] Adjusted PySFML to work with the current SFML2 branch. Note that it's just compatible. A lot of the new functionality is still in the pipeline. git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1308 4e206d99-4929-0410-ac5d-dfc041789085 --- python/samples/data/cheeseburger.ttf | Bin 0 -> 42020 bytes python/samples/hellosfml.py | 98 +++++++++++++ python/samples/opengl.py | 8 +- python/samples/sound.py | 22 +-- python/samples/sound_capture.py | 2 +- python/samples/worm.py | 20 +-- python/setup.py | 6 +- ...WindowSettings.cpp => ContextSettings.cpp} | 50 ++++--- ...WindowSettings.hpp => ContextSettings.hpp} | 14 +- python/src/Drawable.cpp | 22 +-- python/src/Drawable.hpp | 7 +- python/src/Font.cpp | 16 +-- python/src/Image.cpp | 6 +- python/src/Listener.cpp | 14 +- python/src/Music.cpp | 8 +- python/src/Rect.cpp | 48 +++---- python/src/RenderQueue.cpp | 94 +++++++++++++ python/src/RenderQueue.hpp | 40 ++++++ python/src/RenderWindow.cpp | 60 ++++---- python/src/{PostFX.cpp => Shader.cpp} | 86 ++++++------ python/src/{PostFX.hpp => Shader.hpp} | 6 +- python/src/SoundRecorder.cpp | 6 +- python/src/SoundStream.cpp | 20 +-- python/src/SoundStream.hpp | 4 +- python/src/{String.cpp => Text.cpp} | 132 +++++++++--------- python/src/{String.hpp => Text.hpp} | 8 +- python/src/View.cpp | 38 +---- python/src/Window.cpp | 30 ++-- python/src/main.cpp | 33 ++--- 29 files changed, 544 insertions(+), 354 deletions(-) create mode 100644 python/samples/data/cheeseburger.ttf create mode 100644 python/samples/hellosfml.py rename python/src/{WindowSettings.cpp => ContextSettings.cpp} (56%) rename python/src/{WindowSettings.hpp => ContextSettings.hpp} (83%) create mode 100644 python/src/RenderQueue.cpp create mode 100644 python/src/RenderQueue.hpp rename python/src/{PostFX.cpp => Shader.cpp} (61%) rename python/src/{PostFX.hpp => Shader.hpp} (93%) rename python/src/{String.cpp => Text.cpp} (51%) rename python/src/{String.hpp => Text.hpp} (91%) diff --git a/python/samples/data/cheeseburger.ttf b/python/samples/data/cheeseburger.ttf new file mode 100644 index 0000000000000000000000000000000000000000..47704266ef288293e6590a29d649eccbd85fa0b8 GIT binary patch literal 42020 zcmdSCcbH^nb?1NYty{Np&at~Ib`Dk5xqG@tnxsjZ8I2|nNR|)+gp3Rbk--sc*4S9a zV7y)#3oH?A8Dx=UvJeP?kU#;&QBIhj?cL?^;$><-=T!G-B*Ys0Jp0E_qyF}-Tkk#R zyx())^Tw(+Ov5k&#ybp`F?sem6RqEzS~=G+%sKAvzTnm8zvhwOzyIBaVIMLK*ZW_7 z$r~?v&F_tT!!Ufu3}fZIi(hvBh4*@IAEE4x{LEa;4d>miGS~lupW4N*e%%$#4-Z_6 zymuLf^}ScU>^Cm`UgEwh3}YMR4@58d^$X5_YweQn8HVSdDf7x#pMS+`%&b}AI?MC@ zm!ALXm#qeV`v$}K%UjWZ{cC>xwXfUxd*`74!|$NXUm0RMKi_(DyY|w^(*LB)Q`|8= z_ph_N?YGYd7yd>e{Z7dhhk{dcAYK@ovLy zoNL%T=`~gjKW}c~#}Y~ARpuY@u4&z9{XX~J+xui=hJ z&4zy1H_ZQGtVm&Vu=iu!ha8VFiM$E(o&5gq#-ufCOc$Wuo^geZOVC&6qMj#PtcvTw}D1$GHA5KPQbj^G)cv1U>)6YtenJ z(Xm|oz6D)hL&lx_+)9~%F=H)oEqbIL|BkI4%KeEkZO$0OMBR+MXMBe;UwVQ54;mfw zZ>aYP>^NP2m$IV&W@Fa89hoP7b^XS7u}AdZi0oNo4*fgLG&0}9eW?$&S|8^6K4VDy zLevaepW^+$=jS5c`!0ILSNw>7)JNintBj&`i1OANUvtL!=Btfe#{Jaew~cw_K>Ym- zdgTYsU-U9BmAHCQ$EGL*n9d9ybJfIe&AKO{kb2}Asl~@I9dBSO}^+VpW;_I zKK5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aArV_Qahx22|UO=TyiZ<*NIo1S`WDnGTcFSYWs zZQHiKTVK#w-^S@Jm9g>J$aX z*1i4RZ@=m0|K>fs+{JFzoA~eM7ce;r-xDxB0jIMt_79F{U^5lo%jc8)TcO4{yl#zk zjFs&6!tLOuSo8VV{CkTN@jJ$^N9}Q1nxP%P?RQg@jpZhO+rq!Sa2v;_!>wSJzNd-d zM66@%-^$TE|89(Zrugmo|F#AH>*ISXIr6V|^zj|D>Ho>Bb>tX(&-q^#FOOH=ZpI%d z{SQC)GeTCcx`GjMCGXR{nvwRR@M7M5`Vz*_OBubqKan@p@kTkme;scwTFZNCZs6@8 zH}Y= 1.0: + fpsclock.Reset() + fpstext.SetString( u"FPS: " + unicode( currentfps ) ) + currentfps = 0 + + # Update apples (for the "bounce effect"). + for apple in apples: + apple.sprite.Move( apple.speed[0], apple.speed[1] ) + apple.sprite.Rotate( apple.rotationstep ) + + realpos = (apple.sprite.GetPosition()[0] - apple.sprite.GetOrigin()[0], apple.sprite.GetPosition()[1] - apple.sprite.GetOrigin()[1]) + if (apple.speed[0] > 0 and realpos[0] >= Resolution[0] - appleimage.GetWidth()) or (apple.speed[0] < 0 and realpos[0] <= 0): + apple.speed = (apple.speed[0] * -1, apple.speed[1]) + + if (apple.speed[1] > 0 and realpos[1] >= Resolution[1] - appleimage.GetWidth()) or (apple.speed[1] < 0 and realpos[1] <= 0): + apple.speed = (apple.speed[0], apple.speed[1] * -1) diff --git a/python/samples/opengl.py b/python/samples/opengl.py index b171a4783..cbddaaa77 100644 --- a/python/samples/opengl.py +++ b/python/samples/opengl.py @@ -11,7 +11,7 @@ def main(): # Create main window App = sf.RenderWindow(sf.VideoMode(800, 600), "SFML OpenGL") - App.PreserveOpenGLStates(True) + App.SetActive() # Create a sprite for the background BackgroundImage = sf.Image() @@ -73,7 +73,11 @@ def main(): # Draw background App.Draw(Background) + App.Flush() + # Active window to be able to perform OpenGL commands. + App.SetActive() + # Clear depth buffer glClear(GL_DEPTH_BUFFER_BIT) @@ -145,7 +149,7 @@ def main(): glEnd() # Draw some text on top of our OpenGL object - Text = sf.String("This is a rotating cube") + Text = sf.Text("This is a rotating cube") Text.SetPosition(230., 300.) Text.SetColor(sf.Color(128, 0, 128)) App.Draw(Text) diff --git a/python/samples/sound.py b/python/samples/sound.py index 648740670..8d91de680 100644 --- a/python/samples/sound.py +++ b/python/samples/sound.py @@ -3,40 +3,40 @@ # You can notice that here we use PySFML.sf instead of just PySFML # Therefore it won't be needed to put sf. in front of SFML classes -from PySFML.sf import * +from PySFML import sf def Main(): - Buffer = SoundBuffer() + Buffer = sf.SoundBuffer() if not Buffer.LoadFromFile("data/fart.wav"): # Loads the sound return - Fart = Sound(Buffer, False) + Fart = sf.Sound(Buffer, False) WindowWidth, WindowHeight = 640, 480 - App = RenderWindow(VideoMode(WindowWidth,WindowHeight,32), "Sound with PySFML", Style.Close, WindowSettings(24,8,0)) + App = sf.RenderWindow(sf.VideoMode(WindowWidth,WindowHeight,32), "Sound with PySFML", sf.Style.Close, sf.ContextSettings(24,8,0)) App.SetFramerateLimit(30) - EventHandler = Event() + EventHandler = sf.Event() InputHandler = App.GetInput() - Text = String("Turn the sound on.\nClick anywhere on the screen.\nMove the mouse. Click again.\nTry clicking in the corners.") + Text = sf.Text("Turn the sound on.\nClick anywhere on the screen.\nMove the mouse. Click again.\nTry clicking in the corners.") Text.SetX(30.) Text.SetY(20.) - Text.SetColor(Color(150, 100, 10, 255)) + Text.SetColor(sf.Color(150, 100, 10, 255)) while App.IsOpened(): # Main loop while App.GetEvent(EventHandler): # Event Handler - if EventHandler.Type == Event.Closed: + if EventHandler.Type == sf.Event.Closed: App.Close() - if EventHandler.Type == Event.KeyPressed and EventHandler.Key.Code == Key.Escape: + if EventHandler.Type == sf.Event.KeyPressed and EventHandler.Key.Code == sf.Key.Escape: App.Close() - if EventHandler.Type == Event.MouseButtonPressed and EventHandler.MouseButton.Button == Mouse.Left: + if EventHandler.Type == sf.Event.MouseButtonPressed and EventHandler.MouseButton.Button == sf.Mouse.Left: Fart.SetPitch(1.5 - 1.*InputHandler.GetMouseY()/WindowHeight) Fart.SetPosition( 1.*(InputHandler.GetMouseX() - WindowWidth/2)/(WindowWidth/20), 2., -2.) Fart.Play() App.Draw(Text) App.Display() - App.Clear(Color.Black) + App.Clear(sf.Color.Black) Main() diff --git a/python/samples/sound_capture.py b/python/samples/sound_capture.py index 456ba59b6..9a496593f 100644 --- a/python/samples/sound_capture.py +++ b/python/samples/sound_capture.py @@ -4,7 +4,7 @@ from PySFML import sf def Main(): # Check that the device can capture audio - if sf.SoundRecorder.CanCapture() == False: + if sf.SoundRecorder.IsAvailable() == False: print "Sorry, audio capture is not supported by your system" return diff --git a/python/samples/worm.py b/python/samples/worm.py index 685ff01f4..49bb10856 100644 --- a/python/samples/worm.py +++ b/python/samples/worm.py @@ -10,7 +10,7 @@ class Menu: text_color = sf.Color(220, 220, 20, 255) self.spacing = screen_height/7 - self.title = sf.String("PyWorm!") + self.title = sf.Text("PyWorm!") self.title.SetColor(text_color) self.title.SetPosition(screen_width/2-80., self.spacing) @@ -18,7 +18,7 @@ class Menu: x_align = [-80., -50., -70., -50.] self.strings = [] for i in range(0, 4): - string = sf.String(levels[i]) + string = sf.Text(levels[i]) string.SetColor(text_color) string.SetPosition(screen_width/2+x_align[i], (2+i)*self.spacing+20) self.strings.append(string) @@ -47,7 +47,7 @@ class Apple(sf.Sprite): pass # print "Could not load data/apple.png" sf.Sprite.__init__(self, apple_img) - self.SetCenter(apple_img.GetWidth()/2, apple_img.GetHeight()/2) + self.SetOrigin(apple_img.GetWidth()/2, apple_img.GetHeight()/2) self.size = apple_img.GetWidth() def random_move(self, arena): @@ -62,10 +62,10 @@ class Arena(dict): def __init__(self, window_width, window_height): self.window_width = window_width self.arena_bottom, self.exit_left, self.exit_right = window_height-80, window_width/2 - 50, window_width/2 + 50 - self['level_str'] = sf.String() + self['level_str'] = sf.Text() self['level_str'].SetColor(sf.Color.White) self['level_str'].SetPosition(60., window_height-60) - self['score_str'] = sf.String() + self['score_str'] = sf.Text() self['score_str'].SetColor(sf.Color.White) self['score_str'].SetPosition(260., window_height-60) self.exit_rect = sf.Shape.Rectangle(self.exit_left, 0, self.exit_right, self.arena_top, sf.Color.Black) @@ -78,16 +78,16 @@ class Arena(dict): def reset(self): self.level, self.score, self.arena_left, self.arena_right = 1, 0, self.shrink_value, self.window_width-self.shrink_value self.update_arena_rect() - self['level_str'].SetText("Level: 1") - self['score_str'].SetText("Score: 0") + self['level_str'].SetString("Level: 1") + self['score_str'].SetString("Score: 0") def update_score(self): self.score += 1 - self['score_str'].SetText("Score: " + str(self.score)) + self['score_str'].SetString("Score: " + str(self.score)) def next_level(self): self.level += 1 - self['level_str'].SetText("Level: " + str(self.level)) + self['level_str'].SetString("Level: " + str(self.level)) self.arena_left += self.shrink_value self.arena_right -= self.shrink_value self.update_arena_rect() @@ -97,7 +97,7 @@ class Arena(dict): class Part(sf.Sprite): def __init__(self, rond, x, y): sf.Sprite.__init__(self, rond) - self.SetCenter(rond.GetWidth()/2, rond.GetHeight()/2) + self.SetOrigin(rond.GetWidth()/2, rond.GetHeight()/2) self.SetPosition(x, y) class Worm(list): diff --git a/python/setup.py b/python/setup.py index 9eed271e7..01e6bfb8c 100644 --- a/python/setup.py +++ b/python/setup.py @@ -13,11 +13,11 @@ setup(name='PySFML', ext_modules=[ Extension('PySFML.sf', \ ['src/Clock.cpp', 'src/Color.cpp', 'src/Drawable.cpp', \ 'src/Event.cpp', 'src/Image.cpp', 'src/Input.cpp', 'src/Key.cpp', 'src/main.cpp', 'src/Music.cpp', \ - 'src/PostFX.cpp', 'src/Rect.cpp', 'src/RenderWindow.cpp', 'src/Sleep.cpp', \ - 'src/Sprite.cpp', 'src/String.cpp', 'src/VideoMode.cpp', 'src/View.cpp', 'src/Window.cpp', \ + 'src/Shader.cpp', 'src/Rect.cpp', 'src/RenderWindow.cpp', 'src/Sleep.cpp', \ + 'src/Sprite.cpp', 'src/Text.cpp', 'src/VideoMode.cpp', 'src/View.cpp', 'src/Window.cpp', \ 'src/Joy.cpp', 'src/Mouse.cpp', 'src/WindowStyle.cpp', 'src/Blend.cpp', 'src/Sound.cpp', \ 'src/SoundBuffer.cpp', 'src/Listener.cpp', 'src/SoundRecorder.cpp', 'src/SoundBufferRecorder.cpp', \ - 'src/SoundStream.cpp', 'src/Font.cpp', 'src/Glyph.cpp', 'src/Shape.cpp', 'src/WindowSettings.cpp' ], \ + 'src/SoundStream.cpp', 'src/Font.cpp', 'src/Glyph.cpp', 'src/Shape.cpp', 'src/ContextSettings.cpp' ], \ libraries=['sfml-graphics', 'sfml-window', 'sfml-audio', 'sfml-system'], \ library_dirs=['../lib/mingw'], \ include_dirs=['../include'] diff --git a/python/src/WindowSettings.cpp b/python/src/ContextSettings.cpp similarity index 56% rename from python/src/WindowSettings.cpp rename to python/src/ContextSettings.cpp index 5c4a4f275..6537858d8 100644 --- a/python/src/WindowSettings.cpp +++ b/python/src/ContextSettings.cpp @@ -22,60 +22,66 @@ // //////////////////////////////////////////////////////////// -#include "WindowSettings.hpp" +#include "ContextSettings.hpp" #include #include "offsetof.hpp" #include "compat.hpp" -static PyMemberDef PySfWindowSettings_members[] = { - {(char *)"DepthBits", T_UINT, offsetof(PySfWindowSettings, DepthBits), 0, (char *)"Depth buffer bits (24 by default)"}, - {(char *)"StencilBits", T_UINT, offsetof(PySfWindowSettings, StencilBits), 0, (char *)"Stencil buffer bits (8 by default)"}, - {(char *)"AntialiasingLevel", T_UINT, offsetof(PySfWindowSettings, AntialiasingLevel), 0, (char *)"Antialiasing level (0 by default)"}, +static PyMemberDef PySfContextSettings_members[] = { + {(char *)"DepthBits", T_UINT, offsetof(PySfContextSettings, DepthBits), 0, (char *)"Depth buffer bits (24 by default)"}, + {(char *)"StencilBits", T_UINT, offsetof(PySfContextSettings, StencilBits), 0, (char *)"Stencil buffer bits (8 by default)"}, + {(char *)"AntialiasingLevel", T_UINT, offsetof(PySfContextSettings, AntialiasingLevel), 0, (char *)"Antialiasing level (0 by default)"}, + {(char *)"MajorVersion", T_UINT, offsetof(PySfContextSettings, MajorVersion), 0, (char *)"Major number of the context version to create. (2 by default)"}, + {(char *)"MinorVersion", T_UINT, offsetof(PySfContextSettings, MinorVersion), 0, (char *)"Minor number of the context version to create. (0 by default)"}, {NULL} /* Sentinel */ }; static void -PySfWindowSettings_dealloc(PySfWindowSettings *self) +PySfContextSettings_dealloc(PySfContextSettings *self) { delete self->obj; free_object(self); } void -PySfWindowSettingsUpdate(PySfWindowSettings *self) +PySfContextSettingsUpdate(PySfContextSettings *self) { self->obj->DepthBits = self->DepthBits; self->obj->StencilBits = self->StencilBits; self->obj->AntialiasingLevel = self->AntialiasingLevel; + self->obj->MajorVersion = self->MajorVersion; + self->obj->MinorVersion = self->MinorVersion; } static PyObject * -PySfWindowSettings_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +PySfContextSettings_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - const char *kwlist[] = {"DepthBits", "StencilBits", "AntialiasingLevel", NULL}; - PySfWindowSettings *self; - self = (PySfWindowSettings *)type->tp_alloc(type, 0); + const char *kwlist[] = {"DepthBits", "StencilBits", "AntialiasingLevel", "MajorVersion", "MinorVersion", NULL}; + PySfContextSettings *self; + self = (PySfContextSettings *)type->tp_alloc(type, 0); if (self != NULL) { self->DepthBits = 24; self->StencilBits = 8; self->AntialiasingLevel = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|III:WindowSettings.__init__", (char **)kwlist, &(self->DepthBits), &(self->StencilBits), &(self->AntialiasingLevel))) + self->MajorVersion = 2; + self->MinorVersion = 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|IIIII:ContextSettings.__init__", (char **)kwlist, &(self->DepthBits), &(self->StencilBits), &(self->AntialiasingLevel), &(self->MajorVersion), &(self->MinorVersion))) return NULL; - self->obj = new sf::WindowSettings(self->DepthBits, self->StencilBits, self->AntialiasingLevel); + self->obj = new sf::ContextSettings(self->DepthBits, self->StencilBits, self->AntialiasingLevel, self->MajorVersion, self->MinorVersion); } return (PyObject *)self; } -PyTypeObject PySfWindowSettingsType = { +PyTypeObject PySfContextSettingsType = { head_init - "WindowSettings", /*tp_name*/ - sizeof(PySfWindowSettings), /*tp_basicsize*/ + "ContextSettings", /*tp_name*/ + sizeof(PySfContextSettings), /*tp_basicsize*/ 0, /*tp_itemsize*/ - (destructor)PySfWindowSettings_dealloc, /*tp_dealloc*/ + (destructor)PySfContextSettings_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -99,7 +105,7 @@ PyTypeObject PySfWindowSettingsType = { 0, /* tp_iter */ 0, /* tp_iternext */ 0, /* tp_methods */ - PySfWindowSettings_members, /* tp_members */ + PySfContextSettings_members, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ @@ -108,12 +114,12 @@ PyTypeObject PySfWindowSettingsType = { 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ - PySfWindowSettings_new, /* tp_new */ + PySfContextSettings_new, /* tp_new */ }; -PySfWindowSettings * -GetNewPySfWindowSettings() +PySfContextSettings * +GetNewPySfContextSettings() { - return PyObject_New(PySfWindowSettings, &PySfWindowSettingsType); + return PyObject_New(PySfContextSettings, &PySfContextSettingsType); } diff --git a/python/src/WindowSettings.hpp b/python/src/ContextSettings.hpp similarity index 83% rename from python/src/WindowSettings.hpp rename to python/src/ContextSettings.hpp index e185084e3..d8b09a1a9 100644 --- a/python/src/WindowSettings.hpp +++ b/python/src/ContextSettings.hpp @@ -27,7 +27,7 @@ #include -#include +#include typedef struct { @@ -35,13 +35,15 @@ typedef struct { unsigned int DepthBits; unsigned int StencilBits; unsigned int AntialiasingLevel; - sf::WindowSettings *obj; -} PySfWindowSettings; + unsigned int MajorVersion; + unsigned int MinorVersion; + sf::ContextSettings *obj; +} PySfContextSettings; void -PySfWindowSettingsUpdate(PySfWindowSettings *self); +PySfContextSettingsUpdate(PySfContextSettings *self); -PySfWindowSettings * -GetNewPySfWindowSettings(); +PySfContextSettings * +GetNewPySfContextSettings(); #endif diff --git a/python/src/Drawable.cpp b/python/src/Drawable.cpp index 6375a35df..33b37eeb3 100644 --- a/python/src/Drawable.cpp +++ b/python/src/Drawable.cpp @@ -31,10 +31,10 @@ extern PyTypeObject PySfColorType; -void CustomDrawable::Render(sf::RenderTarget& Target) const +void CustomDrawable::Render(sf::RenderTarget& Target, sf::RenderQueue& Queue) const { if (RenderFunction) - PyObject_CallFunction(RenderFunction, (char *)"O", RenderWindow); + PyObject_CallFunction(RenderFunction, (char *)"OO", RenderWindow, Queue); else { PyErr_SetString(PyExc_RuntimeError, "Custom drawables must have a render method defined"); @@ -108,18 +108,18 @@ PySfDrawable_SetRotation(PySfDrawable* self, PyObject *args) Py_RETURN_NONE; } static PyObject * -PySfDrawable_SetCenter(PySfDrawable* self, PyObject *args) +PySfDrawable_SetOrigin(PySfDrawable* self, PyObject *args) { float x, y; - if (!PyArg_ParseTuple(args, "ff:Drawable.SetCenter", &x, &y) ) + if (!PyArg_ParseTuple(args, "ff:Drawable.SetOrigin", &x, &y) ) return NULL; - self->obj->SetCenter(x, y); + self->obj->SetOrigin(x, y); Py_RETURN_NONE; } static PyObject * -PySfDrawable_GetCenter(PySfDrawable* self) +PySfDrawable_GetOrigin(PySfDrawable* self) { - sf::Vector2f Vect = self->obj->GetCenter(); + sf::Vector2f Vect = self->obj->GetOrigin(); return Py_BuildValue("ff", Vect.x, Vect.y); } @@ -253,11 +253,11 @@ int PySfDrawable_setattro(PyObject* self, PyObject *attr_name, PyObject *v) static PyMethodDef PySfDrawable_methods[] = { {"TransformToLocal", (PyCFunction)PySfDrawable_TransformToLocal, METH_VARARGS, "TransformToLocal(X, Y)\n\ -Transform a point from global coordinates into local coordinates (ie it applies the inverse of object's center, translation, rotation and scale to the point). Returns a tuple.\n\ +Transform a point from global coordinates into local coordinates (ie it applies the inverse of object's origin, translation, rotation and scale to the point). Returns a tuple.\n\ X : X coordinate of the point to transform\n\ Y : Y coordinate of the point to transform"}, {"TransformToGlobal", (PyCFunction)PySfDrawable_TransformToGlobal, METH_VARARGS, "TransformToGlobal(X, Y)\n\ -Transform a point from local coordinates into global coordinates (ie it applies the object's center, translation, rotation and scale to the point). Returns a tuple.\n\ +Transform a point from local coordinates into global coordinates (ie it applies the object's origin, translation, rotation and scale to the point). Returns a tuple.\n\ X : X coordinate of the point to transform\n\ Y : Y coordinate of the point to transform"}, {"SetX", (PyCFunction)PySfDrawable_SetX, METH_O, "SetX(X)\nSet the X position of the object.\n X : New X coordinate"}, @@ -266,8 +266,8 @@ Transform a point from local coordinates into global coordinates (ie it applies {"SetScaleX", (PyCFunction)PySfDrawable_SetScaleX, METH_O, "SetScaleX(ScaleX)\nSet the X scale factor of the object.\n ScaleX : New horizontal scale (must be strictly positive)"}, {"SetScaleY", (PyCFunction)PySfDrawable_SetScaleY, METH_O, "SetScaleY(ScaleY)\nSet the Y scale factor of the object.\n ScaleY : New vertical scale (must be strictly positive)"}, {"SetRotation", (PyCFunction)PySfDrawable_SetRotation, METH_O, "SetRotation(Rotation)\nSet the orientation of the object.\n Rotation : Angle of rotation, in degrees"}, - {"SetCenter", (PyCFunction)PySfDrawable_SetCenter, METH_VARARGS, "SetCenter(CenterX, CenterY)\nSet the center of the object, in coordinates relative to the object.\n CenterX : X coordinate of the center\n CenterY : Y coordinate of the center"}, - {"GetCenter", (PyCFunction)PySfDrawable_GetCenter, METH_NOARGS, "GetCenter()\nGet the center of the object, in coordinates relative to the object."}, + {"SetOrigin", (PyCFunction)PySfDrawable_SetOrigin, METH_VARARGS, "SetOrigin(OriginX, OriginY)\nSet the origin of the object, in coordinates relative to the object.\n OriginX : X coordinate of the origin\n OriginY : Y coordinate of the origin"}, + {"GetOrigin", (PyCFunction)PySfDrawable_GetOrigin, METH_NOARGS, "GetOrigin()\nGet the origin of the object, in coordinates relative to the object."}, {"SetColor", (PyCFunction)PySfDrawable_SetColor, METH_O, "SetColor(Color)\nSet the color of the object.\n Color : New color"}, {"GetPosition", (PyCFunction)PySfDrawable_GetPosition, METH_NOARGS, "GetPosition()\nGet the position of the object."}, {"GetScale", (PyCFunction)PySfDrawable_GetScale, METH_NOARGS, "GetScale()\nGet the scale of the object."}, diff --git a/python/src/Drawable.hpp b/python/src/Drawable.hpp index 84049c5a3..12af4fe60 100644 --- a/python/src/Drawable.hpp +++ b/python/src/Drawable.hpp @@ -28,14 +28,15 @@ #include #include +#include #include "RenderWindow.hpp" - +#include "RenderQueue.hpp" class CustomDrawable : public sf::Drawable { -protected : - virtual void Render(sf::RenderTarget& Target) const; +protected : + virtual void Render(sf::RenderTarget& Target, sf::RenderQueue& Queue) const; public : PySfRenderWindow *RenderWindow; PyObject *RenderFunction; diff --git a/python/src/Font.cpp b/python/src/Font.cpp index 4b72cd668..979474fb7 100644 --- a/python/src/Font.cpp +++ b/python/src/Font.cpp @@ -75,16 +75,16 @@ PySfFont_LoadFromFile(PySfFont* self, PyObject *args, PyObject *kwds) { PyErr_Clear(); if (EncodingStr == NULL) - result = self->obj->LoadFromFile(Filename, Charsize, sf::Unicode::UTF8String((sf::Uint8 *)Charset)); + result = self->obj->LoadFromFile(Filename, Charsize, Charset); else { Encoding.assign(EncodingStr); if (Encoding == "utf8" || Encoding == "") - result = self->obj->LoadFromFile(Filename, Charsize, sf::Unicode::UTF8String((sf::Uint8 *)Charset)); + result = self->obj->LoadFromFile(Filename, Charsize, Charset); else if (Encoding == "utf16") - result = self->obj->LoadFromFile(Filename, Charsize, sf::Unicode::UTF16String((sf::Uint16 *)(Charset+2))); + result = self->obj->LoadFromFile(Filename, Charsize, Charset+2); else if (Encoding == "utf32") - result = self->obj->LoadFromFile(Filename, Charsize, sf::Unicode::UTF32String((sf::Uint32 *)(Charset+4))); + result = self->obj->LoadFromFile(Filename, Charsize, Charset+4); else { PyErr_Format(PyExc_TypeError, "Font.LoadFromFile() Encoding %s not supported", EncodingStr); @@ -125,16 +125,16 @@ PySfFont_LoadFromMemory(PySfFont* self, PyObject *args, PyObject *kwds) { PyErr_Clear(); if (EncodingStr == NULL) - result = self->obj->LoadFromMemory(Data, Size, Charsize, sf::Unicode::UTF8String((sf::Uint8 *)Charset)); + result = self->obj->LoadFromMemory(Data, Size, Charsize, Charset); else { Encoding.assign(EncodingStr); if (Encoding == "utf8") - result = self->obj->LoadFromMemory(Data, Size, Charsize, sf::Unicode::UTF8String((sf::Uint8 *)Charset)); + result = self->obj->LoadFromMemory(Data, Size, Charsize, Charset); else if (Encoding == "utf16") - result = self->obj->LoadFromMemory(Data, Size, Charsize, sf::Unicode::UTF16String((sf::Uint16 *)(Charset+2))); + result = self->obj->LoadFromMemory(Data, Size, Charsize, Charset+2); else if (Encoding == "utf32") - result = self->obj->LoadFromMemory(Data, Size, Charsize, sf::Unicode::UTF32String((sf::Uint32 *)(Charset+4))); + result = self->obj->LoadFromMemory(Data, Size, Charsize, Charset+4); else { PyErr_Format(PyExc_TypeError, "Font.LoadFromMemory() Encoding %s not supported", EncodingStr); diff --git a/python/src/Image.cpp b/python/src/Image.cpp index 745cbc295..000773bd6 100644 --- a/python/src/Image.cpp +++ b/python/src/Image.cpp @@ -223,10 +223,10 @@ PySfImage_GetHeight(PySfImage *self) } static PyObject * -PySfImage_GetValidTextureSize(PySfImage* self, PyObject *args) +PySfImage_GetValidSize(PySfImage* self, PyObject *args) { unsigned long S = PyLong_AsUnsignedLong(args); - return PyLong_FromUnsignedLong(sf::Image::GetValidTextureSize(S)); + return PyLong_FromUnsignedLong(sf::Image::GetValidSize(S)); } static PyObject * @@ -300,7 +300,7 @@ Create the image from the current contents of the given window. Return True if c {"GetHeight", (PyCFunction)PySfImage_GetHeight, METH_NOARGS, "GetHeight()\nReturn the height of the image."}, {"GetTexCoords", (PyCFunction)PySfImage_GetTexCoords, METH_VARARGS, "GetTexCoords(Rect)\nConvert a subrect expressed in pixels, into float texture coordinates. Returns texture coordinates corresponding to the sub-rectangle (sf.FloatRect instance)\n\ Rect : Sub-rectangle of image to convert"}, - {"GetValidTextureSize", (PyCFunction)PySfImage_GetValidTextureSize, METH_STATIC | METH_O, "GetValidTextureSize(Size)\nGet a valid texture size according to hardware support. Returns valid nearest size (greater than or equal to specified size).\n\ + {"GetValidSize", (PyCFunction)PySfImage_GetValidSize, METH_STATIC | METH_O, "GetValidSize(Size)\nGet a valid texture size according to hardware support. Returns valid nearest size (greater than or equal to specified size).\n\ Size : Size to convert"}, {NULL} /* Sentinel */ }; diff --git a/python/src/Listener.cpp b/python/src/Listener.cpp index c286411e6..6ad479e8d 100644 --- a/python/src/Listener.cpp +++ b/python/src/Listener.cpp @@ -58,19 +58,19 @@ PySfListener_GetPosition(PySfListener *self) } static PyObject * -PySfListener_SetTarget(PySfListener* self, PyObject *args) +PySfListener_SetDirection(PySfListener* self, PyObject *args) { float X, Y, Z; - if (!PyArg_ParseTuple(args, "fff:Listener.SetTarget", &X, &Y, &Z)) + if (!PyArg_ParseTuple(args, "fff:Listener.SetDirection", &X, &Y, &Z)) return NULL; - sf::Listener::SetTarget(X, Y, Z); + sf::Listener::SetDirection(X, Y, Z); Py_RETURN_NONE; } static PyObject* -PySfListener_GetTarget(PySfListener *self) +PySfListener_GetDirection(PySfListener *self) { - sf::Vector3f Vect = sf::Listener::GetTarget(); + sf::Vector3f Vect = sf::Listener::GetDirection(); return Py_BuildValue("fff", Vect.x, Vect.y, Vect.z); } @@ -79,8 +79,8 @@ static PyMethodDef PySfListener_methods[] = { {"GetGlobalVolume", (PyCFunction)PySfListener_GetGlobalVolume, METH_STATIC | METH_NOARGS, "GetGlobalVolume()\nGet the current value of the global volume of all the sounds."}, {"SetPosition", (PyCFunction)PySfListener_SetPosition, METH_STATIC | METH_VARARGS, "SetPosition(X, Y, Z)\nChange the position of the listener."}, {"GetPosition", (PyCFunction)PySfListener_GetPosition, METH_STATIC | METH_NOARGS, "GetPosition()\nGet the current position of the listener."}, - {"SetTarget", (PyCFunction)PySfListener_SetTarget, METH_STATIC | METH_VARARGS, "SetTarget(X, Y, Z)\nChange the orientation of the listener (the point he must look at)"}, - {"GetTarget", (PyCFunction)PySfListener_GetTarget, METH_STATIC | METH_NOARGS, "GetTarget()\nGet the current orientation of the listener (the point he's looking at)"}, + {"SetDirection", (PyCFunction)PySfListener_SetDirection, METH_STATIC | METH_VARARGS, "SetDirection(X, Y, Z)\nChange the orientation of the listener (the point he must look at)"}, + {"GetDirection", (PyCFunction)PySfListener_GetDirection, METH_STATIC | METH_NOARGS, "GetDirection()\nGet the current orientation of the listener (the point he's looking at)"}, {NULL} /* Sentinel */ }; diff --git a/python/src/Music.cpp b/python/src/Music.cpp index fae51b21a..14645e9b2 100644 --- a/python/src/Music.cpp +++ b/python/src/Music.cpp @@ -40,14 +40,11 @@ PySfMusic_dealloc(PySfMusic *self) static PyObject * PySfMusic_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - unsigned int BufferSize=44100; PySfMusic *self; self = (PySfMusic *)type->tp_alloc(type, 0); if (self != NULL) { - if (!PyArg_ParseTuple(args, "|I:Music.__new__", &BufferSize)) - return NULL; - self->obj = new sf::Music(BufferSize); + self->obj = new sf::Music(); } return (PyObject *)self; } @@ -120,8 +117,7 @@ PyTypeObject PySfMusicType = { 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ "sf.Music defines a big sound played using streaming, so usually what we call a music :).\n\ -Constructor: sf.Music(BufferSize=44100)\n\ -BufferSize : Size of the internal buffer, expressed in number of samples (ie. size taken by the music in memory) (44100 by default)", /* tp_doc */ +Constructor: sf.Music()", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ diff --git a/python/src/Rect.cpp b/python/src/Rect.cpp index 8d5c57696..48afffc26 100644 --- a/python/src/Rect.cpp +++ b/python/src/Rect.cpp @@ -95,15 +95,10 @@ PySfFloatRect_new(PyTypeObject *type, PyObject *args, PyObject *kwds) } static PyObject * -PySfIntRect_GetWidth(PySfIntRect *self) +PySfIntRect_GetSize(PySfIntRect *self) { - return PyLong_FromLong(self->obj->GetWidth()); -} - -static PyObject * -PySfIntRect_GetHeight(PySfIntRect *self) -{ - return PyLong_FromLong(self->obj->GetHeight()); + sf::Vector2i size( self->obj->GetSize() ); + return Py_BuildValue( "ii", size.x, size.y ); } static PyObject * @@ -113,15 +108,10 @@ static PyObject * PySfIntRect_Intersects(PySfIntRect* self, PyObject *args); static PyObject * -PySfFloatRect_GetWidth(PySfFloatRect *self) +PySfFloatRect_GetSize(PySfFloatRect *self) { - return PyFloat_FromDouble(self->obj->GetWidth()); -} - -static PyObject * -PySfFloatRect_GetHeight(PySfFloatRect *self) -{ - return PyFloat_FromDouble(self->obj->GetHeight()); + sf::Vector2f size( self->obj->GetSize() ); + return Py_BuildValue( "ff", size.x, size.y ); } static PyObject * @@ -163,10 +153,7 @@ Move the whole rectangle by the given offset.\n\ OffsetX : Horizontal offset\n\ OffsetY : Vertical offset\n\ "}, - {"GetWidth", (PyCFunction)PySfIntRect_GetWidth, METH_NOARGS, "GetWidth()\n\ -Get the width of the rectangle."}, - {"GetHeight", (PyCFunction)PySfIntRect_GetHeight, METH_NOARGS, "GetHeight()\n\ -Get the height of the rectangle."}, + {"GetSize", (PyCFunction)PySfIntRect_GetSize, METH_NOARGS, "GetSize()\nGet the rectangle's size."}, {"Contains", (PyCFunction)PySfIntRect_Contains, METH_VARARGS, "Contains(X, Y)\n\ Check if a point is inside the rectangle's area.\n\ X : X coordinate of the point to test\n\ @@ -185,10 +172,7 @@ Move the whole rectangle by the given offset.\n\ OffsetX : Horizontal offset\n\ OffsetY : Vertical offset\n\ "}, - {"GetWidth", (PyCFunction)PySfFloatRect_GetWidth, METH_NOARGS, "GetWidth()\n\ -Get the width of the rectangle."}, - {"GetHeight", (PyCFunction)PySfFloatRect_GetHeight, METH_NOARGS, "GetHeight()\n\ -Get the height of the rectangle."}, + {"GetSize", (PyCFunction)PySfFloatRect_GetSize, METH_NOARGS, "GetSize()\nGet the rectangle's size."}, {"Contains", (PyCFunction)PySfFloatRect_Contains, METH_VARARGS, "Contains(X, Y)\n\ Check if a point is inside the rectangle's area.\n\ X : X coordinate of the point to test\n\ @@ -316,14 +300,14 @@ PySfFloatRect_Contains(PySfFloatRect* self, PyObject *args) static PyObject * PySfFloatRect_Intersects(PySfFloatRect* self, PyObject *args) { - PySfFloatRect *Rect=NULL, *OverlappingRect=NULL; + PySfFloatRect *Rect=NULL, *Intersection=NULL; bool result; - if (!PyArg_ParseTuple(args, "O!|O!:FloatRect.Intersects", &PySfFloatRectType, &Rect, &PySfFloatRectType, &OverlappingRect)) + if (!PyArg_ParseTuple(args, "O!|O!:FloatRect.Intersects", &PySfFloatRectType, &Rect, &PySfFloatRectType, &Intersection)) return NULL; - if (OverlappingRect) - result = self->obj->Intersects(*(Rect->obj), (OverlappingRect->obj)); + if (Intersection) + result = self->obj->Intersects(*(Rect->obj), *(Intersection->obj)); else result = self->obj->Intersects(*(Rect->obj)); @@ -345,14 +329,14 @@ PySfIntRect_Contains(PySfIntRect* self, PyObject *args) static PyObject * PySfIntRect_Intersects(PySfIntRect* self, PyObject *args) { - PySfIntRect *Rect=NULL, *OverlappingRect=NULL; + PySfIntRect *Rect=NULL, *Intersection=NULL; bool result; - if (!PyArg_ParseTuple(args, "O!|O!:IntRect.Intersects", &PySfIntRectType, &Rect, &PySfIntRectType, &OverlappingRect)) + if (!PyArg_ParseTuple(args, "O!|O!:IntRect.Intersects", &PySfIntRectType, &Rect, &PySfIntRectType, &Intersection)) return NULL; - if (OverlappingRect) - result = self->obj->Intersects(*(Rect->obj), (OverlappingRect->obj)); + if (Intersection) + result = self->obj->Intersects(*(Rect->obj), *(Intersection->obj)); else result = self->obj->Intersects(*(Rect->obj)); diff --git a/python/src/RenderQueue.cpp b/python/src/RenderQueue.cpp new file mode 100644 index 000000000..b14acae86 --- /dev/null +++ b/python/src/RenderQueue.cpp @@ -0,0 +1,94 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007-2009 Rémi Koenig (remi.k2620@gmail.com) +// Stefan "Tank" Schindler +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#include "RenderQueue.hpp" + +#include "compat.hpp" + +static void +PySfRenderQueue_dealloc(PySfRenderQueue* self) +{ + delete self->obj; + free_object( self ); +} + +static PyObject* +PySfRenderQueue_new(PyTypeObject* type, PyObjects* args, PyObject* kwds) +{ + PySfRenderQueue* self(static_cast(type->tp_alloc(type, 0))); + + if(self != 0) + { + self->obj = new sf::RenderQueue(); + } + + return static_cast( self ) +} + +static PyMethodDef PySfImage_methods[] = { + {NULL} /* Sentinel */ +}; + +PyTypeObject PySfImageType = { + head_init + "RenderQueue", /*tp_name*/ + sizeof(PySfRenderQueue), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)PySfRenderQueue_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "Implements a queue of rendering commands.\n\ +Default constructor : sf.RenderQueue()" /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PySfRenderQueue_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + PySfRenderQueue_new, /* tp_new */ +}; diff --git a/python/src/RenderQueue.hpp b/python/src/RenderQueue.hpp new file mode 100644 index 000000000..ecce3cece --- /dev/null +++ b/python/src/RenderQueue.hpp @@ -0,0 +1,40 @@ +//////////////////////////////////////////////////////////// +// +// PySFML - Python binding for SFML (Simple and Fast Multimedia Library) +// Copyright (C) 2007-2009 Rémi Koenig (remi.k2620@gmail.com) +// Stefan "Tank" Schindler +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +#ifndef __PYRENDERQUEUE_H +#define __PYRENDERQUEUE_H + +#include + +#include + +struct PySfRenderQueue { + PyObject_HEAD + sf::RenderQueue* obj; +}; + +PySfRenderQueue* GetNewPySfRenderQueue(); + +#endif diff --git a/python/src/RenderWindow.cpp b/python/src/RenderWindow.cpp index b5ed06d74..cb15e4bfc 100644 --- a/python/src/RenderWindow.cpp +++ b/python/src/RenderWindow.cpp @@ -61,31 +61,25 @@ PySfRenderWindow_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return (PyObject *)self; } -static PyObject * -PySfRenderWindow_Capture(PySfRenderWindow *self) -{ - PySfImage *Image; - - Image = GetNewPySfImage(); - Image->obj = new sf::Image(self->obj->Capture()); - return (PyObject *)Image; -} - static PyObject * PySfRenderWindow_ConvertCoords(PySfRenderWindow *self, PyObject *args) { unsigned int WindowX, WindowY; PySfView *PyTargetView = NULL; - sf::View *TargetView = NULL; sf::Vector2f Vect; if (!PyArg_ParseTuple(args, "II|O!:RenderWindow.ConvertCoords", &WindowX, &WindowY, &PySfViewType, &PyTargetView)) return NULL; if (PyTargetView) - TargetView = PyTargetView->obj; + { + Vect = self->obj->ConvertCoords(WindowX, WindowY, *PyTargetView->obj); + } + else + { + Vect = self->obj->ConvertCoords(WindowX, WindowY); + } - Vect = self->obj->ConvertCoords(WindowX, WindowY, TargetView); return Py_BuildValue("ff", Vect.x, Vect.y); } @@ -152,7 +146,25 @@ PySfRenderWindow_Clear(PySfRenderWindow *self, PyObject *args) } Py_RETURN_NONE; } - + +static PyObject * +PySfRenderWindow_SetActive(PySfRenderWindow *self, PyObject *args) +{ + PyObject* Active( 0 ); + + PyArg_ParseTuple( args, "|O", &Active ); + self->obj->SetActive( Active == 0 ? true : PyBool_AsBool( Active ) ); + + Py_RETURN_NONE; +} + +static PyObject * +PySfRenderWindow_Flush(PySfRenderWindow *self, PyObject *args) +{ + self->obj->Flush(); + Py_RETURN_NONE; +} + static PyObject * PySfRenderWindow_GetView(PySfRenderWindow *self) { @@ -174,13 +186,6 @@ PySfRenderWindow_GetView(PySfRenderWindow *self) } } -static PyObject * -PySfRenderWindow_PreserveOpenGLStates(PySfRenderWindow *self, PyObject *args) -{ - self->obj->PreserveOpenGLStates(PyBool_AsBool(args)); - Py_RETURN_NONE; -} - static PyObject * PySfRenderWindow_SetView(PySfRenderWindow* self, PyObject *args) { @@ -210,6 +215,11 @@ PySfRenderWindow_GetDefaultView(PySfRenderWindow *self) } static PyMethodDef PySfRenderWindow_methods[] = { + {"SetActive", (PyCFunction)PySfRenderWindow_SetActive, METH_VARARGS, "SetActive(Active)\n\ +Activate or deactivate the window as the current target for OpenGL rendering.\n\ + Active : True to activate window. (default: True)"}, + {"Flush", (PyCFunction)PySfRenderWindow_Flush, METH_VARARGS, "Flush()\n\ +Make sure that what has been drawn so far is rendered."}, {"Clear", (PyCFunction)PySfRenderWindow_Clear, METH_VARARGS, "Clear(FillColor)\n\ Clear the entire target with a single color.\n\ FillColor : Color to use to clear the render target."}, @@ -217,18 +227,10 @@ Clear the entire target with a single color.\n\ Get the default view of the window for read / write (returns a sf.View instance)."}, {"GetView", (PyCFunction)PySfRenderWindow_GetView, METH_NOARGS, "GetView()\n\ Get the current view rectangle (returns a sf.View instance)."}, - {"PreserveOpenGLStates", (PyCFunction)PySfRenderWindow_PreserveOpenGLStates, METH_O, "PreserveOpenGLStates(Preserve)\n\ -Tell SFML to preserve external OpenGL states, at the expense of more CPU charge. Use this function if you don't want SFML to mess up your own OpenGL states (if any). Don't enable state preservation if not needed, as it will allow SFML to do internal optimizations and improve performances. This parameter is false by default\n\ - Preserve : True to preserve OpenGL states, false to let SFML optimize"}, {"SetView", (PyCFunction)PySfRenderWindow_SetView, METH_O, "SetView(View)\n\ Change the current active view. View must be a sf.View instance."}, {"Draw", (PyCFunction)PySfRenderWindow_Draw, METH_O, "Draw(Drawable)\n\ Draw something on the window. The argument can be a drawable or any object supporting the iterator protocol and containing drawables (for example a tuple of drawables)."}, - {"PreserveOpenGLStates", (PyCFunction)PySfRenderWindow_PreserveOpenGLStates, METH_O, "PreserveOpenGLStates(Preserve)\n\ -Tell SFML to preserve external OpenGL states, at the expense of more CPU charge. Use this function if you don't want SFML to mess up your own OpenGL states (if any). Don't enable state preservation if not needed, as it will allow SFML to do internal optimizations and improve performances. This parameter is false by default\n\ - Preserve : True to preserve OpenGL states, false to let SFML optimize"}, - {"Capture", (PyCFunction)PySfRenderWindow_Capture, METH_NOARGS, "Capture()\n\ -Save the content of the window to an image. Returns a sf.Image object."}, {"ConvertCoords", (PyCFunction)PySfRenderWindow_ConvertCoords, METH_VARARGS, "ConvertCoords(WindowX, WindowY, TargetView)\n\ Convert a point in window coordinates into view coordinates. Returns a tuple of two floats.\n\ WindowX : X coordinate of the point to convert, relative to the window\n\ diff --git a/python/src/PostFX.cpp b/python/src/Shader.cpp similarity index 61% rename from python/src/PostFX.cpp rename to python/src/Shader.cpp index 6d797a00e..2a5dd383f 100644 --- a/python/src/PostFX.cpp +++ b/python/src/Shader.cpp @@ -22,7 +22,7 @@ // //////////////////////////////////////////////////////////// -#include "PostFX.hpp" +#include "Shader.hpp" #include "Drawable.hpp" #include "Image.hpp" @@ -34,23 +34,23 @@ extern PyTypeObject PySfDrawableType; static void -PySfPostFX_dealloc(PySfPostFX *self) +PySfShader_dealloc(PySfShader *self) { delete self->obj; free_object(self); } static PyObject * -PySfPostFX_new(PyTypeObject *type, PyObject *args, PyObject *kwds); +PySfShader_new(PyTypeObject *type, PyObject *args, PyObject *kwds); static PyObject * -PySfPostFX_LoadFromFile (PySfPostFX *self, PyObject *args) +PySfShader_LoadFromFile (PySfShader *self, PyObject *args) { load_from_file(self, args); } static PyObject * -PySfPostFX_LoadFromMemory (PySfPostFX *self, PyObject *args) +PySfShader_LoadFromMemory (PySfShader *self, PyObject *args) { char *effect; #ifdef IS_PY3K @@ -68,7 +68,7 @@ PySfPostFX_LoadFromMemory (PySfPostFX *self, PyObject *args) return PyBool_FromLong(result); } -static PyObject * PySfPostFX_SetParameter(PySfPostFX* self, PyObject *args) { char *Name; float X, Y, Z, W; int size = PyTuple_Size(args); if (!PyArg_ParseTuple(args, "sf|fff:PostFX.SetParameter", &Name, &X, &Y, &Z, &W)) return NULL; +static PyObject * PySfShader_SetParameter(PySfShader* self, PyObject *args) { char *Name; float X, Y, Z, W; int size = PyTuple_Size(args); if (!PyArg_ParseTuple(args, "sf|fff:Shader.SetParameter", &Name, &X, &Y, &Z, &W)) return NULL; switch (size) { @@ -92,52 +92,52 @@ static PyObject * PySfPostFX_SetParameter(PySfPostFX* self, PyObject *args) { c } static PyObject * -PySfPostFX_SetTexture(PySfPostFX* self, PyObject *args) +PySfShader_SetTexture(PySfShader* self, PyObject *args) { PySfImage *Image = NULL; char *Name; - if (! PyArg_ParseTuple(args, "s|O", &Name, &Image)) + if (! PyArg_ParseTuple(args, "sO", &Name, &Image)) + { return NULL; - if (Image == NULL || (PyObject *)Image == Py_None) - self->obj->SetTexture(Name, NULL); - else + } + + if (!PyObject_TypeCheck(Image, &PySfImageType)) { - if (!PyObject_TypeCheck(Image, &PySfImageType)) - { - PyErr_SetString(PyExc_TypeError, "PostFX.SetTexture() Argument 2, if specified, must be a sf.Image instance or None."); - return NULL; - } - self->obj->SetTexture(Name, Image->obj); + PyErr_SetString(PyExc_TypeError, "Shader.SetTexture() Argument 2 must be an sf.Image instance."); + return NULL; } - Py_RETURN_NONE; + + self->obj->SetTexture(Name, *Image->obj); + + Py_RETURN_NONE; } static PyObject * -PySfPostFX_CanUsePostFX(PySfPostFX* self, PyObject *args) +PySfShader_IsAvailable(PySfShader* self, PyObject *args) { - return PyBool_FromLong(sf::PostFX::CanUsePostFX()); + return PyBool_FromLong(sf::Shader::IsAvailable()); } -static PyMethodDef PySfPostFX_methods[] = { - {"LoadFromFile", (PyCFunction)PySfPostFX_LoadFromFile, METH_O, "LoadFromFile(Filename)\nLoad the effect from a file."}, - {"LoadFromMemory", (PyCFunction)PySfPostFX_LoadFromMemory, METH_O, "LoadFromMemory(Effect)\nLoad the effect from a text in memory."}, - {"SetParameter", (PyCFunction)PySfPostFX_SetParameter, METH_VARARGS, "SetParameter(X), SetParameter(X, Y), SetParameter(X, Y, Z), SetParameter(X, Y, Z, W)\nChange a parameter of the effect.\n\ +static PyMethodDef PySfShader_methods[] = { + {"LoadFromFile", (PyCFunction)PySfShader_LoadFromFile, METH_O, "LoadFromFile(Filename)\nLoad the effect from a file."}, + {"LoadFromMemory", (PyCFunction)PySfShader_LoadFromMemory, METH_O, "LoadFromMemory(Effect)\nLoad the effect from a text in memory."}, + {"SetParameter", (PyCFunction)PySfShader_SetParameter, METH_VARARGS, "SetParameter(X), SetParameter(X, Y), SetParameter(X, Y, Z), SetParameter(X, Y, Z, W)\nChange a parameter of the effect.\n\ Name : Parameter name in the effect\n\ X,Y,Z,W : Values to assign."}, - {"SetTexture", (PyCFunction)PySfPostFX_SetTexture, METH_VARARGS, "SetTexture(Name, Texture)\nSet a texture parameter.\n\ + {"SetTexture", (PyCFunction)PySfShader_SetTexture, METH_VARARGS, "SetTexture(Name, Texture)\nSet a texture parameter.\n\ Name : Texture name in the effect\n\ - Texture : Image to set (pass None to use content of current framebuffer)"}, - {"CanUsePostFX", (PyCFunction)PySfPostFX_CanUsePostFX, METH_STATIC | METH_NOARGS, "CanUsePostFX()\nTell wether or not the system supports post-effects."}, + Texture : Image to set (pass sf.Shader.CurrentTexture to use content of current framebuffer)"}, + {"IsAvailable", (PyCFunction)PySfShader_IsAvailable, METH_STATIC | METH_NOARGS, "IsAvailable()\nTell wether or not the system supports post-effects."}, {NULL} /* Sentinel */ }; -PyTypeObject PySfPostFXType = { +PyTypeObject PySfShaderType = { head_init - "PostFX", /*tp_name*/ - sizeof(PySfPostFX), /*tp_basicsize*/ + "Shader", /*tp_name*/ + sizeof(PySfShader), /*tp_basicsize*/ 0, /*tp_itemsize*/ - (destructor)PySfPostFX_dealloc, /*tp_dealloc*/ + (destructor)PySfShader_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -153,16 +153,16 @@ PyTypeObject PySfPostFXType = { 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - "sf.PostFX is used to apply a post effect to a window.\n\ -Default constructor : sf.PostFX()\n\ -Copy constructor : sf.PostFX(Copy) where Copy is a sf.PostFX instance.", /* tp_doc */ + "sf.Shader is used to apply a post effect to a window.\n\ +Default constructor : sf.Shader()\n\ +Copy constructor : sf.Shader(Copy) where Copy is a sf.Shader instance.", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ - PySfPostFX_methods, /* tp_methods */ + PySfShader_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PySfDrawableType, /* tp_base */ @@ -172,23 +172,23 @@ Copy constructor : sf.PostFX(Copy) where Copy is a sf.PostFX instance.", /* tp_d 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ - PySfPostFX_new, /* tp_new */ + PySfShader_new, /* tp_new */ }; static PyObject * -PySfPostFX_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +PySfShader_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - PySfPostFX *self; - self = (PySfPostFX *)type->tp_alloc(type, 0); + PySfShader *self; + self = (PySfShader *)type->tp_alloc(type, 0); if (self != NULL) { - PySfPostFX *Copy = NULL; + PySfShader *Copy = NULL; self->IsCustom = false; - if (!PyArg_ParseTuple(args, "|O!", &PySfPostFXType, &Copy)) + if (!PyArg_ParseTuple(args, "|O!", &PySfShaderType, &Copy)) return NULL; - if (Copy) self->obj = new sf::PostFX(*(Copy->obj)); - else self->obj = new sf::PostFX(); + if (Copy) self->obj = new sf::Shader(*(Copy->obj)); + else self->obj = new sf::Shader(); } return (PyObject *)self; } diff --git a/python/src/PostFX.hpp b/python/src/Shader.hpp similarity index 93% rename from python/src/PostFX.hpp rename to python/src/Shader.hpp index 9994885f7..ebfcde323 100644 --- a/python/src/PostFX.hpp +++ b/python/src/Shader.hpp @@ -27,12 +27,12 @@ #include -#include +#include typedef struct { PyObject_HEAD bool IsCustom; - sf::PostFX *obj; -} PySfPostFX; + sf::Shader *obj; +} PySfShader; #endif diff --git a/python/src/SoundRecorder.cpp b/python/src/SoundRecorder.cpp index 46f7ae199..4fc9facca 100644 --- a/python/src/SoundRecorder.cpp +++ b/python/src/SoundRecorder.cpp @@ -105,9 +105,9 @@ PySfSoundRecorder_GetSampleRate(PySfSoundRecorder* self) } static PyObject * -PySfSoundRecorder_CanCapture(PySfSoundRecorder* self) +PySfSoundRecorder_IsAvailable(PySfSoundRecorder* self) { - return PyBool_FromLong(sf::SoundRecorder::CanCapture()); + return PyBool_FromLong(sf::SoundRecorder::IsAvailable()); } @@ -115,7 +115,7 @@ static PyMethodDef PySfSoundRecorder_methods[] = { {"Start", (PyCFunction)PySfSoundRecorder_Start, METH_O, "Start(SampleRate=44100)\nStart the capture. Warning : only one capture can happen at the same time.\n SampleRate : Sound frequency (the more samples, the higher the quality) (44100 by default = CD quality)."}, {"Stop", (PyCFunction)PySfSoundRecorder_Stop, METH_NOARGS, "Stop()\nStop the capture."}, {"GetSampleRate", (PyCFunction)PySfSoundRecorder_GetSampleRate, METH_NOARGS, "GetSampleRate()\nGet the sample rate. Returns the frequency, in samples per second."}, - {"CanCapture", (PyCFunction)PySfSoundRecorder_CanCapture, METH_STATIC | METH_NOARGS, "CanCapture()\nTell if the system supports sound capture. If not, this class won't be usable. Returns True if audio capture is supported."}, + {"IsAvailable", (PyCFunction)PySfSoundRecorder_IsAvailable, METH_STATIC | METH_NOARGS, "IsAvailable()\nTell if the system supports sound capture. If not, this class won't be usable. Returns True if audio capture is supported."}, {NULL} /* Sentinel */ }; diff --git a/python/src/SoundStream.cpp b/python/src/SoundStream.cpp index e89c9fedb..7c73bbf48 100644 --- a/python/src/SoundStream.cpp +++ b/python/src/SoundStream.cpp @@ -27,32 +27,24 @@ #include "compat.hpp" -bool CustomSoundStream::OnStart() +void CustomSoundStream::OnSeek(float TimeOffset) { PyGILState_STATE gstate; - bool result = false; gstate = PyGILState_Ensure(); - if (PyObject_HasAttrString(SoundStream, "OnStart")) + if (PyObject_HasAttrString(SoundStream, "OnSeek")) { - PyObject *OnStart = PyObject_GetAttrString(SoundStream, "OnStart"); - if (OnStart != NULL) + PyObject *OnSeek = PyObject_GetAttrString(SoundStream, "OnSeek"); + if (OnSeek != NULL) { - PyObject *Result = PyObject_CallFunction(OnStart, NULL); - if (Result != NULL) - { - result = PyBool_AsBool(Result); - Py_CLEAR(Result); - } - Py_CLEAR(OnStart); + PyObject_CallFunction(OnSeek, const_cast( "f" ), TimeOffset); + Py_CLEAR(OnSeek); } } if (PyErr_Occurred()) { PyErr_Print(); - result = false; } PyGILState_Release(gstate); - return result; } bool CustomSoundStream::OnGetData(Chunk& Data) diff --git a/python/src/SoundStream.hpp b/python/src/SoundStream.hpp index d9e0a377e..055c7fba4 100644 --- a/python/src/SoundStream.hpp +++ b/python/src/SoundStream.hpp @@ -33,8 +33,8 @@ class CustomSoundStream : public sf::SoundStream { public : PyObject *SoundStream; - virtual bool OnStart(); - virtual bool OnGetData(Chunk& Data); + virtual void OnSeek(float TimeOffset); + virtual bool OnGetData(Chunk& Data); void Init(unsigned int ChannelsCount, unsigned int SampleRate); }; diff --git a/python/src/String.cpp b/python/src/Text.cpp similarity index 51% rename from python/src/String.cpp rename to python/src/Text.cpp index 52bf9f5cc..95d60c5b7 100644 --- a/python/src/String.cpp +++ b/python/src/Text.cpp @@ -22,7 +22,7 @@ // //////////////////////////////////////////////////////////// -#include "String.hpp" +#include "Text.hpp" #include "Font.hpp" #include "Color.hpp" #include "Rect.hpp" @@ -35,7 +35,7 @@ extern PyTypeObject PySfFontType; static void -PySfString_dealloc(PySfString *self) +PySfText_dealloc(PySfText *self) { Py_CLEAR(self->font); delete self->obj; @@ -43,50 +43,50 @@ PySfString_dealloc(PySfString *self) } static PyObject * -PySfString_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +PySfText_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - PySfString *self; - self = (PySfString *)type->tp_alloc(type, 0); + PySfText *self; + self = (PySfText *)type->tp_alloc(type, 0); if (self != NULL) { self->font = NULL; self->IsCustom = false; - self->obj = new sf::String(); + self->obj = new sf::Text(); } return (PyObject *)self; } static PyObject * -PySfString_SetText(PySfString* self, PyObject *args) +PySfText_SetString(PySfText* self, PyObject *args) { char *Text, *EncodingStr=NULL; int Length; std::string Encoding; - if (PyArg_ParseTuple(args, "u:String.SetText", &Text)) + if (PyArg_ParseTuple(args, "u:Text.SetString", &Text)) { #if Py_UNICODE_SIZE == 4 - self->obj->SetText((sf::Uint32 *)Text); + self->obj->SetString((sf::Uint32 *)Text); #else - self->obj->SetText((sf::Uint16 *)Text); + self->obj->SetString((sf::Uint16 *)Text); #endif } - else if (PyArg_ParseTuple(args, "s|#s:String.SetText", &Text, &Length, &EncodingStr)) + else if (PyArg_ParseTuple(args, "s|#s:Text.SetString", &Text, &Length, &EncodingStr)) { PyErr_Clear(); if (EncodingStr == NULL) - self->obj->SetText(sf::Unicode::UTF8String((sf::Uint8 *)Text)); + self->obj->SetString(Text); else { Encoding.assign(EncodingStr); if (Encoding == "utf8") - self->obj->SetText(sf::Unicode::UTF8String((sf::Uint8 *)Text)); + self->obj->SetString(Text); else if (Encoding == "utf16") - self->obj->SetText(sf::Unicode::UTF16String((sf::Uint16 *)(Text+2))); + self->obj->SetString(Text+2); else if (Encoding == "utf32") - self->obj->SetText(sf::Unicode::UTF32String((sf::Uint32 *)(Text+4))); + self->obj->SetString(Text+4); else { - PyErr_Format(PyExc_TypeError, "String.SetText() Encoding %s not supported", EncodingStr); + PyErr_Format(PyExc_TypeError, "Text.SetString() Encoding %s not supported", EncodingStr); return NULL; } } @@ -100,12 +100,12 @@ PySfString_SetText(PySfString* self, PyObject *args) } static PyObject * -PySfString_SetFont(PySfString* self, PyObject *args) +PySfText_SetFont(PySfText* self, PyObject *args) { PySfFont *Font = (PySfFont *)args; if (!PyObject_TypeCheck(Font, &PySfFontType)) { - PyErr_SetString(PyExc_ValueError, "String.SetFont() Argument must be a sf.Font"); + PyErr_SetString(PyExc_ValueError, "Text.SetFont() Argument must be a sf.Font"); return NULL; } Py_CLEAR(self->font); @@ -116,44 +116,44 @@ PySfString_SetFont(PySfString* self, PyObject *args) } static PyObject * -PySfString_SetSize(PySfString* self, PyObject *args) +PySfText_SetSize(PySfText* self, PyObject *args) { self->obj->SetSize(PyFloat_AsDouble(args)); Py_RETURN_NONE; } static PyObject * -PySfString_GetSize(PySfString* self) +PySfText_GetSize(PySfText* self) { return PyFloat_FromDouble(self->obj->GetSize()); } static PyObject * -PySfString_SetStyle(PySfString* self, PyObject *args) +PySfText_SetStyle(PySfText* self, PyObject *args) { self->obj->SetStyle(PyLong_AsUnsignedLong(args)); Py_RETURN_NONE; } static PyObject * -PySfString_GetStyle(PySfString* self) +PySfText_GetStyle(PySfText* self) { return PyLong_FromUnsignedLong(self->obj->GetStyle()); } static PyObject * -PySfString_GetText(PySfString* self) +PySfText_GetString(PySfText* self) { #if Py_UNICODE_SIZE == 4 - sf::Unicode::UTF32String Text(self->obj->GetText()); + const sf::String& Text(self->obj->GetString()); #else - sf::Unicode::UTF16String Text(self->obj->GetText()); + const sf::String& Text(self->obj->GetString()); #endif - return PyUnicode_FromUnicode((const Py_UNICODE*)Text.c_str(), Text.length()); + return PyUnicode_FromUnicode((const Py_UNICODE*)Text.ToAnsiString().c_str(), Text.GetSize()); } static PyObject * -PySfString_GetFont(PySfString* self) +PySfText_GetFont(PySfText* self) { if (self->font == NULL) { @@ -170,7 +170,7 @@ PySfString_GetFont(PySfString* self) } static PyObject * -PySfString_GetRect(PySfString* self) +PySfText_GetRect(PySfText* self) { PySfFloatRect *Rect; @@ -183,20 +183,20 @@ PySfString_GetRect(PySfString* self) } static PyObject * -PySfString_GetCharacterPos(PySfString* self, PyObject *args) +PySfText_GetCharacterPos(PySfText* self, PyObject *args) { sf::Vector2f Pos = self->obj->GetCharacterPos(PyLong_AsUnsignedLong(args)); return Py_BuildValue("ff", Pos.x, Pos.y); } static int -PySfString_init(PySfString *self, PyObject *args, PyObject *kwds) +PySfText_init(PySfText *self, PyObject *args, PyObject *kwds) { const char *kwlist[] = {"Text", "Font", "Size", NULL}; float Size = 30.f; PyObject *Text=NULL; PySfFont *Font = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OO!f:String.__new__", (char **)kwlist, &Text, &PySfFontType, &Font, &Size)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OO!f:Text.__new__", (char **)kwlist, &Text, &PySfFontType, &Font, &Size)) return -1; if (Text != NULL) @@ -204,52 +204,52 @@ PySfString_init(PySfString *self, PyObject *args, PyObject *kwds) if (PyUnicode_Check(Text)) { #if Py_UNICODE_SIZE == 4 - self->obj->SetText((sf::Uint32 *)PyUnicode_AS_UNICODE(Text)); + self->obj->SetString((sf::Uint32 *)PyUnicode_AS_UNICODE(Text)); #else - self->obj->SetText((sf::Uint16 *)PyUnicode_AS_UNICODE(Text)); + self->obj->SetString((sf::Uint16 *)PyUnicode_AS_UNICODE(Text)); #endif } #ifdef IS_PY3K else if (PyBytes_Check(Text)) - self->obj->SetText(sf::Unicode::UTF8String((sf::Uint8 *)PyBytes_AsString(Text))); + self->obj->SetString(PyBytes_AsString(Text)); #else else if (PyString_Check(Text)) - self->obj->SetText(sf::Unicode::UTF8String((sf::Uint8 *)PyString_AsString(Text))); + self->obj->SetString(PyString_AsString(Text)); #endif else { - PyErr_SetString(PyExc_TypeError, "String.__init__() first argument must be str"); + PyErr_SetString(PyExc_TypeError, "Text.__init__() first argument must be str"); return -1; } } - if (Font) PySfString_SetFont(self, (PyObject *)Font); + if (Font) PySfText_SetFont(self, (PyObject *)Font); self->obj->SetSize(Size); return 0; } -static PyMethodDef PySfString_methods[] = { - {"GetCharacterPos", (PyCFunction)PySfString_GetCharacterPos, METH_O, "GetCharacterPos(Index)\n\ +static PyMethodDef PySfText_methods[] = { + {"GetCharacterPos", (PyCFunction)PySfText_GetCharacterPos, METH_O, "GetCharacterPos(Index)\n\ Return the visual position (a tuple of two floats) of the Index-th character of the string, in coordinates relative to the string (note : translation, center, rotation and scale are not applied)\n\ Index : Index of the character"}, - {"SetText", (PyCFunction)PySfString_SetText, METH_VARARGS, "SetText(UnicodeText) or SetText(Text, Encoding='utf8')\nSet the text. Valid encodings are 'utf8', 'utf16' and 'utf32'.\n Text : New text"}, - {"GetText", (PyCFunction)PySfString_GetText, METH_NOARGS, "GetText()\nGet the text as an unicode string."}, - {"SetFont", (PyCFunction)PySfString_SetFont, METH_O, "SetFont(Font)\nSet the font of the string.\n Font : font to use"}, - {"GetFont", (PyCFunction)PySfString_GetFont, METH_NOARGS, "GetFont()\nGet the font used by the string."}, - {"SetSize", (PyCFunction)PySfString_SetSize, METH_O, "SetSize(Size)\nSet the size of the string.\n Size : New size, in pixels"}, - {"GetSize", (PyCFunction)PySfString_GetSize, METH_NOARGS, "GetSize()\nGet the size of the characters."}, - {"SetStyle", (PyCFunction)PySfString_SetStyle, METH_O, "SetStyle(TextSize)\nSet the style of the text. The default style is Regular.\n TextSize : New text style, (combination of Style values)"}, - {"GetStyle", (PyCFunction)PySfString_GetStyle, METH_NOARGS, "GetStyle()\nGet the style of the text."}, - {"GetRect", (PyCFunction)PySfString_GetRect, METH_NOARGS, "GetRect()\nGet the string rectangle on screen."}, + {"SetString", (PyCFunction)PySfText_SetString, METH_VARARGS, "SetString(UnicodeText) or SetString(Text, Encoding='utf8')\nSet the text. Valid encodings are 'utf8', 'utf16' and 'utf32'.\n Text : New text"}, + {"GetString", (PyCFunction)PySfText_GetString, METH_NOARGS, "GetString()\nGet the text as an unicode string."}, + {"SetFont", (PyCFunction)PySfText_SetFont, METH_O, "SetFont(Font)\nSet the font of the string.\n Font : font to use"}, + {"GetFont", (PyCFunction)PySfText_GetFont, METH_NOARGS, "GetFont()\nGet the font used by the string."}, + {"SetSize", (PyCFunction)PySfText_SetSize, METH_O, "SetSize(Size)\nSet the size of the string.\n Size : New size, in pixels"}, + {"GetSize", (PyCFunction)PySfText_GetSize, METH_NOARGS, "GetSize()\nGet the size of the characters."}, + {"SetStyle", (PyCFunction)PySfText_SetStyle, METH_O, "SetStyle(TextSize)\nSet the style of the text. The default style is Regular.\n TextSize : New text style, (combination of Style values)"}, + {"GetStyle", (PyCFunction)PySfText_GetStyle, METH_NOARGS, "GetStyle()\nGet the style of the text."}, + {"GetRect", (PyCFunction)PySfText_GetRect, METH_NOARGS, "GetRect()\nGet the string rectangle on screen."}, {NULL} /* Sentinel */ }; -PyTypeObject PySfStringType = { +PyTypeObject PySfTextType = { head_init - "String", /*tp_name*/ - sizeof(PySfString), /*tp_basicsize*/ + "Text", /*tp_name*/ + sizeof(PySfText), /*tp_basicsize*/ 0, /*tp_itemsize*/ - (destructor)PySfString_dealloc, /*tp_dealloc*/ + (destructor)PySfText_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -265,15 +265,15 @@ PyTypeObject PySfStringType = { 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - "sf.String defines a graphical 2D text, that can be drawn on screen.\n\ -Default constructor : String ()\nConstruct the string from an unicode or an ascii string : String(Text, Font=sf.Font.GetDefaultFont(), Size=30.)\n Text : Text assigned to the string\n Font : Font used to draw the string (SFML built-in font by default)\n Size : Characters size (30 by default)", /* tp_doc */ + "sf.Text defines a graphical 2D text, that can be drawn on screen.\n\ +Default constructor : Text ()\nConstruct the string from an unicode or an ascii string : Text(Text, Font=sf.Font.GetDefaultFont(), Size=30.)\n Text : Text assigned to the string\n Font : Font used to draw the string (SFML built-in font by default)\n Size : Characters size (30 by default)", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ - PySfString_methods, /* tp_methods */ + PySfText_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PySfDrawableType, /* tp_base */ @@ -281,27 +281,27 @@ Default constructor : String ()\nConstruct the string from an unicode or an asci 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ - (initproc)PySfString_init, /* tp_init */ + (initproc)PySfText_init, /* tp_init */ 0, /* tp_alloc */ - PySfString_new, /* tp_new */ + PySfText_new, /* tp_new */ }; -void PySfString_InitConst() +void PySfText_InitConst() { PyObject *obj; - obj = PyLong_FromLong(sf::String::Regular); - PyDict_SetItemString(PySfStringType.tp_dict, "Regular", obj); + obj = PyLong_FromLong(sf::Text::Regular); + PyDict_SetItemString(PySfTextType.tp_dict, "Regular", obj); Py_DECREF(obj); - obj = PyLong_FromLong(sf::String::Bold); - PyDict_SetItemString(PySfStringType.tp_dict, "Bold", obj); + obj = PyLong_FromLong(sf::Text::Bold); + PyDict_SetItemString(PySfTextType.tp_dict, "Bold", obj); Py_DECREF(obj); - obj = PyLong_FromLong(sf::String::Italic); - PyDict_SetItemString(PySfStringType.tp_dict, "Italic", obj); + obj = PyLong_FromLong(sf::Text::Italic); + PyDict_SetItemString(PySfTextType.tp_dict, "Italic", obj); Py_DECREF(obj); - obj = PyLong_FromLong(sf::String::Underlined); - PyDict_SetItemString(PySfStringType.tp_dict, "Underlined", obj); + obj = PyLong_FromLong(sf::Text::Underlined); + PyDict_SetItemString(PySfTextType.tp_dict, "Underlined", obj); Py_DECREF(obj); } diff --git a/python/src/String.hpp b/python/src/Text.hpp similarity index 91% rename from python/src/String.hpp rename to python/src/Text.hpp index ef26c6a61..077f1ba04 100644 --- a/python/src/String.hpp +++ b/python/src/Text.hpp @@ -27,17 +27,17 @@ #include -#include +#include #include "Font.hpp" typedef struct { PyObject_HEAD bool IsCustom; - sf::String *obj; + sf::Text *obj; PySfFont *font; -} PySfString; +} PySfText; -void PySfString_InitConst(); +void PySfText_InitConst(); #endif diff --git a/python/src/View.cpp b/python/src/View.cpp index 39f045c2a..922c43469 100644 --- a/python/src/View.cpp +++ b/python/src/View.cpp @@ -69,32 +69,15 @@ PySfView_GetCenter(PySfView* self) } static PyObject * -PySfView_GetHalfSize(PySfView* self) -{ - sf::Vector2f Vect = self->obj->GetHalfSize(); - return Py_BuildValue("ff", Vect.x, Vect.y); -} - -static PyObject * -PySfView_GetRect(PySfView* self) -{ - PySfFloatRect *Rect = GetNewPySfFloatRect(); - Rect->Owner = false; - Rect->obj = (sf::FloatRect *) &(self->obj->GetRect()); - PySfFloatRectUpdateSelf(Rect); - return (PyObject *)Rect; -} - -static PyObject * -PySfView_SetFromRect(PySfView* self, PyObject *args) +PySfView_Reset(PySfView* self, PyObject *args) { PySfFloatRect *Rect = (PySfFloatRect *)args; if (!PyObject_TypeCheck(Rect, &PySfFloatRectType)) { - PyErr_SetString(PyExc_TypeError, "View.SetFromRect() Argument is not a sf.FloatRect instance"); + PyErr_SetString(PyExc_TypeError, "View.Reset() Argument is not a sf.FloatRect instance"); return NULL; } - self->obj->SetFromRect(*(Rect->obj)); + self->obj->Reset(*(Rect->obj)); Py_RETURN_NONE; } @@ -118,16 +101,6 @@ PySfView_SetCenter(PySfView* self, PyObject *args) Py_RETURN_NONE; } -static PyObject * -PySfView_SetHalfSize(PySfView* self, PyObject *args) -{ - float x, y; - if (!PyArg_ParseTuple(args, "ff:View.SetHalfSize", &x, &y) ) - return NULL; - self->obj->SetHalfSize(x, y); - Py_RETURN_NONE; -} - static PyObject * PySfView_Zoom(PySfView* self, PyObject *args) { @@ -137,14 +110,11 @@ PySfView_Zoom(PySfView* self, PyObject *args) static PyMethodDef PySfView_methods[] = { {"GetCenter", (PyCFunction)PySfView_GetCenter, METH_NOARGS, "GetCenter()\nGet the center of the view."}, - {"GetHalfSize", (PyCFunction)PySfView_GetHalfSize, METH_NOARGS, "GetHalfSize()\nGet the half-size of the view."}, - {"GetRect", (PyCFunction)PySfView_GetRect, METH_NOARGS, "GetRect()\nGet the bounding rectangle of the view."}, {"Move", (PyCFunction)PySfView_Move, METH_VARARGS, "Move(OffsetX, OffsetY)\nMove the view.\n\ OffsetX : Offset to move the view, on X axis\n\ OffsetY : Offset to move the view, on Y axis"}, - {"SetFromRect", (PyCFunction)PySfView_SetFromRect, METH_O, "SetFromRect(ViewRect)\nRebuild the view from a rectangle.\n ViewRect : Rectangle defining the position and size of the view."}, + {"Reset", (PyCFunction)PySfView_Reset, METH_O, "Reset(ViewRect)\nRebuild the view from a rectangle.\n ViewRect : Rectangle defining the position and size of the view."}, {"SetCenter", (PyCFunction)PySfView_SetCenter, METH_VARARGS, "SetCenter(X, Y)\nChange the center of the view."}, - {"SetHalfSize", (PyCFunction)PySfView_SetHalfSize, METH_VARARGS, "SetHalfSize(HalfWidth, HalfHeight)\nChange the half-size of the view."}, {"Zoom", (PyCFunction)PySfView_Zoom, METH_O, "Zoom(Factor)\nResize the view rectangle to simulate a zoom / unzoom effect."}, {NULL} /* Sentinel */ }; diff --git a/python/src/Window.cpp b/python/src/Window.cpp index 6e16e654c..221f382e4 100644 --- a/python/src/Window.cpp +++ b/python/src/Window.cpp @@ -27,7 +27,7 @@ #include "Event.hpp" #include "VideoMode.hpp" #include "Input.hpp" -#include "WindowSettings.hpp" +#include "ContextSettings.hpp" #include @@ -35,7 +35,7 @@ extern PyTypeObject PySfEventType; -extern PyTypeObject PySfWindowSettingsType; +extern PyTypeObject PySfContextSettingsType; extern PyTypeObject PySfVideoModeType; @@ -50,16 +50,16 @@ static PyObject * PySfWindow_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { long Handle; - PySfWindowSettings *Params=NULL; + PySfContextSettings *Params=NULL; PySfWindow *self; self = (PySfWindow *)type->tp_alloc(type, 0); if (self != NULL) { - if (PyArg_ParseTuple(args, "l|O!:Window.__new__", &Handle, &PySfWindowSettingsType, &Params)) + if (PyArg_ParseTuple(args, "l|O!:Window.__new__", &Handle, &PySfContextSettingsType, &Params)) { if (Params) { - PySfWindowSettingsUpdate(Params); + PySfContextSettingsUpdate(Params); self->obj = new sf::Window((sf::WindowHandle)Handle, *(Params->obj)); } else @@ -124,18 +124,18 @@ PySfWindow_Create(PySfWindow* self, PyObject *args, PyObject *kwds) sf::VideoMode *VideoMode; char *Title=NULL; unsigned long WindowStyle = sf::Style::Resize | sf::Style::Close; - PySfWindowSettings *Params=NULL; + PySfContextSettings *Params=NULL; const char *kwlist[] = {"VideoMode", "Title", "WindowStyle", "Params", NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!s|IO!:Window.Create", (char **)kwlist, &PySfVideoModeType, &VideoModeTmp, &Title, &WindowStyle, &PySfWindowSettingsType, &Params)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!s|IO!:Window.Create", (char **)kwlist, &PySfVideoModeType, &VideoModeTmp, &Title, &WindowStyle, &PySfContextSettingsType, &Params)) return NULL; VideoMode = ((PySfVideoMode *)VideoModeTmp)->obj; if (Params) { - PySfWindowSettingsUpdate(Params); + PySfContextSettingsUpdate(Params); self->obj->Create(*VideoMode, Title, WindowStyle, *(Params->obj)); } else @@ -148,11 +148,11 @@ static int PySfWindow_init(PySfWindow *self, PyObject *args, PyObject *kwds) { long Handle; - PySfWindowSettings *Params; + PySfContextSettings *Params; if (args != NULL) { - if (PyArg_ParseTuple(args, "l|O!:Window.__new__", &Handle, &PySfWindowSettingsType, &Params)) + if (PyArg_ParseTuple(args, "l|O!:Window.__new__", &Handle, &PySfContextSettingsType, &Params)) return 0; PyErr_Clear(); if (PySfWindow_Create(self, args, kwds) == NULL) @@ -225,9 +225,9 @@ PySfWindow_GetInput(PySfWindow *self) static PyObject * PySfWindow_GetSettings(PySfWindow *self) { - PySfWindowSettings *Settings; - Settings = GetNewPySfWindowSettings(); - Settings->obj = new sf::WindowSettings(self->obj->GetSettings()); + PySfContextSettings *Settings; + Settings = GetNewPySfContextSettings(); + Settings->obj = new sf::ContextSettings(self->obj->GetSettings()); Settings->DepthBits = Settings->obj->DepthBits; Settings->StencilBits = Settings->obj->StencilBits; Settings->AntialiasingLevel = Settings->obj->AntialiasingLevel; @@ -307,7 +307,7 @@ PySfWindow_SetIcon(PySfWindow* self, PyObject *args) static PyMethodDef PySfWindow_methods[] = { {"Close", (PyCFunction)PySfWindow_Close, METH_NOARGS, "Close()\nClose (destroy) the window. The sf.Window instance remains valid and you can call Create to recreate the window."}, - {"Create", (PyCFunction)PySfWindow_Create, METH_VARARGS | METH_KEYWORDS, "Create(Mode, Title, sf.Style.Resize | sf.Style.Close, Params = sf.WindowSettings())\n\ + {"Create", (PyCFunction)PySfWindow_Create, METH_VARARGS | METH_KEYWORDS, "Create(Mode, Title, sf.Style.Resize | sf.Style.Close, Params = sf.ContextSettings())\n\ Create a window.\n\ Mode : Video mode to use (sf.VideoMode instance)\n\ Title : Title of the window\n\ @@ -363,7 +363,7 @@ PyTypeObject PySfWindowType = { Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ "sf.Window is a rendering window ; it can create a new window or connect to an existing one.\n\ Default constructor : sf.Window()\n\ -Construct a new window : sf.Window(Mode, Title, sf.Style.Resize | sf.Style.Close, Params = sf.WindowSettings())\n\ +Construct a new window : sf.Window(Mode, Title, sf.Style.Resize | sf.Style.Close, Params = sf.ContextSettings())\n\ Mode : Video mode to use (sf.VideoMode instance)\n\ Title : Title of the window\n\ WindowStyle : Window style (Resize | Close by default)\n\ diff --git a/python/src/main.cpp b/python/src/main.cpp index a7547f042..8c5312847 100644 --- a/python/src/main.cpp +++ b/python/src/main.cpp @@ -30,9 +30,10 @@ #include "Event.hpp" #include "Mouse.hpp" #include "WindowStyle.hpp" +#include "ContextSettings.hpp" #include "Blend.hpp" #include "Sound.hpp" -#include "String.hpp" +#include "Text.hpp" #include "SoundStream.hpp" #include "compat.hpp" @@ -54,8 +55,8 @@ extern PyTypeObject PySfMouseType; extern PyTypeObject PySfVideoModeType; extern PyTypeObject PySfWindowType; -extern PyTypeObject PySfWindowSettingsType; extern PyTypeObject PySfStyleType; +extern PyTypeObject PySfContextSettingsType; extern PyTypeObject PySfRenderWindowType; extern PyTypeObject PySfViewType; extern PyTypeObject PySfInputType; @@ -65,8 +66,8 @@ extern PyTypeObject PySfBlendType; extern PyTypeObject PySfSpriteType; extern PyTypeObject PySfFontType; extern PyTypeObject PySfGlyphType; -extern PyTypeObject PySfStringType; -extern PyTypeObject PySfPostFXType; +extern PyTypeObject PySfTextType; +//extern PyTypeObject PySfPostFXType; extern PyTypeObject PySfImageType; extern PyTypeObject PySfColorType; @@ -119,10 +120,10 @@ initsf(void) if (PyType_Ready(&PySfWindowType) < 0) INITERROR; - if (PyType_Ready(&PySfWindowSettingsType) < 0) - INITERROR; if (PyType_Ready(&PySfStyleType) < 0) INITERROR; + if (PyType_Ready(&PySfContextSettingsType) < 0) + INITERROR; if (PyType_Ready(&PySfRenderWindowType) < 0) INITERROR; if (PyType_Ready(&PySfVideoModeType) < 0) @@ -167,10 +168,10 @@ initsf(void) INITERROR; if (PyType_Ready(&PySfGlyphType) < 0) INITERROR; - if (PyType_Ready(&PySfStringType) < 0) - INITERROR; - if (PyType_Ready(&PySfPostFXType) < 0) + if (PyType_Ready(&PySfTextType) < 0) INITERROR; + /*if (PyType_Ready(&PySfPostFXType) < 0) + INITERROR; */ if (PyType_Ready(&PySfImageType) < 0) INITERROR; @@ -215,10 +216,10 @@ initsf(void) Py_INCREF(&PySfWindowType); PyModule_AddObject(m, "Window", (PyObject *)&PySfWindowType); - Py_INCREF(&PySfWindowSettingsType); - PyModule_AddObject(m, "WindowSettings", (PyObject *)&PySfWindowSettingsType); Py_INCREF(&PySfStyleType); PyModule_AddObject(m, "Style", (PyObject *)&PySfStyleType); + Py_INCREF(&PySfContextSettingsType); + PyModule_AddObject(m, "ContextSettings", (PyObject *)&PySfContextSettingsType); Py_INCREF(&PySfRenderWindowType); PyModule_AddObject(m, "RenderWindow", (PyObject *)&PySfRenderWindowType); Py_INCREF(&PySfVideoModeType); @@ -238,10 +239,10 @@ initsf(void) PyModule_AddObject(m, "Font", (PyObject *)&PySfFontType); Py_INCREF(&PySfGlyphType); PyModule_AddObject(m, "Glyph", (PyObject *)&PySfGlyphType); - Py_INCREF(&PySfStringType); - PyModule_AddObject(m, "String", (PyObject *)&PySfStringType); - Py_INCREF(&PySfPostFXType); - PyModule_AddObject(m, "PostFX", (PyObject *)&PySfPostFXType); + Py_INCREF(&PySfTextType); + PyModule_AddObject(m, "Text", (PyObject *)&PySfTextType); + /*Py_INCREF(&PySfPostFXType); + PyModule_AddObject(m, "PostFX", (PyObject *)&PySfPostFXType); */ Py_INCREF(&PySfEventType); PyModule_AddObject(m, "Event", (PyObject *)&PySfEventType); @@ -292,7 +293,7 @@ initsf(void) PySfBlend_InitConst(); PySfSound_InitConst(); PySfSoundStream_InitConst(); - PySfString_InitConst(); + PySfText_InitConst(); PyEval_InitThreads();