Squashed commit of the following: [standardize_vector_handling]
closes #13 Deferring class standardization for the UI.h overhaul. commit5edebdd643Author: John McCardle <mccardle.john@gmail.com> Date: Sun Mar 31 14:21:07 2024 -0400 PyVector init should be pretty reliable now commitc13e185289Author: John McCardle <mccardle.john@gmail.com> Date: Sun Mar 31 13:51:29 2024 -0400 PyColor fix - Init corrections commit8871f6be6eAuthor: John McCardle <mccardle.john@gmail.com> Date: Sat Mar 30 22:51:55 2024 -0400 Parse arguments: no args & Vector object args work, tuples and bare numerics still do not commit1c12e8719cAuthor: John McCardle <mccardle.john@gmail.com> Date: Sat Mar 30 22:32:28 2024 -0400 Not bad for a quick first salvo, but I cannot figure out why init isn't cooperating.
This commit is contained in:
parent
f82508b753
commit
fbf263a038
5 changed files with 201 additions and 50 deletions
13
src/UI.h
13
src/UI.h
|
|
@ -12,6 +12,7 @@
|
|||
#include "PyTexture.h"
|
||||
#include "PyColor.h"
|
||||
//#include "PyLinkedColor.h"
|
||||
#include "PyVector.h"
|
||||
|
||||
enum PyObjectsEnum : int
|
||||
{
|
||||
|
|
@ -587,6 +588,17 @@ static int PyUIDrawable_set_click(PyUIGridObject* self, PyObject* value, void* c
|
|||
return 0;
|
||||
}
|
||||
|
||||
static PyObject* PyUICaption_get_vec_member(PyUICaptionObject* self, void* closure)
|
||||
{
|
||||
return PyVector(self->data->text.getPosition()).pyObject();
|
||||
}
|
||||
|
||||
static int PyUICaption_set_vec_member(PyUICaptionObject* self, PyObject* value, void* closure)
|
||||
{
|
||||
self->data->text.setPosition(PyVector::fromPy(value));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyObject* PyUICaption_get_color_member(PyUICaptionObject* self, void* closure)
|
||||
{
|
||||
// validate closure (should be impossible to be wrong, but it's thorough)
|
||||
|
|
@ -730,6 +742,7 @@ static int PyUIDrawable_set_click(PyUIGridObject* self, PyObject* value, void* c
|
|||
static PyGetSetDef PyUICaption_getsetters[] = {
|
||||
{"x", (getter)PyUICaption_get_float_member, (setter)PyUICaption_set_float_member, "X coordinate of top-left corner", (void*)0},
|
||||
{"y", (getter)PyUICaption_get_float_member, (setter)PyUICaption_set_float_member, "Y coordinate of top-left corner", (void*)1},
|
||||
{"pos", (getter)PyUICaption_get_vec_member, (setter)PyUICaption_set_vec_member, "(x, y) vector", (void*)0},
|
||||
//{"w", (getter)PyUIFrame_get_float_member, (setter)PyUIFrame_set_float_member, "width of the rectangle", (void*)2},
|
||||
//{"h", (getter)PyUIFrame_get_float_member, (setter)PyUIFrame_set_float_member, "height of the rectangle", (void*)3},
|
||||
{"outline", (getter)PyUICaption_get_float_member, (setter)PyUICaption_set_float_member, "Thickness of the border", (void*)4},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue