MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / Init

Method Init

renderer/lnxscreenmode.cpp:115–187  ·  view source on GitHub ↗

enumerate all the possible video modes

Source from the content-addressed store, hash-verified

113
114// enumerate all the possible video modes
115bool CLnxVideoModes::Init(void) // Display *dpy,int screen)
116{
117#if 0 // with SDL2, we'll just use FULLSCREEN_DESKTOP and never change the physical vidmode
118 if (m_Inited)
119 return true;
120
121 // m_Display = dpy;
122 // m_Screen = screen;
123 m_NumVideoModes = 0;
124 m_ModeInfoList = NULL;
125 m_Inited = true;
126 sdlflags = 0;
127 /*
128 if(!LoadLibraries())
129 {
130 m_Inited = false;
131 fprintf(stdout,"LoadLib: Unable to load VideoMode libraries\n");
132 return false;
133 }
134
135 int dummy;
136 if(!VidModeQueryExtension(dpy,&dummy,&dummy))
137 return false;
138
139 if(!VidModeGetAllModeLines(m_Display,m_Screen,&m_NumVideoModes,&m_ModeInfoList))
140 {
141 m_NumVideoModes = 0;
142 }else
143 {
144 */
145
146 const SDL_VideoInfo *vidInfo = NULL;
147
148 sdlflags = SDL_HWSURFACE | SDL_FULLSCREEN;
149 sdlflags = SDL_OPENGL | SDL_FULLSCREEN;
150 if (FindArgChar("-windowed", 'w'))
151 sdlflags &= ~SDL_FULLSCREEN;
152
153 vidInfo = SDL_GetVideoInfo();
154
155 m_ModeInfoList = SDL_ListModes(vidInfo->vfmt, sdlflags);
156 if (m_ModeInfoList == NULL) {
157 sdlflags &= ~SDL_FULLSCREEN;
158 m_ModeInfoList = SDL_ListModes(vidInfo->vfmt, sdlflags); // try without fullscreen.
159 if (m_ModeInfoList == NULL) {
160 sdlflags = 0;
161 m_ModeInfoList = SDL_ListModes(vidInfo->vfmt, sdlflags); // give me ANYTHING.
162 if (m_ModeInfoList == NULL) {
163 fprintf(stderr, "SDL: SDL_ListModes() failed.\n");
164 return -3;
165 } // if
166 } // if
167 } // if
168
169 if (m_ModeInfoList == (SDL_Rect **)-1) // anything is fine.
170 {
171 mprintf(0, "Windowed surface is probably going to be used.");
172 m_NumVideoModes = 0;

Callers

nothing calls this directly

Calls 1

FindArgCharFunction · 0.85

Tested by

no test coverage detected