diff --git a/README.md b/README.md index 5d18230a..d6b97f1d 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,13 @@ dl(drawing library)是以 C++ 语言为基础,集成各类 C/C++ 开源库 5. 使用 vscode打开 项目文件夹,选中根目录CMakeLists.txt生成 6. 下方选中 B.Linux Clang 编译执行dl_test +建议执行操作: +1. cmake设置多线程编译(0不会用满): +Ctrl+, 然后设置 cmake.parallelJobs +2. CodeLLDB 插件用于调试 + + + ### Linux(CentOS) !作者本人未测试 ``` diff --git a/dl/math/dl_algorithm.h b/dl/math/dl_algorithm.h index a017090d..43d56415 100644 --- a/dl/math/dl_algorithm.h +++ b/dl/math/dl_algorithm.h @@ -114,6 +114,13 @@ inline const T& as_const(T& a) #endif } +//! C++23 容器增加的接口临时使用 +template +void append_range(C& a, const C& b) +{ + a.insert(a.end(), b.begin(), b.end()); +} + //-------------------------------------------------------other----------------------------------------- /** diff --git a/dl/render/dl_factory.cpp b/dl/render/dl_factory.cpp index 5f266125..449eac11 100644 --- a/dl/render/dl_factory.cpp +++ b/dl/render/dl_factory.cpp @@ -1906,12 +1906,12 @@ void Factory::_load_sprite_sub(std::string_view path, std::string_view name, std { std::vector vec_x; vec_x.push_back(0); - vec_x.append_range(vec_split_x); + append_range(vec_x, vec_split_x); vec_x.push_back(img_size.w); std::vector vec_y; vec_y.push_back(0); - vec_y.append_range(vec_split_y); + append_range(vec_y, vec_split_y); vec_y.push_back(img_size.h); size_t index = 0; diff --git a/dl/render/dl_particle.cpp b/dl/render/dl_particle.cpp index 169e07a6..22fd29c2 100644 --- a/dl/render/dl_particle.cpp +++ b/dl/render/dl_particle.cpp @@ -185,8 +185,8 @@ namespace dl float v = Random::Float(_config->_config.node.speed); float radin = Random::Float(_config->_radin); - node._v.x = v * std::cosf(radin); - node._v.y = v * std::sinf(radin); + node._v.x = v * cosf(radin); + node._v.y = v * sinf(radin); node._tLife = Random::Float(_config->_config.node.lifetime); node._tEnd = t + node._tLife; diff --git a/dl/system/dl_system.cpp b/dl/system/dl_system.cpp index 5925f0c5..fe5191ed 100644 --- a/dl/system/dl_system.cpp +++ b/dl/system/dl_system.cpp @@ -801,6 +801,16 @@ void System::Pause() #endif } +void OpenFolder(std::string_view path_name) +{ +#if DL_PLATFORM == DL_PLATFORM_WIN32 + Win32::Open +#else + std::string command = fmt::format("xdg-open \"{}\"", path_name); + system(command.c_str()); +#endif +} + } #endif \ No newline at end of file diff --git a/dl/system/dl_system.h b/dl/system/dl_system.h index a337b297..efd3a083 100644 --- a/dl/system/dl_system.h +++ b/dl/system/dl_system.h @@ -208,6 +208,9 @@ public: //! 暂停程序,等待用户输入后继续(Windows:按任意键;其他平台:回车) void Pause(); + //! 打开文件浏览器 + void OpenFolder(std::string_view path_name); + //! 内部调用 void _add_drop_file(std::string_view str) {