Commit 13a316fe authored by Lotrado's avatar Lotrado
Browse files

Added error check for missing resources for embedded assets on MSVC.

parent 1c0fb00c
......@@ -28,11 +28,16 @@ macro(mirrage_embed_asset target src_files)
string(TOUPPER "${ID}" RES_ID)
set(PLATFORM_EMBED_SRC
"#include <windows.h>
#include <stdexcept>
static auto create_asset() -> mirrage::asset::Embedded_asset {
auto handle = GetModuleHandle(NULL);
auto res = FindResource(handle, \"${RES_ID}\", RT_RCDATA);
if(!res){
throw std::runtime_error(\"Couldn't find ressource ${RES_ID}.\");
}
return mirrage::asset::Embedded_asset(\"${target}\",
gsl::span<const gsl::byte>{reinterpret_cast<const gsl::byte*>(LockResource(LoadResource(handle, res))),
static_cast<int>(SizeofResource(handle, res))});
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment