feat: add DEBUG_MODE and ASSETS_PATH macro

This commit is contained in:
2026-04-16 12:55:36 +08:00
parent 60319ebcd8
commit cd107fa35d
5 changed files with 24 additions and 11 deletions

View File

@@ -1,10 +1,12 @@
#include <fstream>
#include <filesystem>
#include <Cubed/config.hpp>
#include <Cubed/tools/cubed_assert.hpp>
#include <Cubed/tools/shader_tools.hpp>
#include <Cubed/tools/log.hpp>
namespace fs = std::filesystem;
namespace Tools {
@@ -119,11 +121,12 @@ namespace Tools {
}
unsigned char* load_image_data(const std::string& tex_image_path) {
fs::path path = ASSETS_PATH + tex_image_path;
CUBED_ASSERT_MSG(fs::is_regular_file(path), path.c_str());
unsigned char* data = nullptr;
int width, height, channels;
data = SOIL_load_image(tex_image_path.c_str(), &width, &height, &channels, SOIL_LOAD_AUTO);
std::string error_info = "Could not load texture " + tex_image_path;
CUBED_ASSERT_MSG(data, error_info.c_str());
data = SOIL_load_image(path.c_str(), &width, &height, &channels, SOIL_LOAD_AUTO);
CUBED_ASSERT_MSG(data, "Could not load texture" + path.string());
return data;
}