More code clean-up and python3 compliance
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1022 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
79bf5c6252
commit
af3dd7c630
40 changed files with 364 additions and 714 deletions
|
@ -22,62 +22,26 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#include <SFML/Window/Event.hpp>
|
||||
|
||||
#include <Python.h>
|
||||
#include <structmember.h>
|
||||
|
||||
#include "Mouse.hpp"
|
||||
|
||||
#include "compat.hpp"
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
} PySfMouse;
|
||||
|
||||
|
||||
|
||||
static PyMemberDef PySfMouse_members[] = {
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
PySfMouse_dealloc(PySfMouse *self)
|
||||
{
|
||||
self->ob_type->tp_free((PyObject*)self);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
PySfMouse_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
PySfMouse *self;
|
||||
|
||||
self = (PySfMouse *)type->tp_alloc(type, 0);
|
||||
if (self != NULL)
|
||||
{
|
||||
}
|
||||
|
||||
return (PyObject *)self;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
PySfMouse_init(PySfMouse *self, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyMethodDef PySfMouse_methods[] = {
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
PyTypeObject PySfMouseType = {
|
||||
PyObject_HEAD_INIT(NULL)
|
||||
0, /*ob_size*/
|
||||
head_init
|
||||
"Mouse", /*tp_name*/
|
||||
sizeof(PySfMouse), /*tp_basicsize*/
|
||||
0, /*tp_itemsize*/
|
||||
(destructor)PySfMouse_dealloc, /*tp_dealloc*/
|
||||
0, /*tp_dealloc*/
|
||||
0, /*tp_print*/
|
||||
0, /*tp_getattr*/
|
||||
0, /*tp_setattr*/
|
||||
|
@ -100,15 +64,15 @@ PyTypeObject PySfMouseType = {
|
|||
0, /* tp_weaklistoffset */
|
||||
0, /* tp_iter */
|
||||
0, /* tp_iternext */
|
||||
PySfMouse_methods, /* tp_methods */
|
||||
PySfMouse_members, /* tp_members */
|
||||
0, /* 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 */
|
||||
(initproc)PySfMouse_init, /* tp_init */
|
||||
0, /* tp_init */
|
||||
0, /* tp_alloc */
|
||||
PySfMouse_new, /* tp_new */
|
||||
};
|
||||
|
@ -116,19 +80,19 @@ PyTypeObject PySfMouseType = {
|
|||
void PySfMouse_InitConst()
|
||||
{
|
||||
PyObject *obj;
|
||||
obj = PyInt_FromLong(sf::Mouse::Left);
|
||||
obj = PyLong_FromLong(sf::Mouse::Left);
|
||||
PyDict_SetItemString(PySfMouseType.tp_dict, "Left", obj);
|
||||
Py_DECREF(obj);
|
||||
obj = PyInt_FromLong(sf::Mouse::Right);
|
||||
obj = PyLong_FromLong(sf::Mouse::Right);
|
||||
PyDict_SetItemString(PySfMouseType.tp_dict, "Right", obj);
|
||||
Py_DECREF(obj);
|
||||
obj = PyInt_FromLong(sf::Mouse::Middle);
|
||||
obj = PyLong_FromLong(sf::Mouse::Middle);
|
||||
PyDict_SetItemString(PySfMouseType.tp_dict, "Middle", obj);
|
||||
Py_DECREF(obj);
|
||||
obj = PyInt_FromLong(sf::Mouse::XButton1);
|
||||
obj = PyLong_FromLong(sf::Mouse::XButton1);
|
||||
PyDict_SetItemString(PySfMouseType.tp_dict, "XButton1", obj);
|
||||
Py_DECREF(obj);
|
||||
obj = PyInt_FromLong(sf::Mouse::XButton2);
|
||||
obj = PyLong_FromLong(sf::Mouse::XButton2);
|
||||
PyDict_SetItemString(PySfMouseType.tp_dict, "XButton2", obj);
|
||||
Py_DECREF(obj);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue