diff options
| author | Mel <einebeere@gmail.com> | 2024-04-13 07:59:29 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2024-04-13 07:59:29 +0200 |
| commit | 727983e0a7033e0b778c38e0a0b51a5bc0e9fc2b (patch) | |
| tree | 76919734109190ea5b867ea89df169f3b7afaf9a /src/Assets.hpp | |
| parent | 4ce39fff5cf708887817870977d2dbaaee19f9c9 (diff) | |
| download | meowcraft-727983e0a7033e0b778c38e0a0b51a5bc0e9fc2b.tar.zst meowcraft-727983e0a7033e0b778c38e0a0b51a5bc0e9fc2b.zip | |
Create Meson build configuration
Diffstat (limited to 'src/Assets.hpp')
| -rw-r--r-- | src/Assets.hpp | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/Assets.hpp b/src/Assets.hpp index f4b2f46..0de6d90 100644 --- a/src/Assets.hpp +++ b/src/Assets.hpp @@ -2,23 +2,29 @@ #include "Common/Sizes.hpp" -namespace MC::Assets { - -namespace Shaders { - -#define MC_ASSETS_SHADER(name) namespace name { extern Char const* vertex; extern Char const* fragment; } +#define MC_DECLARE_ASSET(ns, name, raw_name) \ + namespace Files { extern char const* raw_name; } \ + namespace ns { extern Char const* name; } -MC_ASSETS_SHADER(terrain) -MC_ASSETS_SHADER(clouds) -MC_ASSETS_SHADER(block_outline) -MC_ASSETS_SHADER(image_viewer) +#define MC_DECLARE_SHADER_ASSET(name) \ + MC_DECLARE_ASSET(Shaders::name, vertex, shaders_##name##_vertex) \ + MC_DECLARE_ASSET(Shaders::name, fragment, shaders_##name##_fragment) -} +namespace MC::Assets { -namespace Images { +MC_DECLARE_SHADER_ASSET(terrain) +MC_DECLARE_SHADER_ASSET(clouds) +MC_DECLARE_SHADER_ASSET(block_outline) +MC_DECLARE_SHADER_ASSET(image_viewer) -extern Char const* atlas; +MC_DECLARE_ASSET(Images, atlas, images_atlas_ppm) } -} \ No newline at end of file +// NOTE: We need to declare dependencies both in Assets.cpp and and here +// in Assets.hpp but only because we rename the variable name from it's +// file name to a more readable name. If we didn't do that we could just +// declare the variable in the hpp file, without needing another compilation +// unit at all. +// This would work easily if there was a using x = y; directive that didn't +// just work for types but for variables as well. But there isn't, I think.. :( \ No newline at end of file |
