Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GameDevWeek
Dependencies
Cpp
mirrage
Commits
13a316fe
Commit
13a316fe
authored
Feb 22, 2019
by
Lotrado
Browse files
Added error check for missing resources for embedded assets on MSVC.
parent
1c0fb00c
Changes
1
Hide whitespace changes
Inline
Side-by-side
embed_assets.cmake
View file @
13a316fe
...
...
@@ -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))});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment