forked from scarsty/kys-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplication.cpp
More file actions
51 lines (43 loc) · 1.5 KB
/
Application.cpp
File metadata and controls
51 lines (43 loc) · 1.5 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
44
45
46
47
48
49
50
51
#include "Application.h"
#include "Audio.h"
#include "Engine.h"
#include "Font.h"
#include "GameUtil.h"
#include "INIReader.h"
#include "Random.h"
#include "TextureManager.h"
#include "TitleScene.h"
#include "UIKeyConfig.h"
Application::Application()
{
}
Application::~Application()
{
}
int Application::run()
{
auto engine = Engine::getInstance();
engine->setStartWindowSize(1280, 720);
engine->init(); //引擎初始化之后才能创建纹理
engine->createAssistTexture(800, 450);
config();
auto s = std::make_shared<TitleScene>(); //开始界面
s->run();
return 0;
}
void Application::config()
{
auto game = GameUtil::getInstance();
//RunNode::setRefreshInterval(game->getReal("game", "refresh_interval", 16));
Audio::getInstance()->setVolume(game->getInt("music", "volume", 50));
Event::getInstance()->setUseScript(game->getInt("game", "use_script", 0));
Font::getInstance()->setStatMessage(game->getInt("game", "stat_font", 0));
Font::getInstance()->setSimplified(game->getInt("game", "simplified chinese", 1));
Engine::getInstance()->setWindowTitle(game->getString("game", "title", "All Heroes in Kam Yung Stories"));
TextureManager::getInstance()->setLoadFromPath(game->getInt("game", "png_from_path", 0));
TextureManager::getInstance()->setLoadAll(game->getInt("game", "load_all_png", 0));
UIKeyConfig::readFromString(game->getString("game", "key", ""));
Role::setMaxValue();
Role::setLevelUpList();
Item::setSpecialItems();
}