I’ve been making some very simple wrappers around some of the SDL2 functionality. I created a class that wrapped SDL_Window* and SDL_Surface*.
Within my SDL_Surface wrapper (SDL2::Surface), the constructor takes in the SDL2:::Window wrapper and associates the SDL_Window* to the SDL_Surface* member variable in SDL2::Surface.
Then, I have SDL2::Surface::FillRect() which calls:
SDL_FillRect(Surface, NULL, SDL_MapRGB(Surface->format, 0xFF, 0x00, 0xFF));
Under this construct, I get an access violation exception on the call to SDL_FillRect. However, if I wrap both SDL_Window* and SDL_Surface into one wrapper class, the call to SDL_FillRect from that class works fine.
What could possibly be the difference between these two approaches?