-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
66 lines (56 loc) · 1.58 KB
/
main.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifndef PLATFORM_DINGOO
#include <cstdlib>
#endif
#include <iostream>
#include "SDL/SDL.h"
#include "SDL/SDL_ttf.h"
#include "def.h"
#include "sdlutils.h"
#include "resourceManager.h"
#include "commander.h"
// Globals
SDL_Surface *Globals::g_screen = NULL;
const SDL_Color Globals::g_colorTextNormal = {COLOR_TEXT_NORMAL};
const SDL_Color Globals::g_colorTextTitle = {COLOR_TEXT_TITLE};
const SDL_Color Globals::g_colorTextDir = {COLOR_TEXT_DIR};
const SDL_Color Globals::g_colorTextSelected = {COLOR_TEXT_SELECTED};
std::vector<CWindow *> Globals::g_windows;
int main(int argc, char** argv)
{
// Avoid crash due to the absence of mouse
{
char l_s[]="SDL_NOMOUSE=1";
putenv(l_s);
}
// Init SDL
SDL_Init(SDL_INIT_VIDEO);
// Screen
Globals::g_screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SURFACE_FLAGS);
if (Globals::g_screen == NULL)
{
std::cerr << "SDL_SetVideoMode failed: " << SDL_GetError() << std::endl;
return 1;
}
// Hide cursor
SDL_ShowCursor(SDL_DISABLE);
// Init font
if (TTF_Init() == -1)
{
std::cerr << "TTF_Init failed: " << SDL_GetError() << std::endl;
return 1;
}
// Create instances
CResourceManager::instance();
#ifdef PLATFORM_DINGOO
CCommander l_commander(PATH_DEFAULT, PATH_DEFAULT);
#else
std::string l_path = getenv("HOME");
l_path += "/Dev/DinguxCommander/test";
CCommander l_commander(l_path, l_path);
#endif
// Main loop
l_commander.execute();
//Quit
SDL_utils::hastalavista();
return 0;
}