Repository navigation
Conversation
| /** | ||
| * @brief Initializes SDL and creates the window and renderer. | ||
| * @brief Initializes UI and creates the window and renderer. | ||
| * @param[in] width The width of the LED matrix in LEDs. |
There was a problem hiding this comment.
Actually the other was wrong. On LedGridSim layer we calculate with the grid resolution, on SDLInterface, its pixels.
| bool initialize(int width, int height); | ||
|
|
||
| /** | ||
| * @brief Release IMGUI resources. |
There was a problem hiding this comment.
Release internal resources ... what is the consequence?
There was a problem hiding this comment.
I don't expect real consequences, assuming Linux and WIndow tidy up on app exit in any case. But both ImGui and SDL layer allocate objects on the heap and also for SDL in GPU ram (i.e. Surfaces, Textures ...).
I changes the comment to this to be more specific:
* @brief Release IMGUI/SDL owned heap/GPU resources.
| shutdown(); | ||
| } | ||
|
|
||
| bool LedGridSim::initialize(int width, int height) |
There was a problem hiding this comment.
Must it be int or could it be uint16_t with the advantage to avoid casting later.
There was a problem hiding this comment.
Changed to uint16_t. The int promoted from SDL upwards where coordinates are int (negative is used for off screen). But SDL is an internal part and should not impact outgoing interfaces.
The change did impact range checking and casts move to the SDL call now.
Same object was deleted twice, likely copy+paste error.
Use a static SdlInterface instance instead of heap allocation. There is no need for heap allocation as this object is alive for the entire execution time. No nullptr checks required now, which had been missing before.
Add missing sections from code template to recently added cpp files.
- Release already acquired ImGui resources if a later init step failed. - Add a "shutdown()" call to release resources on request. The destructor is only called on app shutdown (static object).
Don't compute buttonDriver * and aspect ratio on each update. Calculate during init and store in class members for later access.
Make SDLInterface owned by the LedGridSim to avoid heap usage. Fix shutdown() of LedGridSim to be robust against repetitive calls.
An empty about menu was used which means its just a MenuItem. Use the proper classes also there is no visual diffference.
Most functions don't modify class members, mark them as const.
Some variables used snake_case.
b5cf341 to
7b34b67
Compare
Add code quality and small fixes after extensive review of recently added code.
Fixes:
Cosmetics: