MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / uiShow

Function uiShow

source/ui/mainui.cpp:464–670  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

462}
463
464bool uiShow(BString basePath) {
465 // Setup SDL
466 // (Some versions of SDL before <2.0.10 appears to have performance/stalling issues on a minority of Windows systems,
467 // depending on whether SDL_INIT_GAMECONTROLLER is enabled or disabled.. updating to latest version of SDL is recommended!)
468 /*
469 // done in main
470 if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0)
471 {
472 printf("Error: %s\n", SDL_GetError());
473 return false;
474 }
475 */
476
477 SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
478
479#ifdef BOXEDWINE_OPENGL_SDL
480 const char* glsl_version = nullptr;
481 if (StartUpArgs::uiType == UI_TYPE_OPENGL) {
482 // Decide GL+GLSL versions
483#if __APPLE__
484 // GL 3.2 Core + GLSL 150
485 glsl_version = "#version 150";
486 SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG); // Always required on Mac
487 SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
488 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
489 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
490#elif defined (BOXEDWINE_OPENGL_IMGUI_V2)
491 glsl_version = "#version 100";
492 SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, 0);
493 SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
494 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
495 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
496#else
497 // GL 3.0 + GLSL 130
498 glsl_version = "#version 150";
499 SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, 0);
500 SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
501 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
502 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
503#endif
504
505 // Create window with graphics context
506 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
507 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
508 SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
509 window_flags = (SDL_WindowFlags)(window_flags | SDL_WINDOW_OPENGL);
510 }
511#endif
512
513 int cx = GlobalSettings::getPreviousScreenWidth();
514 int cy = GlobalSettings::getPreviousScreenHeight();
515 U32 scale = SCALE_DENOMINATOR;
516
517 SDL_DisplayMode dm = { 0 };
518 SDL_GetDesktopDisplayMode(0, &dm);
519
520 int x = GlobalSettings::getPreviousScreenX();
521 int y = GlobalSettings::getPreviousScreenY();

Callers 1

boxedmainFunction · 0.85

Calls 15

SDL_GL_SetAttributeFunction · 0.85
SDL_CreateWindowFunction · 0.85
SDL_RaiseWindowFunction · 0.85
SDL_GetWindowWMInfoFunction · 0.85
SDL_GL_CreateContextFunction · 0.85
SDL_GL_MakeCurrentFunction · 0.85
gl3wInitFunction · 0.85
SDL_GL_GetProcAddressFunction · 0.85
CreateContextFunction · 0.85
loadAppsFunction · 0.85
createButtonFunction · 0.85

Tested by

no test coverage detected