-
Notifications
You must be signed in to change notification settings - Fork 0
/
CoreBase.cpp
87 lines (70 loc) · 1.69 KB
/
CoreBase.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include "CoreBase.h"
// Class, engine core
#include "Win_err.h"
#include "Simple_win.h"
CoreBase::CoreBase()
: path_proj("Game"), engine_mode("Game"), win(nullptr)
{ }
CoreBase::CoreBase(std::fstream &in)
: CoreBase()
{
//in.open("Core.config");
while (!in.eof()) {
in >> core_info;
Search(core_info, in);
}
//in.close();
std::fstream inp;
inp.open("Win_err.config", std::ios::in);
win = std::make_shared<Win_err>(inp, "Exception opening/reading/closing file\n");
inp.close();
std::string win_path = std::string(path_proj) + "/Wind.config";
inp >> win_path;
}
void CoreBase::Search(const std::string &info, std::fstream &in)
{
if (!info.compare("Path")) {
in >> path_proj;
}
if (!info.compare("Mode")) {
in >> engine_mode;
}
}
std::shared_ptr<Simple_win> CoreBase::addNewSimpleWin()
{
auto win = std::make_shared<Simple_win>();
_data.windows.push_back(win);
return win;
}
std::shared_ptr<Window> CoreBase::Create_window()
{
std::shared_ptr<Simple_win> win = addNewSimpleWin();
win->Create();
return win;
}
std::shared_ptr<Window> CoreBase::Create_window(int x, int y)
{
std::shared_ptr<Simple_win> win = addNewSimpleWin();
win->Create(x, y);
return win;
}
std::shared_ptr<Window> CoreBase::Create_window(int x, int y, int wd, int hg)
{
std::shared_ptr<Simple_win> win = addNewSimpleWin();
win->Create(x, y, wd, hg);
return win;
}
std::shared_ptr<Window> CoreBase::Create_window(int x, int y, int wd, int hg, Uint32 flags)
{
std::shared_ptr<Simple_win> win = addNewSimpleWin();
win->Create(x, y, wd, hg, flags);
return win;
}
void CoreBase::Close_All_Windows()
{
size_t i;
_data.run = false;
for (i = 0; i < _data.windows.size(); i++) {
_data.windows[i]->Close();
}
}