Init commit

This commit is contained in:
2026-08-17 06:31:43 +09:00
commit 348d9275f6
428 changed files with 61806 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
add_executable(${TG_CONSOLE}
# WIN32
main.cpp
example_assimp.cpp
)
target_link_libraries(${TG_CONSOLE} PRIVATE
${TG_TOOL}
${TG_RENDER}
${TG_CORE}
${TG_ZASSIMP}
)
target_include_directories(${TG_CONSOLE}
PRIVATE
${TEMPLATE_DIR_INCLUDE}
)
COPY_DEPS_TO_EXE_DIR(${TG_CONSOLE})
+21
View File
@@ -0,0 +1,21 @@
#include <iostream>
#include <Windows.h>
#include <zassimp/importer.h>
#include <tool.h>
#include <filesystem>
#include <io.h>
#include <fcntl.h>
int TestAssimp() {
SetConsoleOutputCP(CP_UTF8);
std::filesystem::path file{"C:/Users/amane/Desktop/assimp_test/assimp_test.fbx"};
std::cout << "exist:" << std::boolalpha << std::filesystem::exists(file) << std::endl;
Importer imp{};
Z::Model *data{};
imp.ImportFromFile(file, &data);
return 0;
}
+14
View File
@@ -0,0 +1,14 @@
#include <zcv.h>
void Test_CV() {
cv::Mat img = ZCV::readImage("test.jpg");
cv::Mat gray = ZCV::ensureGray(img);
cv::Mat edges = ZCV::canny(gray, 80, 160);
cv::Mat closed = ZCV::morph(edges, ZCV::MorphType::Close, 5);
std::vector<ZCV::ContourInfo> contours = ZCV::findContoursInfo(closed, cv::RETR_EXTERNAL);
cv::Mat vis = ZCV::drawContourInfos(img, contours, cv::Scalar(0, 255, 0), 2, true, true);
ZCV::saveImage("result.jpg", vis);
}
+25
View File
@@ -0,0 +1,25 @@
#include "zcurl.h"
#include <iostream>
namespace ZCURL{
int test() {
try {
ZCURL::RequestOptions opt;
opt.query_params = {{"q", "C++20 libcurl"}};
opt.headers = {"Accept: application/json"};
opt.timeout_ms = 10000;
opt.http_version = ZCURL::HttpVersion::V2TLS;
auto res = ZCURL::get("https://httpbin.org/get", opt);
std::cout << "curl: " << ZCURL::version() << "\n";
std::cout << "status: " << res.status_code << "\n";
std::cout << "ok: " << res.ok() << "\n";
std::cout << res.body.substr(0, 300) << "\n";
return 0;
} catch (const std::exception &e) {
std::cerr << "error: " << e.what() << "\n";
return 1;
}
}
}
+74
View File
@@ -0,0 +1,74 @@
#include <iostream>
#include <Windows.h>
// class WndTest : public Wndbase<WndTest> {
// public:
// static PCWSTR CLASSNAME() {return L"TestWndClass";}
// static void UpdateWnd(){};
// LRESULT WndProc(UINT msg, WPARAM wparam, LPARAM lparam) override {
// switch (msg) {
// case WM_DESTROY: {
// PostQuitMessage(0);
// return 0;
// }
// default: {
// return DefWindowProc(hwnd_, msg, wparam, lparam);
// }
// }
// }
// protected:
// bool EDGEMODE() override { return false; }
//
// };
//
//
// int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR lpCmdLine, int nShowCmd) {
//
// WndTest test{};
// test.Init(hInstance, L"test window");
// test.Exec(nShowCmd);
//
// return 0;
// }
class Test {
static int id;
public:
Test() {
std::cout << "[" << id++ << "] 构造器" << std::endl;
}
Test(const Test &other) {
std::cout << "[" << id++ << "] 拷贝构造" << std::endl;
}
Test &operator=(const Test &oter) {
std::cout << "[" << id++ << "] 拷贝赋值" << std::endl;
return *this;
}
Test(Test &&other) noexcept {
std::cout << "[" << id++ << "] 移动构造" << std::endl;
}
Test &operator=(Test &&other) noexcept {
std::cout << "[" << id++ << "] 移动赋值" << std::endl;
return *this;
}
int t{};
};
int Test::id = 0;
void test(Test t) {
t.t = 887;
std::cout << "in test function , t=" << t.t << std::endl;
}
int main(int argc, char **argv) {
SetConsoleOutputCP(CP_UTF8);
Test t{};
test(std::move(t));
std::cout << "回到main,此时t=" << t.t << std::endl;
}