문제

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?

도움이 되었습니까?

해결책

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

다른 팁

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;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top