From 19d656e49f64531ab5aafadd9d33a8b46b42a4c7 Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Fri, 11 Apr 2025 16:31:31 -0400 Subject: [PATCH] irrtation --- CMakeLists.txt | 7 ++++++- lib/blt-with-graphics | 2 +- src/main.cpp | 19 ++++--------------- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7cb1f83..9c64fcb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ macro(blt_add_project name source type) project(4p78-final-project) endmacro() -project(4p78-final-project VERSION 0.0.5) +project(4p78-final-project VERSION 0.0.6) option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF) option(ENABLE_UBSAN "Enable the ub sanitizer" OFF) @@ -62,6 +62,7 @@ set(CMAKE_CXX_STANDARD 17) add_subdirectory(lib/blt-with-graphics) include_directories(include/) + file(GLOB_RECURSE PROJECT_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") add_executable(4p78-final-project ${PROJECT_BUILD_FILES}) @@ -70,6 +71,10 @@ compile_options(4p78-final-project) target_link_libraries(4p78-final-project PRIVATE BLT_WITH_GRAPHICS) +if (EMSCRIPTEN) + include(lib/blt-with-graphics/cmake/link_flags.cmake) +endif () + if (${BUILD_4P78_FINAL_PROJECT_EXAMPLES}) endif() diff --git a/lib/blt-with-graphics b/lib/blt-with-graphics index ebcdbeb..1808af6 160000 --- a/lib/blt-with-graphics +++ b/lib/blt-with-graphics @@ -1 +1 @@ -Subproject commit ebcdbeb172bc8874b7898a01acad29560ad5d068 +Subproject commit 1808af68b55e6bbcbc8ce82dcccbe12c21a7b38a diff --git a/src/main.cpp b/src/main.cpp index d27a95a..e0371e7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,6 +21,7 @@ #include "blt/gfx/renderer/camera.h" #include "blt/gfx/renderer/resource_manager.h" #include +#include #ifdef __EMSCRIPTEN__ #include @@ -105,21 +106,7 @@ struct parker_json_t } aaWorld; }; -std::string send_get_request(const std::string& url) -{ - #ifdef __EMSCRIPTEN__ - auto* str = static_cast(EM_ASM_PTR( - { const v = await fetch('$0', { 'credentials': 'omit', 'headers': { 'User-Agent': - 'Mozilla/5.0 (X11; Linux x86_64; rv:136.0) Gecko/20100101 Firefox/136.0', 'Accept': '/', 'Accept-Language': 'en-US,en;q=0.5', 'Priority': - 'u=4' }, 'method': 'GET', 'mode': 'cors' }); if (!v.ok) { throw v.status; } return stringToNewUTF8(await response.text()); }, - url.c_str())); - std::string str_obj{str}; - free(str); - return str_obj; - #else - #endif -} void check_for_request() { @@ -138,6 +125,8 @@ void init(const blt::gfx::window_data&) { using namespace blt::gfx; + BLT_TRACE("{}", blt::requests::send_get_request("https://tpgc.me/")); + global_matrices.create_internals(); resources.load_resources(); renderer_2d.create(); @@ -151,7 +140,7 @@ void update(const blt::gfx::window_data& data) camera.update_view(global_matrices); global_matrices.update(); - check_for_request(); + ImGui::SetNextWindowSize(ImVec2(300, static_cast(data.height))); ImGui::SetNextWindowPos(ImVec2(0, 0));