Split __init__ into __init__ and __new__, code clean up
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1056 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
15ba8f9b3c
commit
d4e7e7724f
30 changed files with 305 additions and 542 deletions
|
@ -91,21 +91,13 @@ PySfGlyph_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
self->Advance = 0;
|
||||
self->Rectangle = GetNewPySfIntRect();
|
||||
self->TexCoords = GetNewPySfFloatRect();
|
||||
self->obj = new sf::Glyph();
|
||||
self->Rectangle->obj = &(self->obj->Rectangle);
|
||||
self->TexCoords->obj = &(self->obj->TexCoords);
|
||||
}
|
||||
return (PyObject *)self;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
PySfGlyph_init(PySfGlyph *self, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
self->obj = new sf::Glyph();
|
||||
self->Rectangle->obj = &(self->obj->Rectangle);
|
||||
self->TexCoords->obj = &(self->obj->TexCoords);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
PyTypeObject PySfGlyphType = {
|
||||
head_init
|
||||
"Glyph", /*tp_name*/
|
||||
|
@ -142,7 +134,7 @@ PyTypeObject PySfGlyphType = {
|
|||
0, /* tp_descr_get */
|
||||
0, /* tp_descr_set */
|
||||
0, /* tp_dictoffset */
|
||||
(initproc)PySfGlyph_init, /* tp_init */
|
||||
0, /* tp_init */
|
||||
0, /* tp_alloc */
|
||||
PySfGlyph_new, /* tp_new */
|
||||
};
|
||||
|
@ -150,6 +142,6 @@ PyTypeObject PySfGlyphType = {
|
|||
PySfGlyph *
|
||||
GetNewPySfGlyph()
|
||||
{
|
||||
return (PySfGlyph *)PySfGlyph_new(&PySfGlyphType, NULL, NULL);
|
||||
return PyObject_New(PySfGlyph, &PySfGlyphType);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue