Files
dl_old/project/dl_test/head.cpp
T
2026-08-30 09:26:55 +08:00

179 lines
3.3 KiB
C++

#include "head.h"
#include "ui_main.h"
#include "game_sudo.h"
#include "game_match.h"
void Test()
{
}
Tool::Manager* g_Tool;
void Init()
{
if(true)
{
struct DataSubType
{
int _min = INT_MAX;
int _max = 0;
};
struct DataType
{
std::string _name;
std::map<std::string, DataSubType> _allSub;
};
struct Data
{
std::map<int, DataType> _data;
};
Data data;
std::string str = File::GetString("F:/All/收藏/音效光碟/C/list.txt");
std::vector<std::string> vec_str;
split(str, '\n', vec_str);
for (size_t i = 0; i + 3 < vec_str.size(); i += 3)
{
int id = String::toInt(vec_str[i]);
int type = String::toInt(vec_str[i + 1]);
std::string name = vec_str[i + 2];
std::string_view type_sub = String::GetBeginUntilNumber(name);
//log_info("{}, {}, {}, {}", type, type_sub, name, id);
DataType* group;
if (type == -1)
{
group = &data._data[id];
group->_name = name;
}
else
{
group = &data._data[type];
DataSubType& sub = group->_allSub[std::string{ type_sub }];
if (id < sub._min)
sub._min = id;
else if (id > sub._max)
sub._max = id;
}
}
// export
std::string str_out;
for (auto& iter : data._data)
{
for (auto& iter1 : iter.second._allSub)
{
str_out += fmt::format("{},{},{}-{}\n",
iter.second._name, iter1.first, iter1.second._min, iter1.second._max);
}
}
File::SaveString(str_out, "D:/1.txt");
}
g_particle->SetReadOverwirte(true);
g_particle->LoadPath("particle/");
g_Tool = Tool::Manager::Create();
g_Tool->SetVisible(false);
g_Tool->SetSwitchAll(true);
g_ui->SetStandardSize({ 800, 600 });
g_ui->RegisterAll("ui/");
g_scene->Add("main", new UIMain);
//g_scene->Add("game", new GameSudo);
//g_scene->Add("game_match", new GameMatch);
//g_scene->SetCurrent("game_match");
UI::ResExplorer* win = UI::ResExplorer::Create();
win->ExFastSet();
g_ui->AddWindow("res_exp", win);
}
void Run()
{
g_Tool->Update();
auto win = g_ui->GetWindow("res_exp");
if (g_input->KeyDown(KeyCode::F10))
{
g_ui->ShowWindow(win, UI::WindowShowMode::TOGGLE);
}
if (win->IsClickClose())
{
g_ui->ShowWindow(win, UI::WindowShowMode::HIDE);
}
g_Tool->Render();
}
void Release()
{
delete g_Tool;
}
int Main()
{
Position* p_crash = nullptr;
//log_info("{}", to_string(*p_crash));
g_log->SetLogFile("log/");
//Engine::GetParamRef()._test = true;
Engine::Init();
Position p0;
Position p1{};
log_info("{}", to_string(p0));
log_info("{}", to_string(p1));
p0.x = 100;
p0.y = 200;
log_info("{}", to_string(p0));
Size s0;
s0.w = 800;
s0.h = 600;
log_info("{}", to_string(s0));
Quad q0{};
q0.x[0] = 1;
q0.y[0] = 2;
log_info("{}", to_string(q0));
{
FileIni ini;
ini.Open("ClientSetup.ini");
FileIniSection sec = ini.GetSection("Setup");
std::string v = sec.Get("HomePage");
}
Test();
g_mod->LoadModAll("mod/");
g_factory->SetPath("image/", "model/", "binary/", "temp/");
//g_factory->SetReleaseMode();
g_audio->Init("sound/config.json");
g_time->SetFPS(0);
g_system->SetFuncInit(Init);
g_system->SetFuncRun(Run);
#if DL_PLATFORM == DL_PLATFORM_ANDROID
//g_system->SetWindowDirection(WindowDirection::RIGHT);
#endif
ParamWindow p;
p._size = { 800, 600 };// { 1920, 1080 };
p._fullScreenMode = FullScreenMode::WINDOW;
g_system->Start(p);
Release();
Engine::Release();
return 0;
}