Hello, so I’ve been creating a sandbox game, and I’ve implemented a texture creating + rendering function. I’ve setup this code:
// The 'Window' object is simply a struct to hold
// identifiers and values about the window. The
// window itself (SDL_Window* XWindow) appears
// in main().
// Code not useful here.
SDL_Rect RectID;
RectID.x = MouseID->ButtonX;
RectID.y = MouseID->ButtonY;
if (RectID.h < Window->Size.h &&
RectID.w < Window->Size.w) {
do {
RectID.w++;
RectID.h++;
} while (RectID.h < Window->Size.h &&
Rect.ID.w < Window->Size.w &&
ShouldRender == true);
}
SDL_RenderCopy(...);
I’ve encountered 2 issue myself, one is that RenderCopy requires a constant (const
) rectangle, the other is the loop depends on whether should it terminate based on the KeepWindowOpen value, which brings some inconsistency.
The thing I want to achieve is a growing rectangle, because I’m rendering water on a flat surface. I’m fine with using stop frames as well.
So my question is, is there a way to do the same thing but to actually make it work?
(I’m fine with using external libraries if SDL can’t provide that functionality).