2017-06-15 14:22:15 +02:00
|
|
|
/*****************************************************************************
|
2024-01-01 12:52:28 +01:00
|
|
|
* Copyright (c) 2014-2024 OpenRCT2 developers
|
2018-06-15 14:07:34 +02:00
|
|
|
*
|
|
|
|
* For a complete list of all authors, please refer to contributors.md
|
|
|
|
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
|
|
|
*
|
|
|
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
|
|
|
*****************************************************************************/
|
2017-06-15 14:22:15 +02:00
|
|
|
|
|
|
|
#ifdef __ANDROID__
|
|
|
|
|
2018-07-21 16:17:06 +02:00
|
|
|
# include "UiContext.h"
|
2018-06-22 23:22:29 +02:00
|
|
|
|
2018-07-21 16:17:06 +02:00
|
|
|
# include <SDL.h>
|
|
|
|
# include <dlfcn.h>
|
2019-01-04 19:48:26 +01:00
|
|
|
# include <jni.h>
|
2018-07-21 16:17:06 +02:00
|
|
|
# include <openrct2/common.h>
|
|
|
|
# include <openrct2/core/String.hpp>
|
2022-02-18 21:57:00 +01:00
|
|
|
# include <openrct2/platform/Platform.h>
|
2018-07-21 16:17:06 +02:00
|
|
|
# include <openrct2/ui/UiContext.h>
|
|
|
|
# include <sstream>
|
|
|
|
# include <stdexcept>
|
2017-06-15 14:22:15 +02:00
|
|
|
|
2018-02-16 00:43:16 +01:00
|
|
|
namespace OpenRCT2::Ui
|
|
|
|
{
|
|
|
|
class AndroidContext final : public IPlatformUiContext
|
2017-06-15 14:22:15 +02:00
|
|
|
{
|
2018-02-16 00:43:16 +01:00
|
|
|
private:
|
|
|
|
public:
|
|
|
|
AndroidContext()
|
2017-06-15 14:22:15 +02:00
|
|
|
{
|
2018-02-16 00:43:16 +01:00
|
|
|
}
|
2017-06-15 14:22:15 +02:00
|
|
|
|
2018-06-22 23:22:29 +02:00
|
|
|
void SetWindowIcon(SDL_Window* window) override
|
2018-02-16 00:43:16 +01:00
|
|
|
{
|
|
|
|
}
|
2017-06-15 14:22:15 +02:00
|
|
|
|
2018-02-16 00:43:16 +01:00
|
|
|
bool IsSteamOverlayAttached() override
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2017-06-15 14:22:15 +02:00
|
|
|
|
2020-10-21 19:53:22 +02:00
|
|
|
bool HasMenuSupport() override
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
int32_t ShowMenuDialog(
|
|
|
|
const std::vector<std::string>& options, const std::string& title, const std::string& text) override
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2018-06-22 23:22:29 +02:00
|
|
|
void ShowMessageBox(SDL_Window* window, const std::string& message) override
|
2018-02-16 00:43:16 +01:00
|
|
|
{
|
2023-01-17 13:24:51 +01:00
|
|
|
LOG_VERBOSE(message.c_str());
|
2017-06-15 14:22:15 +02:00
|
|
|
|
2020-02-24 13:48:32 +01:00
|
|
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "OpenRCT2", message.c_str(), window);
|
2018-02-16 00:43:16 +01:00
|
|
|
}
|
2017-06-15 14:22:15 +02:00
|
|
|
|
2018-06-22 23:22:29 +02:00
|
|
|
std::string ShowFileDialog(SDL_Window* window, const FileDialogDesc& desc) override
|
2018-02-16 00:43:16 +01:00
|
|
|
{
|
2023-07-02 11:59:20 +02:00
|
|
|
LOG_WARNING("Function %s at %s:%d is a stub.", __PRETTY_FUNCTION__, __FILE__, __LINE__);
|
2017-06-15 14:22:15 +02:00
|
|
|
|
2018-02-16 00:43:16 +01:00
|
|
|
return nullptr;
|
|
|
|
}
|
2017-06-15 14:22:15 +02:00
|
|
|
|
2018-06-22 23:22:29 +02:00
|
|
|
std::string ShowDirectoryDialog(SDL_Window* window, const std::string& title) override
|
2017-06-15 14:22:15 +02:00
|
|
|
{
|
2023-01-17 13:24:51 +01:00
|
|
|
LOG_INFO(title.c_str());
|
2023-07-02 11:59:20 +02:00
|
|
|
LOG_WARNING("Function %s at %s:%d is a stub.", __PRETTY_FUNCTION__, __FILE__, __LINE__);
|
2018-02-16 00:43:16 +01:00
|
|
|
|
|
|
|
return "/sdcard/rct2";
|
2017-06-15 14:22:15 +02:00
|
|
|
}
|
2018-09-20 21:53:34 +02:00
|
|
|
|
|
|
|
void OpenFolder(const std::string& path) override
|
|
|
|
{
|
|
|
|
}
|
2020-07-26 21:57:56 +02:00
|
|
|
|
|
|
|
void OpenURL(const std::string& url) override
|
|
|
|
{
|
2023-07-02 11:59:20 +02:00
|
|
|
LOG_WARNING("Function %s at %s:%d is a stub.", __PRETTY_FUNCTION__, __FILE__, __LINE__);
|
2020-07-26 21:57:56 +02:00
|
|
|
}
|
2020-11-08 13:29:44 +01:00
|
|
|
|
|
|
|
bool HasFilePicker() const override
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2018-02-16 00:43:16 +01:00
|
|
|
};
|
|
|
|
|
2022-07-28 19:19:38 +02:00
|
|
|
std::unique_ptr<IPlatformUiContext> CreatePlatformUiContext()
|
2018-02-16 00:43:16 +01:00
|
|
|
{
|
2022-07-28 19:19:38 +02:00
|
|
|
return std::make_unique<AndroidContext>();
|
2018-02-16 00:43:16 +01:00
|
|
|
}
|
2018-06-22 23:22:29 +02:00
|
|
|
} // namespace OpenRCT2::Ui
|
2017-06-15 14:22:15 +02:00
|
|
|
|
|
|
|
#endif // __ANDROID__
|