-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
30 lines (26 loc) · 685 Bytes
/
main.cpp
File metadata and controls
30 lines (26 loc) · 685 Bytes
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
#include <SDL/SDL.h>
#include <string>
#include "GameWindow.h"
using namespace std;
int main(int argc, char *argv[]) {
Pong::GameWindow pongWindow;
SDL_Event event;
bool gameRunning = true;
// Main event loop
while(gameRunning) {
if (SDL_PollEvent(&event)) {
switch(event.type) {
case SDL_QUIT:
gameRunning = false;
break;
case SDL_KEYDOWN:
case SDL_KEYUP:
pongWindow.onKeyboardEvent(event.key);
break;
default: break;
}
}
pongWindow.show();
}
return 0;
}