diff --git a/examples/Example.h b/examples/Example.h index 9ea003f7..909a60ca 100644 --- a/examples/Example.h +++ b/examples/Example.h @@ -283,6 +283,8 @@ struct Window struct SwWindow : Window { + SDL_Renderer* renderer = nullptr; + SwWindow(Example* example, uint32_t width, uint32_t height, uint32_t threadsCnt) : Window(example, width, height, threadsCnt) { if (!initialized) return; @@ -296,9 +298,17 @@ struct SwWindow : Window return; } + //VSync has been disabled. Remove this line if you need VSync enabled. + renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_PRESENTVSYNC); + resize(); } + ~SwWindow() + { + if (renderer) SDL_DestroyRenderer(renderer); + } + void resize() override { auto surface = SDL_GetWindowSurface(window);