-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
43 lines (33 loc) · 1.02 KB
/
main.cpp
File metadata and controls
43 lines (33 loc) · 1.02 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
#include <SDL2/SDL.h>
#include <SDL2/SDL_log.h >
#include <SDL2/SDL_vulkan.h>
#include <iostream>
#include <vector>
#include "context.h"
#include "logger.h"
int main(int argc, char *argv[]) {
SDL_Init(SDL_INIT_EVERYTHING);
Logger::getInstance().init("XEngine.log");
LOG_INFO("current video driver: {}", SDL_GetCurrentVideoDriver());
SDL_Window *window = SDL_CreateWindow("sandbox", SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED, 1024, 720,
SDL_WINDOW_SHOWN | SDL_WINDOW_VULKAN);
if (!window) {
LOG_ERROR("create window failed: {}", SDL_GetError());
exit(2);
}
bool shouldClose = false;
SDL_Event event;
XEngine::Context::GetInstance().Init();
while (!shouldClose) {
while (SDL_PollEvent(&event)) {
if (event.type == SDL_QUIT) {
shouldClose = true;
}
}
}
XEngine::Context::GetInstance().Quit();
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}