feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe: - Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption - Initialize all members to predictable values - Made Python init functions accept no arguments - Added x,y properties to UIEntity Closes #71 - Create _Drawable Python base class: - Created PyDrawable.h/cpp with base type (not yet inherited by UI types) - Registered in module initialization Closes #87 - Add visible property: - Added bool visible=true to UIDrawable base class - All render methods check visibility before drawing Closes #88 - Add opacity property: - Added float opacity=1.0 to UIDrawable base class - UICaption and UISprite apply opacity to alpha channel Closes #89 - Add get_bounds() method: - Virtual method returns sf::FloatRect(x,y,w,h) - Implemented in Frame, Caption, Sprite, Grid Closes #98 - Add move() and resize() methods: - move(dx,dy) for relative movement - resize(w,h) for absolute sizing - Caption resize is no-op (size controlled by font) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
a88ce0e259
commit
f1b354e47d
15 changed files with 531 additions and 161 deletions
15
src/PyDrawable.h
Normal file
15
src/PyDrawable.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#pragma once
|
||||
#include "Common.h"
|
||||
#include "Python.h"
|
||||
#include "UIDrawable.h"
|
||||
|
||||
// Python object structure for UIDrawable base class
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
std::shared_ptr<UIDrawable> data;
|
||||
} PyDrawableObject;
|
||||
|
||||
// Declare the Python type for _Drawable base class
|
||||
namespace mcrfpydef {
|
||||
extern PyTypeObject PyDrawableType;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue