-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
36 lines (31 loc) · 1.14 KB
/
main.cpp
File metadata and controls
36 lines (31 loc) · 1.14 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
#include "Console.h"
#include "DBMW.h"
#include "HiveBoardEditMW.h"
#include "PuzzleBookMW.h"
#include <fstream>
int main()
{
try {
// 获取控制台
auto& console = Console::getConsole();
// 为控制台添加菜单选项
console.addMenuItem(new Item(new Task(static_cast<sobcbf>(&DBMW::newDBMW)), "Temp Terminal"));
console.addMenuItem(new Item(new Task(static_cast<sobcbf>(&PuzzleBookMW::newPuzzleBookMW)), "Puzzle Book"));
console.addMenuItem(new Item(new Task(static_cast<sobcbf>(&HiveBoardEditMW::newHBEMW)), "HiveBoard Edit"));
// 为控制台添加退出选项, 并为该选项设定醒目的颜色
auto b = new Item(new Task(static_cast<obcbf>(&Console::exit), &console), "Exit");
b->setTheme(Mix(White, DarkRed), Mix(Red, White), Mix(Magenta, White));
console.addMenuItem(b);
// 开始执行任务
return console.mainLoop();
}
catch (const char* e) {
std::ofstream ofs("./log.txt");
ofs << e;
return -1;
} catch (...) {
std::ofstream ofs("./log.txt");
ofs << "unknown error";
return -1;
}
}