irrtation

main
Brett 2025-04-11 16:31:31 -04:00
parent 05ef5a0297
commit 19d656e49f
3 changed files with 11 additions and 17 deletions

View File

@ -49,7 +49,7 @@ macro(blt_add_project name source type)
project(4p78-final-project) project(4p78-final-project)
endmacro() 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_ADDRSAN "Enable the address sanitizer" OFF)
option(ENABLE_UBSAN "Enable the ub 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) add_subdirectory(lib/blt-with-graphics)
include_directories(include/) include_directories(include/)
file(GLOB_RECURSE PROJECT_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") file(GLOB_RECURSE PROJECT_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
add_executable(4p78-final-project ${PROJECT_BUILD_FILES}) 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) 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}) if (${BUILD_4P78_FINAL_PROJECT_EXAMPLES})
endif() endif()

@ -1 +1 @@
Subproject commit ebcdbeb172bc8874b7898a01acad29560ad5d068 Subproject commit 1808af68b55e6bbcbc8ce82dcccbe12c21a7b38a

View File

@ -21,6 +21,7 @@
#include "blt/gfx/renderer/camera.h" #include "blt/gfx/renderer/camera.h"
#include "blt/gfx/renderer/resource_manager.h" #include "blt/gfx/renderer/resource_manager.h"
#include <string> #include <string>
#include <blt/std/requests.h>
#ifdef __EMSCRIPTEN__ #ifdef __EMSCRIPTEN__
#include <emscripten.h> #include <emscripten.h>
@ -105,21 +106,7 @@ struct parker_json_t
} aaWorld; } aaWorld;
}; };
std::string send_get_request(const std::string& url)
{
#ifdef __EMSCRIPTEN__
auto* str = static_cast<char*>(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() void check_for_request()
{ {
@ -138,6 +125,8 @@ void init(const blt::gfx::window_data&)
{ {
using namespace blt::gfx; using namespace blt::gfx;
BLT_TRACE("{}", blt::requests::send_get_request("https://tpgc.me/"));
global_matrices.create_internals(); global_matrices.create_internals();
resources.load_resources(); resources.load_resources();
renderer_2d.create(); renderer_2d.create();
@ -151,7 +140,7 @@ void update(const blt::gfx::window_data& data)
camera.update_view(global_matrices); camera.update_view(global_matrices);
global_matrices.update(); global_matrices.update();
check_for_request();
ImGui::SetNextWindowSize(ImVec2(300, static_cast<float>(data.height))); ImGui::SetNextWindowSize(ImVec2(300, static_cast<float>(data.height)));
ImGui::SetNextWindowPos(ImVec2(0, 0)); ImGui::SetNextWindowPos(ImVec2(0, 0));