Compare commits
	
		
			No commits in common. "43fac8f4f37bb3d6aaeaa9e4f870e673b1133fb1" and "c2de9b08d6095f31611945253430fcada5e3a3e5" have entirely different histories.
		
	
	
		
			43fac8f4f3
			...
			c2de9b08d6
		
	
		|  | @ -163,15 +163,3 @@ PyGetSetDef UIEntity::getsetters[] = { | |||
|     {"sprite_number", (getter)UIEntity::get_spritenumber, (setter)UIEntity::set_spritenumber, "Sprite number (index) on the texture on the display", NULL}, | ||||
|     {NULL}  /* Sentinel */ | ||||
| }; | ||||
| 
 | ||||
| PyObject* UIEntity::repr(PyUIEntityObject* self) { | ||||
|     std::ostringstream ss; | ||||
|     if (!self->data) ss << "<Entity (invalid internal object)>"; | ||||
|     else { | ||||
|         auto ent = self->data; | ||||
|         ss << "<Entity (x=" << self->data->position.x << ", y=" << self->data->position.y << ", sprite_number=" << self->data->sprite.getSpriteIndex() << | ||||
|          ")>"; | ||||
|     } | ||||
|     std::string repr_str = ss.str(); | ||||
|     return PyUnicode_DecodeUTF8(repr_str.c_str(), repr_str.size(), "replace"); | ||||
| } | ||||
|  |  | |||
|  | @ -55,7 +55,6 @@ public: | |||
|     static int set_spritenumber(PyUIEntityObject* self, PyObject* value, void* closure); | ||||
|     static PyMethodDef methods[]; | ||||
|     static PyGetSetDef getsetters[]; | ||||
|     static PyObject* repr(PyUIEntityObject* self); | ||||
| }; | ||||
| 
 | ||||
| namespace mcrfpydef { | ||||
|  | @ -64,7 +63,7 @@ namespace mcrfpydef { | |||
|         .tp_name = "mcrfpy.Entity", | ||||
|         .tp_basicsize = sizeof(PyUIEntityObject), | ||||
|         .tp_itemsize = 0, | ||||
|         .tp_repr = (reprfunc)UIEntity::repr, | ||||
|         // Methods omitted for brevity
 | ||||
|         .tp_flags = Py_TPFLAGS_DEFAULT, | ||||
|         .tp_doc = "UIEntity objects", | ||||
|         .tp_methods = UIEntity::methods, | ||||
|  |  | |||
|  | @ -225,7 +225,7 @@ PyObject* UIFrame::repr(PyUIFrameObject* self) | |||
|         auto box = self->data->box; | ||||
|         auto fc = box.getFillColor(); | ||||
|         auto oc = box.getOutlineColor(); | ||||
|         ss << "<Frame (x=" << box.getPosition().x << ", y=" << box.getPosition().y << ", w=" <<  | ||||
|         ss << "<Frame (x=" << box.getPosition().x << ", y=" << box.getPosition().y << ", x=" <<  | ||||
|             box.getSize().x << ", w=" << box.getSize().y << ", " << | ||||
|             "outline=" << box.getOutlineThickness() << ", " <<  | ||||
|             "fill_color=(" << (int)fc.r << ", " << (int)fc.g << ", " << (int)fc.b << ", " << (int)fc.a <<"), " << | ||||
|  |  | |||
|  | @ -421,37 +421,6 @@ PyObject* UIGrid::get_children(PyUIGridObject* self, void* closure) | |||
|     return (PyObject*)o; | ||||
| } | ||||
| 
 | ||||
| PyObject* UIGrid::repr(PyUIGridObject* self) | ||||
| { | ||||
| 
 | ||||
| //    if (member_ptr == 0) // x
 | ||||
| //        self->data->box.setPosition(val, self->data->box.getPosition().y);
 | ||||
| //    else if (member_ptr == 1) // y
 | ||||
| //        self->data->box.setPosition(self->data->box.getPosition().x, val);
 | ||||
| //    else if (member_ptr == 2) // w
 | ||||
| //        self->data->box.setSize(sf::Vector2f(val, self->data->box.getSize().y));
 | ||||
| //    else if (member_ptr == 3) // h
 | ||||
| //        self->data->box.setSize(sf::Vector2f(self->data->box.getSize().x, val));
 | ||||
| //    else if (member_ptr == 4) // center_x
 | ||||
| //        self->data->center_x = val;
 | ||||
| //    else if (member_ptr == 5) // center_y
 | ||||
| //        self->data->center_y = val;
 | ||||
| //    else if (member_ptr == 6) // zoom
 | ||||
| //        self->data->zoom = val;
 | ||||
| 
 | ||||
|     std::ostringstream ss; | ||||
|     if (!self->data) ss << "<Grid (invalid internal object)>"; | ||||
|     else { | ||||
|         auto grid = self->data; | ||||
|         auto box = grid->box; | ||||
|         ss << "<Grid (x=" << box.getPosition().x << ", y=" << box.getPosition().y << ", w=" << box.getSize().x << ", h=" << box.getSize().y << ", " << | ||||
|             "center=(" << grid->center_x << ", " << grid->center_y << "), zoom=" << grid->zoom << | ||||
|             ")>"; | ||||
|     } | ||||
|     std::string repr_str = ss.str(); | ||||
|     return PyUnicode_DecodeUTF8(repr_str.c_str(), repr_str.size(), "replace"); | ||||
| } | ||||
| 
 | ||||
| /* // TODO standard pointer would need deleted, but I opted for a shared pointer. tp_dealloc currently not even defined in the PyTypeObject
 | ||||
| void PyUIGrid_dealloc(PyUIGridObject* self) { | ||||
|     delete self->data; // Clean up the allocated UIGrid object
 | ||||
|  |  | |||
|  | @ -58,7 +58,6 @@ public: | |||
|     static PyMethodDef methods[]; | ||||
|     static PyGetSetDef getsetters[]; | ||||
|     static PyObject* get_children(PyUIGridObject* self, void* closure); | ||||
|     static PyObject* repr(PyUIGridObject* self); | ||||
|      | ||||
| }; | ||||
| 
 | ||||
|  | @ -110,7 +109,7 @@ namespace mcrfpydef { | |||
|         //    Py_TYPE(self)->tp_free(self);
 | ||||
|         //},
 | ||||
|         //TODO - PyUIGrid REPR def:
 | ||||
|         .tp_repr = (reprfunc)UIGrid::repr, | ||||
|         // .tp_repr = (reprfunc)UIGrid::repr,
 | ||||
|         //.tp_hash = NULL,
 | ||||
|         //.tp_iter
 | ||||
|         //.tp_iternext
 | ||||
|  |  | |||
|  | @ -98,19 +98,6 @@ PyGetSetDef UIGridPoint::getsetters[] = { | |||
|     {NULL}  /* Sentinel */ | ||||
| }; | ||||
| 
 | ||||
