Reviewing Getter and Setter
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 20/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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)
- Lingua principale
- C++
- Stelle
- 960
- Fork
- 120
- Merge medio
- 10m
- PR unite (30g)
- 1
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di RobLoach/raylib-cpp
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
RobLoach/raylib-cpp#425 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
RobLoach/raylib-cpp#427 ·
-
Code gen Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
RobLoach/raylib-cpp#415 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
RobLoach/raylib-cpp#370 · 1 commento ·
-
SDF Font Support Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
RobLoach/raylib-cpp#366 · 3 commenti ·
Tutte le issue di RobLoach/raylib-cpp
Issue simili
-
[CI] Nightly Clang build broken: structured binding captured in a lambda in FileDataSource.cpp Apertabug build
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 91/100
facebookincubator/velox#19194 ·
-
JIT-compiled number -> Decimal conversion silently overflows instead of raising DECIMAL_OVERFLOW Apertafuzz
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
ClickHouse/ClickHouse#122114 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
module/agent platform/macos type/bug/regression
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
enhancement PyCDE
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100