AppPlatform Fixes

This commit is contained in:
TheBrokenRail
2023-11-03 17:10:05 -04:00
committed by iProgramInCpp
parent 2356757730
commit 06c69d3cc8
18 changed files with 202 additions and 135 deletions

View File

@@ -283,7 +283,17 @@ void AppPlatform_android::setShiftPressed(bool b)
m_bShiftPressed = b;
}
void AppPlatform_android::showKeyboard(bool bShown)
void AppPlatform_android::showKeyboard(int x, int y, int w, int h)
{
changeKeyboardVisibility(true);
}
void AppPlatform_android::hideKeyboard()
{
changeKeyboardVisibility(false);
}
void AppPlatform_android::changeKeyboardVisibility(bool bShown)
{
JavaVM* pVM = m_app->activity->vm;
JNIEnv* pEnv = m_app->activity->env;
@@ -340,11 +350,6 @@ void AppPlatform_android::showKeyboard(bool bShown)
pVM->DetachCurrentThread();
}
void AppPlatform_android::onHideKeyboard()
{
m_bIsKeyboardShown = false;
}
int AppPlatform_android::getKeyboardUpOffset()
{
// @TODO

View File

@@ -46,8 +46,8 @@ public:
// Also add these to allow proper text input within the game.
bool shiftPressed() override;
void setShiftPressed(bool b);
void showKeyboard(bool bShown) override;
void onHideKeyboard() override; // This is an event
void showKeyboard(int x, int y, int w, int h) override;
void hideKeyboard() override;
int getKeyboardUpOffset() override;
// Also add these to allow saving options.
@@ -63,6 +63,8 @@ public:
void setExternalStoragePath(const std::string& path);
private:
void changeKeyboardVisibility(bool bShown);
int m_ScreenWidth;
int m_ScreenHeight;

View File

@@ -1,59 +1,35 @@
# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html
# Sets the minimum version of CMake required to build the native library.
cmake_minimum_required(VERSION 3.16.0)
project(reminecraftpe-android)
# Declares and names the project.
# Project Root
set(MC_ROOT ../../../../../../..)
project("reminecraftpe")
# Build
add_compile_definitions(USE_NATIVE_ANDROID)
add_library(reminecraftpe SHARED
"${MC_ROOT}/platforms/android/android_native_app_glue.c"
"${MC_ROOT}/platforms/android/AppPlatform_android.cpp"
"${MC_ROOT}/platforms/android/main.cpp"
"${MC_ROOT}/thirdparty/stb_image_impl.c"
)
# The root of the project
SET(MC_ROOT ../../../../../../..)
# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.
add_library( # Sets the name of the library.
reminecraftpe
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
${MC_ROOT}/platforms/android/android_native_app_glue.c
${MC_ROOT}/platforms/android/AppPlatform_android.cpp
${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)
# Core
add_subdirectory("${MC_ROOT}/source" source)
target_link_libraries(reminecraftpe reminecraftpe-core)
# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.
# Extra Dependencies
target_link_libraries(reminecraftpe android)
target_link_libraries( # Specifies the target library.
reminecraftpe android )
# Check for the presence of some optional asset based features.
if(EXISTS "${MC_ROOT}/game/assets/gui/background/panorama_0.png")
target_compile_definitions(reminecraftpe PUBLIC FEATURE_MENU_BACKGROUND)
endif()
if(EXISTS "${MC_ROOT}/game/assets/environment/clouds.png")
target_compile_definitions(reminecraftpe PUBLIC FEATURE_CLOUDS)
endif()
if(EXISTS "${MC_ROOT}/game/assets/misc/grasscolor.png")
target_compile_definitions(reminecraftpe PUBLIC FEATURE_GRASS_COLOR)
endif()
if(EXISTS "${MC_ROOT}/game/assets/misc/foliagecolor.png")
target_compile_definitions(reminecraftpe PUBLIC FEATURE_FOLIAGE_COLOR)
endif()