41 lines
1.0 KiB
C
41 lines
1.0 KiB
C
|
#pragma once
|
||
|
#include "Common.h"
|
||
|
#include "Python.h"
|
||
|
|
||
|
class PyColor;
|
||
|
|
||
|
typedef struct {
|
||
|
sf::Color* target; // color target to set/get
|
||
|
std::weak_ptr<UIDrawable> parent; // lifetime management: parent must still exist
|
||
|
int index; // specific to the parent class, which color is it?
|
||
|
} _PyColorData;
|
||
|
|
||
|
typedef struct {
|
||
|
PyObject_HEAD
|
||
|
_PyColorData data;
|
||
|
} PyTextureObject;
|
||
|
|
||
|
class PyColor
|
||
|
{
|
||
|
private:
|
||
|
_PyColorData data;
|
||
|
public:
|
||
|
PyObject* pyObject();
|
||
|
static Py_hash_t hash(PyObject*);
|
||
|
static int init(PyColorObject*, PyObject*, PyObject*);
|
||
|
static PyObject* pynew(PyTypeObject* type, PyObject* args=NULL, PyObject* kwds=NULL);
|
||
|
};
|
||
|
|
||
|
namespace mcrfpydef {
|
||
|
static PyTypeObject PyColorType = {
|
||
|
.tp_name = "mcrfpy.Color",
|
||
|
.tp_basicsize = sizeof(PyColorObject),
|
||
|
.tp_itemsize = 0,
|
||
|
.tp_hash = PyColor::hash,
|
||
|
.tp_flags = Py_TPFLAGS_DEFAULT,
|
||
|
.tp_doc = PyDoc_STR("SFML Color Object"),
|
||
|
.tp_init = (initproc)PyColor::init,
|
||
|
.tp_new = PyTColor::pynew,
|
||
|
};
|
||
|
}
|