Allow Changing Input Mode

This commit is contained in:
TheBrokenRail
2023-11-02 19:21:39 -04:00
committed by iProgramInCpp
parent 7771bc20a7
commit c989ffa721
5 changed files with 36 additions and 5 deletions

View File

@@ -3,6 +3,7 @@
#include <sstream>
#include <fstream>
#include <sys/stat.h>
#include <cstdlib>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
@@ -31,6 +32,26 @@ void AppPlatform_sdl_base::_init(std::string storageDir, SDL_Window *window)
m_pLogger = new Logger;
m_pSoundSystem = nullptr;
// Default Touchscreen Mode
#ifdef ANDROID
m_bIsTouchscreen = true;
#else
m_bIsTouchscreen = false;
#endif
// Custom Touchscreen Mode
const char *mode = getenv("MCPE_INPUT_MODE");
if (mode)
{
if (strcmp(mode, "touch") == 0)
{
m_bIsTouchscreen = true;
}
else if (strcmp(mode, "mouse") == 0)
{
m_bIsTouchscreen = false;
}
}
}
void AppPlatform_sdl_base::initSoundSystem()
@@ -244,3 +265,7 @@ void AppPlatform_sdl_base::hideKeyboard()
SDL_StopTextInput();
}
}
bool AppPlatform_sdl_base::isTouchscreen() {
return m_bIsTouchscreen;
}