SDL: get window height / width / rectangle?

in previous versions of SDL, I managed to get the height and width of my problem using the main surface on which the clip_rect element was. Starting with version 2.0, I use SDL_Renderer and SDL_Window.

How to get window size or even better than direct my current program?

+4
source share
2 answers

To get the height and width of the window:

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

Here you can see more functions for any tasks related to windows. https://wiki.libsdl.org/CategoryVideo

+7
source

If you are just looking for width and height and everything else that you usually find in SDL_Surface, this works just as well, if not better:

:

SDL_GetWindowSurface(m_window)->w;

:

SDL_GetWindowSurface(m_window)->h;
+1

Source: https://habr.com/ru/post/1537080/


All Articles