WIP Android Port (#79)

* WIP Android Port

Android port. Still needs touch controls and mouse turning (if that's even possible on android) and file saving and SoundSystemSL
You control the camera and movement with your controller for now. You can navigate the gui using touch.
Options.cpp,LocalPlayer.cpp,Minecraft.cpp is configured to use controller.
Blocked out some code in ControllerTurnInput.cpp,Controller.cpp that didn't make sense.

* Fix glClear

glClear is supossed to use GL_DEPTH_BUFFER_BIT (thx TheBrokenRail)

* * Fix build.

* * Ignore assets.

* * More stuff

* * Fix more build errors.

* * It finally built

What I needed to do is rebuild the debug keystore because apparently android studio created it with sha1 digest alg which isn't supported by ant

* * Clean up filters.

* * Add cramped mode to the pause screen.

* * Fix a bug with the hotbar

* * In NinecraftApp::handleBack, pause the game if there is no screen.

* * AppPlatform_android: Add placeholder SoundSystem instance till we get SoundSystemSL working

* * Add properly working touch code.

* * Oh, remove some testing things

* * Fix state resetting when going in background and back in foreground
* Fix bug where the sky isn't being regenerated on graphics reset
* Fix bug where the m_currBoundTex isn't reset in Textures::clear potentially leaving a texture with that ID unassigned and corrupted
* Fix bug in CThread where the thread is detached and then also joined.
* Don't log anything if the program isn't in debug mode.

* * Add virtual keyboard support.

The screen instance slides so that the focused text box is kept visible.

* Rename from com.minecraftcpp to com.reminecraftpe

---------

Co-authored-by: iProgramInCpp <iprogramincpp@gmail.com>
This commit is contained in:
f
2023-11-03 11:54:39 +01:00
committed by GitHub
parent f119d89048
commit f83ead9f8d
59 changed files with 5742 additions and 424 deletions

View File

@@ -17,7 +17,7 @@ public:
static Logger* const singleton();
Logger();
~Logger();
virtual ~Logger();
const char* GetTag(eLogLevel ll);
virtual void print(eLogLevel, const char* const str);
@@ -26,20 +26,37 @@ public:
virtual void printf(eLogLevel, const char* const fmt, ...);
};
// TODO: For now
#ifdef __ANDROID__
#ifndef NDEBUG
#define _DEBUG
#endif
#endif
#ifdef _DEBUG
#define LOG(level, ...) Logger::singleton()->printf(level, __VA_ARGS__)
#ifdef PLATFORM_ANDROID
#ifdef __ANDROID__
#undef LOG
#define LOG_INFO ANDROID_LOG_INFO
#define LOG_ERR ANDROID_LOG_ERROR
#define LOG_WARN ANDROID_LOG_WARN
#include <android/log.h>
// TODO: Add a LoggerAndroid
#define LOG(ignored, ...) __android_log_print(ANDROID_LOG_DEFAULT, "ReMinecraftPE", __VA_ARGS__)
#define LOG_I(...) __android_log_print(ANDROID_LOG_INFO, "ReMinecraftPE", __VA_ARGS__)
#define LOG_W(...) __android_log_print(ANDROID_LOG_WARN, "ReMinecraftPE", __VA_ARGS__)
#define LOG_E(...) __android_log_print(ANDROID_LOG_ERROR, "ReMinecraftPE", __VA_ARGS__)
#define LOG(level, ...) __android_log_print(level, "ReMinecraftPE", __VA_ARGS__)
#define LOG_I(...) __android_log_print(ANDROID_LOG_INFO, "ReMinecraftPE", __VA_ARGS__)
#define LOG_W(...) __android_log_print(ANDROID_LOG_WARN, "ReMinecraftPE", __VA_ARGS__)
#define LOG_E(...) __android_log_print(ANDROID_LOG_ERROR, "ReMinecraftPE", __VA_ARGS__)
#else
#define LOG_I(...) LOG(LOG_INFO, __VA_ARGS__)
#define LOG_W(...) LOG(LOG_WARN, __VA_ARGS__)
#define LOG_E(...) LOG(LOG_ERR, __VA_ARGS__)
#endif
#else

View File

@@ -138,7 +138,7 @@ float Mth::abs(float f)
int Mth::abs(int d)
{
return ::abs(d);
return Mth::abs((float)d);
}
float Mth::absMax(float a2, float a3)

View File

@@ -22,7 +22,7 @@ float SmoothFloat::getNewDeltaValue(float a1, float a2)
float v1 = (field_0 - field_4) * a2;
field_8 += 0.5f * (v1 - field_8);
if (v1 > 0.0f && field_8 < v1 || v1<0.0f && field_8>v1)
if ((v1 > 0.0f && field_8 < v1) || (v1 < 0.0f && field_8 > v1))
v1 = field_8;
field_4 += v1;

View File

@@ -31,11 +31,12 @@
#endif
// include zlib stuff
// cant get zlib to build on android, they include prebuilt one anyways. using that one
#include "zlib.h"
int g_TimeSecondsOnInit = 0;
#if !defined(USE_SDL) || defined(_WIN32)
#if (!defined(USE_SDL) || defined(_WIN32)) && !defined(__ANDROID__)
DIR* opendir(const char* name)
{