-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestSDL.cpp
More file actions
51 lines (39 loc) · 1.03 KB
/
Copy pathtestSDL.cpp
File metadata and controls
51 lines (39 loc) · 1.03 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
40
41
42
43
44
45
46
47
48
49
50
51
/* runcpp2
OverrideLinkFlags:
Unix:
"g++":
Remove: ""
Append: "-lSDL2"
*/
#include <SDL2/SDL.h>
#include <iostream>
const int SCREEN_WIDTH = 800;
const int SCREEN_HEIGHT = 600;
int main(int arc, char ** argv)
{
SDL_Window* window = nullptr;
if (SDL_Init( SDL_INIT_VIDEO ) < 0)
std::cout << "SDL could not initialize! SDL_Error: " << SDL_GetError() << std::endl;
else
{
window = SDL_CreateWindow( "SDL2 Demo",
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED,
SCREEN_WIDTH,
SCREEN_HEIGHT,
SDL_WINDOW_SHOWN);
}
bool quit = false;
SDL_Event e;
while (!quit)
{
while (SDL_PollEvent(&e) != 0)
{
if (e.type == SDL_QUIT)
quit = true;
}
}
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}