-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
34 lines (29 loc) · 780 Bytes
/
main.cpp
File metadata and controls
34 lines (29 loc) · 780 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
31
32
33
34
#include "game.hpp"
#include <iostream>
int main(int argc, char *argv[]){
Game game;
const int FPS = 60;
const int Frame_Delay = 1000 / FPS;
Uint32 frame_start;
srand(time(NULL));
if( !game.init() ){
printf( "Failed to initialize!\n" );
return 0;
}
frame_start = SDL_GetTicks();
//Load media
if( !game.loadMedia() ){
printf( "Failed to load media!\n" );
return 0;
}
game.run();
game.close();
int numKeys;
const Uint8 *keyboardState = SDL_GetKeyboardState(&numKeys);
// Check the state of the 'A' key (for example)
if (keyboardState[SDL_SCANCODE_UP]) {
// The 'A' key is pressed
cout<<"A is pressed"<<endl;
}
return 0;
}