Reviewing Getter and Setter
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 20/100
Research direction
No files or tests are named. Start by reviewing the current wrapper APIs and getter/setter macros for Image, Texture, Model, and AutomationEventList, then determine whether ownership, dependent fields, spans, and public members have an agreed design; done requires a specific, accepted scope rather than the alternatives listed here.
Written by the indexing model from the issue text.
Description
While rewriting the code for my own proposes, I encounter that everything can be get and set, at first this not bad, but doesn't make always sense, for example: all the owning pointers or resources with depending member like width and height in Image.
Maybe we can prevent the user from setting depended members or changing pointer to leak memory/ownership.
What happens when someone tempers with SetMaterialCount in Model but didn't update Materials.
For example, Image:
CONST_GETTER(void*, Data, data)
GETTER(int, Width, width)
GETTER(int, Height, height)
GETTER(int, Mipmaps, mipmaps)
GETTER(int, Format, format)
So the Image can only been loaded or manipulated with operations like Format.
Not sure about something like Texture, is resetting the id ok (?) Only set the id via Load or from ::Texture (?)
There is also the possibility for using something like std::span for arrays.
/// Model
GETTERSETTER(int, MeshCount, meshCount)
GETTERSETTER(int, MaterialCount, materialCount)
SPAN_GETTER(::Mesh, Meshes, meshes, meshCount)
SPAN_GETTER(::Material, Materials, materials, materialCount) ///< std::span{materials, materialCount}
/// AutomationEventList
GETTERSETTER(unsigned int, Capacity, capacity)
GETTERSETTER(unsigned int, Count, count)
SPAN_GETTER(AutomationEvent, Events, events, capacity)
While the classes still can been converted to (C) raylib structs and "loaded" from raylibs structs, the wrapper interface itself can been a little bit more robust, and if someone really want to tamper with the data, it still can been done via (explicit) casting. or using the public members. (I personally thinking about, using composition for the classes and explicit casting, so the data is no more public)
- Dominant language
- C++
- Stars
- 960
- Forks
- 120
- Avg merge
- 10m
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from RobLoach/raylib-cpp
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
RobLoach/raylib-cpp#425 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
RobLoach/raylib-cpp#427 ·
-
Code gen Open
Difficulty 5/5 Over a week Newbie friendliness 30/100
RobLoach/raylib-cpp#415 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
RobLoach/raylib-cpp#370 · 1 comment ·
-
SDF Font Support Open
Difficulty 3/5 1-2 days Newbie friendliness 55/100
RobLoach/raylib-cpp#366 · 3 comments ·
All issues in RobLoach/raylib-cpp
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
objectionary/eo-graphs#74 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 88/100
QuantStack/git2cpp#187 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100