feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88) - Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98) - Create UIDrawable_methods.h with template implementations - Fix test termination issues - all tests now exit properly - Fix test_sprite_texture_swap.py click handler signature - Fix test_drawable_base.py segfault in headless mode - Convert audio objects to pointers for cleanup (OpenAL warning persists) - Remove debug print statements from UICaption - Special handling for UIEntity to delegate drawable methods to sprite All test files are now "airtight" - they complete successfully, terminate on their own, and handle edge cases properly. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
cc9b5c8f88
commit
ee6550bf63
15 changed files with 380 additions and 35 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#include "GameEngine.h"
|
||||
#include "PyVector.h"
|
||||
#include "PyPositionHelper.h"
|
||||
#include "UIDrawable_methods.h"
|
||||
|
||||
UIDrawable* UISprite::click_at(sf::Vector2f point)
|
||||
{
|
||||
|
|
@ -267,6 +268,15 @@ int UISprite::set_pos(PyUISpriteObject* self, PyObject* value, void* closure)
|
|||
return 0;
|
||||
}
|
||||
|
||||
// Define the PyObjectType alias for the macros
|
||||
typedef PyUISpriteObject PyObjectType;
|
||||
|
||||
// Method definitions
|
||||
PyMethodDef UISprite_methods[] = {
|
||||
UIDRAWABLE_METHODS,
|
||||
{NULL} // Sentinel
|
||||
};
|
||||
|
||||
PyGetSetDef UISprite::getsetters[] = {
|
||||
{"x", (getter)UISprite::get_float_member, (setter)UISprite::set_float_member, "X coordinate of top-left corner", (void*)0},
|
||||
{"y", (getter)UISprite::get_float_member, (setter)UISprite::set_float_member, "Y coordinate of top-left corner", (void*)1},
|
||||
|
|
@ -279,6 +289,7 @@ PyGetSetDef UISprite::getsetters[] = {
|
|||
{"click", (getter)UIDrawable::get_click, (setter)UIDrawable::set_click, "Object called with (x, y, button) when clicked", (void*)PyObjectsEnum::UISPRITE},
|
||||
{"z_index", (getter)UIDrawable::get_int, (setter)UIDrawable::set_int, "Z-order for rendering (lower values rendered first)", (void*)PyObjectsEnum::UISPRITE},
|
||||
{"pos", (getter)UISprite::get_pos, (setter)UISprite::set_pos, "Position as a Vector", NULL},
|
||||
UIDRAWABLE_GETSETTERS,
|
||||
{NULL}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue