Answer the question
In order to leave comments, you need to log in
How to run SDL application in full screen mode 2 monitor
Hello.
I got someone else's project written in c++ SDL for revision. I have no experience with him. Therefore, I ask knowledgeable people to help. There is a machine with 2 monitors, ie. extended desktop. I need to make it so that the application opens on 2 monitors in full screen at startup.
Thank you for your time.
Answer the question
In order to leave comments, you need to log in
As it turned out, everything is outrageously simple. It is enough to create a window outside the current screen.
//Сначала получим параметры основного экрана.
SDL_DisplayMode current;
for (int i = 0; i < SDL_GetNumVideoDisplays(); ++i){
int should_be_zero = SDL_GetCurrentDisplayMode(i, ¤t);
if (should_be_zero != 0)
// In case of error...
printf("Could not get display mode for video display #%d: %s", i, SDL_GetError());
else
// On success, print the current display mode.
printf("Display #%d: current display mode is %dx%dpx @ %dhz. \n", i, current.w, current.h, current.refresh_rate);
}
//Создадим окно со следующими параметрами левого верхнего угла current.w + 1, current.h + 1
m_window = SDL_CreateWindow("SDL Window",
current.w + 1,
current.h + 1,
1152, 648,
#ifdef NDEBUG
SDL_WINDOW_FULLSCREEN_DESKTOP |
#endif
SDL_WINDOW_OPENGL);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question