Squashed commit of the following: [reprs_and_member_names]
Closes #22 Closes #23 Closes #24 Closes #25 Closes #31 Closes #56 commit43fac8f4f3Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 20 18:32:52 2024 -0400 Typo in UIFrame repr commit3fd5ad93e2Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 20 18:32:30 2024 -0400 Add UIGridPoint and UIGridPointState repr commit03376897b8Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 20 18:32:17 2024 -0400 Add UIGrid repr commit48af072a33Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 20 18:32:05 2024 -0400 Add UIEntity repr
This commit is contained in:
parent
c2de9b08d6
commit
232105a893
7 changed files with 76 additions and 5 deletions
|
|
@ -163,3 +163,15 @@ 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");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue