-
Notifications
You must be signed in to change notification settings - Fork 0
/
CApp_Initialization.cpp
38 lines (33 loc) · 1.17 KB
/
CApp_Initialization.cpp
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
#include "CApp.h"
bool CApp::initiate() {
#if defined lite_debug || defined full_debug
SDL_SetHint(SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING, "1");
#endif
Settings::initialize();
if(SDL_Init( SDL_INIT_EVERYTHING ) != 0) {
SDL_Log("Unable to initialize SDL: %s", SDL_GetError());
return false;
}
if(TTF_Init() != 0) {
printf("Unable to initialize TTF: %s", TTF_GetError());
}
if(!Settings::getFullscreen()) {
window = SDL_CreateWindow(TXT_TITLE,
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
Settings::getScreenWidth(), Settings::getScreenHeight(),
SDL_WINDOW_OPENGL);
} else {
window = SDL_CreateWindow(TXT_TITLE,
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
Settings::getScreenWidth(), Settings::getScreenHeight(),
SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN);
}
if(!window) {
printf("Error while creating window!\n");
return false;
}
CRender::renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
return true;
}