OpenRCT2/src/openrct2-ui/UiContext.Android.cpp

98 lines
2.6 KiB
C++
Raw Normal View History

2017-06-15 14:22:15 +02:00
/*****************************************************************************
* Copyright (c) 2014-2024 OpenRCT2 developers
*
* 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>
# include <jni.h>
2018-07-21 16:17:06 +02:00
# include <openrct2/common.h>
# include <openrct2/core/String.hpp>
# 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
{
LOG_VERBOSE(message.c_str());
2017-06-15 14:22:15 +02: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
{
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
{
LOG_INFO(title.c_str());
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
{
}
void OpenURL(const std::string& url) override
{
LOG_WARNING("Function %s at %s:%d is a stub.", __PRETTY_FUNCTION__, __FILE__, __LINE__);
}
2020-11-08 13:29:44 +01:00
bool HasFilePicker() const override
{
return false;
}
2018-02-16 00:43:16 +01:00
};
std::unique_ptr<IPlatformUiContext> CreatePlatformUiContext()
2018-02-16 00:43:16 +01: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__