From 494658e5c3759d58f5a719dc2525b7e107cd722c Mon Sep 17 00:00:00 2001 From: John McCardle Date: Fri, 15 Sep 2023 22:09:29 -0400 Subject: [PATCH] Sprite fixes. Changing sprite_number now changes the visible texture. Repr fixed. --- src/UI.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/UI.h b/src/UI.h index 34ee63e..b29e5c2 100644 --- a/src/UI.h +++ b/src/UI.h @@ -156,10 +156,10 @@ switch (target->derived_type()) \ } \ case PyObjectsEnum::UISPRITE: \ { \ - PyUIFrameObject* o = (PyUIFrameObject*)((&PyUIFrameType)->tp_alloc(&PyUIFrameType, 0)); \ + PyUISpriteObject* o = (PyUISpriteObject*)((&PyUISpriteType)->tp_alloc(&PyUISpriteType, 0)); \ if (o) \ { \ - auto p = std::static_pointer_cast(target); \ + auto p = std::static_pointer_cast(target); \ o->data = p; \ auto utarget = o->data; \ } \ @@ -967,7 +967,7 @@ switch (target->derived_type()) \ static PyObject* PyUISprite_get_int_member(PyUISpriteObject* self, void* closure) { auto member_ptr = reinterpret_cast(closure); - if (false) {} + if (true) {} else { PyErr_SetString(PyExc_AttributeError, "Invalid attribute"); @@ -992,6 +992,7 @@ switch (target->derived_type()) \ return -1; } self->data->sprite_index = val; + self->data->sprite.setTextureRect(self->data->itex->spriteCoordinates(val)); return 0; } @@ -1021,8 +1022,8 @@ switch (target->derived_type()) \ else { auto sprite = self->data->sprite; ss << "