Improved the way rectangle are handled;
Some bug fixes. git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1093 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
caf7f915d5
commit
60e14e75b7
14 changed files with 145 additions and 115 deletions
|
@ -23,7 +23,6 @@
|
|||
////////////////////////////////////////////////////////////
|
||||
|
||||
#include "View.hpp"
|
||||
#include "Rect.hpp"
|
||||
|
||||
#include "offsetof.hpp"
|
||||
#include "compat.hpp"
|
||||
|
@ -49,26 +48,19 @@ PySfView_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
if (self != NULL)
|
||||
{
|
||||
self->Owner = true;
|
||||
PySfFloatRect *Rect = NULL;
|
||||
if (!PyArg_ParseTuple(args, "|O!:View.__new__", &PySfFloatRectType, &Rect))
|
||||
return NULL;
|
||||
|
||||
if (Rect != NULL)
|
||||
self->obj = new sf::View( (const sf::FloatRect) *(Rect->obj));
|
||||
else
|
||||
self->obj = new sf::View();
|
||||
}
|
||||
|
||||
return (PyObject *)self;
|
||||
}
|
||||
|
||||
static int
|
||||
PySfView_init(PySfView *self, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
PySfFloatRect *Rect=NULL;
|
||||
if (!PyArg_ParseTuple(args, "|O!:View.__init__", &PySfFloatRectType, &Rect))
|
||||
return -1;
|
||||
|
||||
if (Rect != NULL)
|
||||
self->obj = new sf::View( (const sf::FloatRect) *(Rect->obj));
|
||||
else
|
||||
self->obj = new sf::View();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
PySfView_GetCenter(PySfView* self)
|
||||
{
|
||||
|
@ -87,11 +79,9 @@ static PyObject *
|
|||
PySfView_GetRect(PySfView* self)
|
||||
{
|
||||
PySfFloatRect *Rect = GetNewPySfFloatRect();
|
||||
Rect->obj = new sf::FloatRect(self->obj->GetRect());
|
||||
Rect->Left = Rect->obj->Left;
|
||||
Rect->Right = Rect->obj->Right;
|
||||
Rect->Top = Rect->obj->Top;
|
||||
Rect->Bottom = Rect->obj->Bottom;
|
||||
Rect->Owner = false;
|
||||
Rect->obj = (sf::FloatRect *) &(self->obj->GetRect());
|
||||
PySfFloatRectUpdateSelf(Rect);
|
||||
return (PyObject *)Rect;
|
||||
}
|
||||
|
||||
|
@ -181,7 +171,7 @@ PyTypeObject PySfViewType = {
|
|||
0, /* tp_descr_get */
|
||||
0, /* tp_descr_set */
|
||||
0, /* tp_dictoffset */
|
||||
(initproc)PySfView_init, /* tp_init */
|
||||
0, /* tp_init */
|
||||
0, /* tp_alloc */
|
||||
PySfView_new, /* tp_new */
|
||||
};
|
||||
|
@ -189,6 +179,6 @@ PyTypeObject PySfViewType = {
|
|||
PySfView *
|
||||
GetNewPySfView()
|
||||
{
|
||||
return (PySfView *)PySfView_new(&PySfViewType, NULL, NULL);
|
||||
return PyObject_New(PySfView, &PySfViewType);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue