-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsyswm.cpp
More file actions
executable file
·39 lines (30 loc) · 1.19 KB
/
syswm.cpp
File metadata and controls
executable file
·39 lines (30 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
#include <SDL2/SDL.h>
#include <SDL2/SDL_syswm.h>
using std::cout;
int main(int argc, char* argv[]){
SDL_Init(0);
SDL_Window* window = SDL_CreateWindow("",0,0,0,0,SDL_WINDOW_HIDDEN);
SDL_SysWMinfo info;
SDL_VERSION(&info.version); // initialize info structure with SDL version info
if(SDL_GetWindowWMInfo(window,&info)){ // the call returns true on success
// success
cout << "This program is running SDL version "
<< (int)info.version.major << "."
<< (int)info.version.minor << "."
<< (int)info.version.patch << " on ";
switch(info.subsystem){
case SDL_SYSWM_UNKNOWN: cout << "an unknown system!"; break;
case SDL_SYSWM_WINDOWS: cout << "Microsoft Windows(TM)"; break;
case SDL_SYSWM_X11: cout << "X Window System"; break;
case SDL_SYSWM_DIRECTFB: cout << "DirectFB"; break;
case SDL_SYSWM_COCOA: cout << "Apple OS X"; break;
case SDL_SYSWM_UIKIT: cout << "UIKit"; break;
}
} else {
// call failed
cout << "Couldn't get window information: " << SDL_GetError();
}
SDL_DestroyWindow(window);
SDL_Quit();
}