mirror of
https://github.com/celisej567/mcpe.git
synced 2026-01-04 14:09:47 +03:00
* Android: Determine feature availability at compile time.
Since assets are baked in to the APK, we can simply check for the existence of assets at compile time using CMake.
This commit is contained in:
@@ -397,8 +397,35 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd) {
|
||||
}
|
||||
}
|
||||
|
||||
extern bool g_bIsMenuBackgroundAvailable; // client/gui/Screen.cpp
|
||||
extern bool g_bAreCloudsAvailable; // client/renderer/LevelRenderer.cpp
|
||||
extern bool g_bIsGrassColorAvailable; // world/level/GrassColor.cpp
|
||||
extern bool g_bIsFoliageColorAvailable; // world/level/FoliageColor.cpp
|
||||
|
||||
static void CheckOptionalTextureAvailability()
|
||||
{
|
||||
#ifdef FEATURE_MENU_BACKGROUND
|
||||
g_bIsMenuBackgroundAvailable = true;
|
||||
#endif
|
||||
|
||||
#ifdef FEATURE_CLOUDS
|
||||
g_bAreCloudsAvailable = true;
|
||||
#endif
|
||||
|
||||
#ifdef FEATURE_GRASS_COLOR
|
||||
g_bIsGrassColorAvailable = true;
|
||||
#endif
|
||||
|
||||
#ifdef FEATURE_FOLIAGE_COLOR
|
||||
g_bIsFoliageColorAvailable = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void android_main(struct android_app* state) {
|
||||
struct engine engine;
|
||||
|
||||
CheckOptionalTextureAvailability();
|
||||
|
||||
memset(&engine, 0, sizeof(engine));
|
||||
state->userData = &engine;
|
||||
|
||||
@@ -33,6 +33,23 @@ add_library( # Sets the name of the library.
|
||||
${MC_ROOT}/platforms/android/main.cpp
|
||||
${MC_ROOT}/thirdparty/stb_image_impl.c)
|
||||
|
||||
# Check for the presence of some optional asset based features.
|
||||
if(NOT EXISTS "${MC_ROOT}/game/assets/gui/background/panorama_0.png")
|
||||
target_compile_definitions(reminecraftpe PUBLIC FEATURE_MENU_BACKGROUND)
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${MC_ROOT}/game/assets/environment/clouds.png")
|
||||
target_compile_definitions(reminecraftpe PUBLIC FEATURE_CLOUDS)
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${MC_ROOT}/game/assets/misc/grasscolor.png")
|
||||
target_compile_definitions(reminecraftpe PUBLIC FEATURE_GRASS_COLOR)
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${MC_ROOT}/game/assets/misc/foliagecolor.png")
|
||||
target_compile_definitions(reminecraftpe PUBLIC FEATURE_FOLIAGE_COLOR)
|
||||
endif()
|
||||
|
||||
# Add the core as part of the library.
|
||||
add_subdirectory(${MC_ROOT}/source source)
|
||||
target_link_libraries(reminecraftpe reminecraftpe-core)
|
||||
|
||||
@@ -299,7 +299,7 @@ void CheckOptionalTextureAvailability()
|
||||
g_bIsMenuBackgroundAvailable = DoesAssetExist("gui/background/panorama_0.png");
|
||||
g_bAreCloudsAvailable = DoesAssetExist("environment/clouds.png");
|
||||
g_bIsGrassColorAvailable = DoesAssetExist("misc/grasscolor.png");
|
||||
g_bIsFoliageColorAvailable = DoesAssetExist("misc/foliagecolor.png");
|
||||
g_bIsFoliageColorAvailable = DoesAssetExist("misc/foliagecolor.png");
|
||||
}
|
||||
|
||||
// Main
|
||||
|
||||
Reference in New Issue
Block a user