-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
56 lines (40 loc) · 1.2 KB
/
main.cpp
File metadata and controls
56 lines (40 loc) · 1.2 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
52
53
54
55
56
#include <iostream>
#include <SDL2/SDL.h>
#include <SDL2/SDL_ttf.h> //Have to add linker to makefile I think still
#include <SDL2/SDL_image.h>
#include <vector>
#include "RenderWindow.hpp"
#include "Entity.hpp"
#include "Utils.hpp"
#include "BitOps.hpp"
using namespace std;
int main(int argc, char** argv) {
// BitOps ops;
// int i = 0;
// for (auto bitboard : ops.kings){
// cout << i++;
// utils::printBitboard(bitboard);
// }
// return 0;
if (SDL_Init(SDL_INIT_VIDEO) > 0)
cout << "SDL Init failed. SLD ERROR: " << SDL_GetError() << endl;
if (!(IMG_Init(IMG_INIT_PNG)))
cout << "SDL Init failed. SLD ERROR: " << SDL_GetError() << endl;
const int frameDelay = 1000 / 100; // 60 fps
int frameStart = SDL_GetTicks();
RenderWindow window("Chess", 1280, 720);
while (window.running()){
int frameStart = SDL_GetTicks();
window.handleEvents();
window.update();
window.render();
int frameTime = SDL_GetTicks() - frameStart;
if (frameDelay > frameTime){
SDL_Delay(frameDelay - frameTime);
}
}
window.cleanUp();
// delete window;
SDL_Quit();
return 0;
}