82 |
82 |
83 QStringList SDLInteraction::getResolutions() const |
83 QStringList SDLInteraction::getResolutions() const |
84 { |
84 { |
85 QStringList result; |
85 QStringList result; |
86 |
86 |
87 #if SDL_VERSION_ATLEAST(2, 0, 0) |
|
88 int modesNumber = SDL_GetNumDisplayModes(0); |
87 int modesNumber = SDL_GetNumDisplayModes(0); |
89 SDL_DisplayMode mode; |
88 SDL_DisplayMode mode; |
90 |
89 |
91 for(int i = 0; i < modesNumber; ++i) |
90 for(int i = 0; i < modesNumber; ++i) |
92 { |
91 { |
93 SDL_GetDisplayMode(0, i, &mode); |
92 SDL_GetDisplayMode(0, i, &mode); |
94 |
93 |
95 if ((mode.w >= 640) && (mode.h >= 480)) |
94 if ((mode.w >= 640) && (mode.h >= 480)) |
96 result << QString("%1x%2").arg(mode.w).arg(mode.h); |
95 result << QString("%1x%2").arg(mode.w).arg(mode.h); |
97 } |
96 } |
98 #else |
|
99 SDL_Rect **modes; |
|
100 |
|
101 modes = SDL_ListModes(NULL, SDL_FULLSCREEN); |
|
102 |
|
103 if((modes == (SDL_Rect **)0) || (modes == (SDL_Rect **)-1)) |
|
104 { |
|
105 result << "640x480"; |
|
106 } |
|
107 else |
|
108 { |
|
109 for(int i = 0; modes[i]; ++i) |
|
110 if ((modes[i]->w >= 640) && (modes[i]->h >= 480)) |
|
111 result << QString("%1x%2").arg(modes[i]->w).arg(modes[i]->h); |
|
112 } |
|
113 #endif |
|
114 |
97 |
115 return result; |
98 return result; |
116 } |
99 } |
117 |
100 |
118 |
101 |
119 void SDLInteraction::addGameControllerKeys() const |
102 void SDLInteraction::addGameControllerKeys() const |
120 { |
103 { |
121 QStringList result; |
104 QStringList result; |
122 |
105 |
123 #if SDL_VERSION_ATLEAST(2, 0, 0) |
106 #if SDL_VERSION_ATLEAST(2, 0, 0) |
124 |
107 // TODO or not TODO? |
125 #else |
108 #else |
126 int i = 0; |
109 int i = 0; |
127 while(i < 1024 && sdlkeys[i][1][0] != '\0') |
110 while(i < 1024 && sdlkeys[i][1][0] != '\0') |
128 i++; |
111 i++; |
129 |
112 |
278 } |
261 } |
279 |
262 |
280 |
263 |
281 QSize SDLInteraction::getCurrentResolution() |
264 QSize SDLInteraction::getCurrentResolution() |
282 { |
265 { |
283 #if SDL_VERSION_ATLEAST(2, 0, 0) |
|
284 SDL_DisplayMode mode; |
266 SDL_DisplayMode mode; |
285 |
267 |
286 SDL_GetDesktopDisplayMode(0, &mode); |
268 SDL_GetDesktopDisplayMode(0, &mode); |
287 |
269 |
288 return QSize(mode.w, mode.h); |
270 return QSize(mode.w, mode.h); |
289 #else |
271 } |
290 SDL_VideoInfo * vi = SDL_GetVideoInfo(); |
|
291 return QSize(vi->current_w, vi->current_h); |
|
292 #endif |
|
293 } |
|