Standardize Vector Handling #13

Closed
opened 2024-03-09 18:34:17 +00:00 by john · 3 comments
Owner

notes say:
17 feat: standardize vector handling: 2-tuple or 2 member lists, any mix of ints or floats; or (new) Vector object [depend on SFML module feature]

This issue is for a single method to take a PyObject* of any of the above and return a mcrfpy.Vector2 (or sfml::Vector2f wrapper, if possible)

Once the method is available, every widget that uses vectors (Frame, Caption, Sprite, Grid) needs to use the standardized method.

notes say: 17 feat: standardize vector handling: 2-tuple or 2 member lists, any mix of ints or floats; or (new) Vector object \[depend on SFML module feature] This issue is for a single method to take a PyObject* of any of the above and return a mcrfpy.Vector2 (or sfml::Vector2f wrapper, if possible) Once the method is available, every widget that uses vectors (Frame, Caption, Sprite, Grid) needs to use the standardized method.
john added the
Alpha Release Requirement
Refactoring & Cleanup
Bugfix
Major Feature
labels 2024-03-09 18:34:17 +00:00
john added this to the All Datatypes Behaving milestone 2024-03-13 12:59:20 +00:00
john added this to the The Datatype Overhaul project 2024-03-13 13:06:39 +00:00
Author
Owner

Goal: Speed. Copy PyColor for the structure of this object.

Goal: **Speed**. Copy `PyColor` for the structure of this object.
john started working 2024-03-31 02:04:18 +00:00
Author
Owner

1c12e8719c
Gotta go fast - got it to build, got an example position from a UIDrawable.

Can't figure out why my init func isn't working, which means the mcrfpy.Color init function is probably undertested.

1c12e8719c1ed8002c80ee744178f8278e2c7e8c Gotta go fast - got it to build, got an example position from a UIDrawable. Can't figure out why my init func isn't working, which means the mcrfpy.Color init function is probably undertested.
john stopped working 2024-03-31 02:33:30 +00:00
29 minutes 12 seconds
Author
Owner

Coding sporadically over the morning & afternoon; made some commits before errands.

This issue will now be closed. Here's the salient portion:

    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;
    }

There is more work to do in the init methods of the UIDrawables, but the intention with the tuple versions of Vector and Color means that the argument should just be passed to PyVector's / PyColor's constructor. If it fails, then UIDrawable init should also fail.

That refactor belongs to the UI.h breakup story, #43.

Coding sporadically over the morning & afternoon; made some commits before errands. This issue will now be closed. Here's the salient portion: ```c++ 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; } ``` There is more work to do in the init methods of the UIDrawables, but the intention with the tuple versions of Vector and Color means that the argument should just be passed to PyVector's / PyColor's constructor. If it fails, then UIDrawable init should also fail. That refactor belongs to the UI.h breakup story, #43.
john closed this issue 2024-03-31 22:00:55 +00:00
john added spent time 2024-03-31 22:01:06 +00:00
45 minutes
Sign in to join this conversation.
No Assignees
1 Participants
Notifications
Total Time Spent: 1 hour 14 minutes
john
1 hour 14 minutes
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: john/McRogueFace#13
No description provided.