| PyObject* UIGridPoint::repr(PyUIGridPointObject* self) { | ||||
|     std::ostringstream ss; | ||||
|     if (!self->data) ss << "<GridPoint (invalid internal object)>"; | ||||
|     else { | ||||
|         auto gp = self->data; | ||||
|         ss << "<GridPoint (walkable=" << (gp->walkable ? "True" : "False") << ", transparent=" << (gp->transparent ? "True" : "False") <<  | ||||
|               ", tilesprite=" << gp->tilesprite << ", tile_overlay=" << gp->tile_overlay << ", uisprite=" << gp->uisprite << | ||||
|         ")>"; | ||||
|     } | ||||
|     std::string repr_str = ss.str(); | ||||
|     return PyUnicode_DecodeUTF8(repr_str.c_str(), repr_str.size(), "replace"); | ||||
| } | ||||
| 
 | ||||
| PyObject* UIGridPointState::get_bool_member(PyUIGridPointStateObject* self, void* closure) { | ||||
|     if (reinterpret_cast<long>(closure) == 0) { // visible
 | ||||
|         return PyBool_FromLong(self->data->visible); | ||||
|  | @ -145,14 +132,3 @@ PyGetSetDef UIGridPointState::getsetters[] = { | |||
|     {NULL}  /* Sentinel */ | ||||
| }; | ||||
| 
 | ||||
| PyObject* UIGridPointState::repr(PyUIGridPointStateObject* self) { | ||||
|     std::ostringstream ss; | ||||
|     if (!self->data) ss << "<GridPointState (invalid internal object)>"; | ||||
|     else { | ||||
|         auto gps = self->data; | ||||
|         ss << "<GridPointState (visible=" << (gps->visible ? "True" : "False") << ", discovered=" << (gps->discovered ? "True" : "False") <<  | ||||
|         ")>"; | ||||
|     } | ||||
|     std::string repr_str = ss.str(); | ||||
|     return PyUnicode_DecodeUTF8(repr_str.c_str(), repr_str.size(), "replace"); | ||||
| } | ||||
|  |  | |||
|  | @ -49,7 +49,6 @@ public: | |||
|     static int set_bool_member(PyUIGridPointObject* self, PyObject* value, void* closure); | ||||
|     static PyObject* get_bool_member(PyUIGridPointObject* self, void* closure); | ||||
|     static int set_color(PyUIGridPointObject* self, PyObject* value, void* closure); | ||||
|     static PyObject* repr(PyUIGridPointObject* self); | ||||
| }; | ||||
| 
 | ||||
| // UIGridPointState - entity-specific info for each cell
 | ||||
|  | @ -61,7 +60,6 @@ public: | |||
|     static PyObject* get_bool_member(PyUIGridPointStateObject* self, void* closure); | ||||
|     static int set_bool_member(PyUIGridPointStateObject* self, PyObject* value, void* closure); | ||||
|     static PyGetSetDef getsetters[]; | ||||
|     static PyObject* repr(PyUIGridPointStateObject* self); | ||||
| }; | ||||
| 
 | ||||
| namespace mcrfpydef { | ||||
|  | @ -70,7 +68,7 @@ namespace mcrfpydef { | |||
|         .tp_name = "mcrfpy.GridPoint", | ||||
|         .tp_basicsize = sizeof(PyUIGridPointObject), | ||||
|         .tp_itemsize = 0, | ||||
|         .tp_repr = (reprfunc)UIGridPoint::repr, | ||||
|         // Methods omitted for brevity
 | ||||
|         .tp_flags = Py_TPFLAGS_DEFAULT, | ||||
|         .tp_doc = "UIGridPoint object", | ||||
|         .tp_getset = UIGridPoint::getsetters, | ||||
|  | @ -83,7 +81,7 @@ namespace mcrfpydef { | |||
|         .tp_name = "mcrfpy.GridPointState", | ||||
|         .tp_basicsize = sizeof(PyUIGridPointStateObject), | ||||
|         .tp_itemsize = 0, | ||||
|         .tp_repr = (reprfunc)UIGridPointState::repr, | ||||
|         // Methods omitted for brevity
 | ||||
|         .tp_flags = Py_TPFLAGS_DEFAULT, | ||||
|         .tp_doc = "UIGridPointState object", // TODO: Add PyUIGridPointState tp_init
 | ||||
|         .tp_getset = UIGridPointState::getsetters, | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue