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
|
@ -42,17 +42,13 @@ PySfFont_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
PySfFont *self;
|
||||
self = (PySfFont *)type->tp_alloc(type, 0);
|
||||
if (self != NULL)
|
||||
{
|
||||
self->Owner = true;
|
||||
self->obj = new sf::Font();
|
||||
}
|
||||
return (PyObject *)self;
|
||||
}
|
||||
|
||||
static int
|
||||
PySfFont_init(PySfFont *self, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
self->obj = new sf::Font();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
PySfFont_LoadFromFile(PySfFont* self, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
|
@ -238,7 +234,7 @@ PyTypeObject PySfFontType = {
|
|||
0, /* tp_descr_get */
|
||||
0, /* tp_descr_set */
|
||||
0, /* tp_dictoffset */
|
||||
(initproc)PySfFont_init, /* tp_init */
|
||||
0, /* tp_init */
|
||||
0, /* tp_alloc */
|
||||
PySfFont_new, /* tp_new */
|
||||
};
|
||||
|
@ -246,7 +242,7 @@ PyTypeObject PySfFontType = {
|
|||
PySfFont *
|
||||
GetNewPySfFont()
|
||||
{
|
||||
return (PySfFont *)PySfFont_new(&PySfFontType, NULL, NULL);
|
||||
return PyObject_New(PySfFont, &PySfFontType);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue