Question

in previously versions of SDL I was able to get the height and width of my problem using the main surface, which had a clip_rect member. Since 2.0 I am using SDL_Renderer & SDL_Window.

How do I get the window size or even better the rect of my current program?

Was it helpful?

Solution

To get the height and width of the window:

void SDL_GetWindowSize(SDL_Window* window,int* w,int* h)

You can look here for more functions for whatever you want that deals with windows. https://wiki.libsdl.org/CategoryVideo

OTHER TIPS

If you're just looking for width and height and anything else you'd normally find within an SDL_Surface this works just as well, if not better:

Width:

SDL_GetWindowSurface(m_window)->w;

Height:

SDL_GetWindowSurface(m_window)->h;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top