Files
dl_old/project/dl_test/head.cpp
T
2026-01-11 18:54:31 +08:00

237 lines
4.9 KiB
C++

#include "head.h"
#include "ui_main.h"
#include "game_sudo.h"
void Test()
{
}
Tool::Manager* g_Tool;
void Init()
{
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);
}
void Run()
{
g_Tool->Update();
g_Tool->Render();
//base->txt->Render();
/*base->spr->Render();
base->txt->Render();
base->spr_logo->Render();*/
//g_gfx->Dot({ 400, 300, 0.5f });
//g_gfx->Line({ 20, 20, 0 }, { 800, 600, 0 });
//g_gfx->Triangle({ 400, 10, 0 }, { 10, 500, 0 }, { 750, 550, 0 });
//g_gfx->TriangleSolid({ 0, 0, 0 }, { 100, 0, 0 }, { 10, 250, 0 });
//g_gfx->Love();
//base->spr9->Render();
}
void Release()
{
delete g_Tool;
}
int Main()
{
g_log->SetLogFile("log/");
Engine::Init();
{
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(60);
g_system->SetFuncInit(Init);
g_system->SetFuncRun(Run);
#if DL_PLATFORM == DL_PLATFORM_ANDROID
g_system->SetWindowDirection(WindowDirection::RIGHT);
#endif
ParamWindow p;
p._size = { 1920, 1080 };
p._fullScreenMode = FullScreenMode::WINDOW;
g_system->Start(p);
Release();
Engine::Release();
return 0;
}
//String::TestSplit();
//Tool::Archiver::Param p;
//p._bCrc = true;
//p._compressMode = Memory::E_ZIP;
//p._out = "temp/test.dat";
//p._src = "G:/dl/document/";
//Tool::Archiver::Compress(p);
//Tool::Archiver::Dempress(p._out, "temp/test/");
/*{
DB::Sqlite* s = DB::Sqlite::Create();
s->Open("test.db");
Vector2<std::string> vec = s->Exec("PRAGMA table_info(item);");
log_msg("{}", to_string(vec));
Vector2<std::string> vec1 = s->Exec("SELECT * FROM item");
log_msg("{}", to_string(vec1));
delete s;
}*/
//Thread* t = g_thread->Create();
/*log("hello dl!");
log("中文");
constexpr Point a{ 100, 100 };
constexpr Point b{ 200, 200 };
constexpr Point c = a + b;
constexpr Point d = Every::Clamp(c, 120, 150);*/
//log(to_string(d));
//Http::Request req;
//req.SetType(Http::Request::Type::GET);
//req.SetUrl("https://api.ipify.org/?format=json");
//if (g_http->SendRequest(req))
//{
// log_msg("{}", to_string(req.GetDataRecv()));
//}
//Image* img1 = createImageWebp("man.webp");
//saveImage(img1, "image/man.png");
//delete img1;
/*Memory::TestLz4();
Memory::TestZip();
FileXml xml;
xml.Open("test.xml");
FileXmlElement ele = xml.GetChildElement({ "Marker", "Config" });
const XMLAttribute* attr = ele.Get()->FindAttribute("name");
log_msg("{}", attr->Value());*/
/*FileIni ini;
ini.Open("test.ini");
FileIniSection& xiba = ini.GetSection("");
log_msg("{}", xiba.Get("g_y"));
xiba.Del("g_y");
xiba.Add("xuzhongshan", "sb");
xiba.Set("xuzhongshan", "naocan");
ini.Save("test_out.ini");*/
//
/*File::CreateFolder(File::PathStorage() + "image/");
Image* img = createImageSvg("vulkan-logo.svg", { 400, 200 });
saveImage(img, File::PathStorage() + "image/vk_logo.png");
g_factory->RegisterSprite("vk_logo", img);
delete img;*/
/*base = new Base;
base->spr = g_factory->CreateSpriteDefault();
base->txt = g_factory->CreateTextDefault();
base->txt->SetOutline(0);
base->txt->SetFontSize(24);
base->txt->SetString("C++ drawing libaray");
base->spr_logo = g_factory->CreateSprite("vk_logo");
base->spr9 = Sprite9::Create("bg0");*/
// xlsx
/*Vector2<std::string> vec2;
FileXlsx::Read("test.xlsx", vec2);
s = CodeWriter::Create(vec2);
s->Output("out_code.h");*/
/*std::vector<std::string> vec_str = String::FormatString2(vec2);
std::string str;
for (auto& iter : vec_str)
{
str += iter;
str += '\n';
}*/
//s = CodeWriter::Create(vec2);
//s->Output("out_code.h");
//base->txt->SetString(str);
//g_script->Test();
/*std::string str = File::GetString("script/test.txt");
g_script->Call(str);*/
//const int a = 0;
//int* p = (int*)&a;
//*p = 1;
//int x = a;
//int y = 3;
//
//g_factory->LoadModel("viking_room.obj", "room");
//g_factory->LoadModel("assault_drone.glb", "drone");
//
/*g_factory->LoadModel("AK-47.glb", "ak47");
g_factory->LoadModel("Cesium_Man.glb", "man");
g_factory->LoadModel("dog.glb", "dog");
g_factory->LoadModel("DamagedHelmet.gltf", "helmet");*/
//g_factory->LoadModel("Soldier.glb", "soldier");
//g_factory->LoadModel("axis.glb", "axis");
// 脚本加载
//{
// g_as->SetPathRoot("as/");
// std::vector<std::string> vec;
// File::GetPathFileAll("as/", vec, {}, false);
// for (auto& iter : vec)
// {
// g_as->LoadModule(iter);
// }
//}
//// mod加载
//{
// std::vector<std::string> vec;
// File::GetPathFileAll("mod/", vec, {}, false);
// for (auto& iter : vec)
// {
// g_mod->LoadMod(iter);
// }
//}