Files
OpenRCT2-Web/src/openrct2/platform/Android.cpp
T

60 lines
1.6 KiB
C++
Raw Normal View History

2017-06-15 14:22:15 +02:00
/*****************************************************************************
2018-06-15 14:07:34 +02:00
* Copyright (c) 2014-2018 OpenRCT2 developers
2017-06-15 14:22:15 +02:00
*
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
2017-06-15 14:22:15 +02:00
*
2018-06-15 14:07:34 +02:00
* OpenRCT2 is licensed under the GNU General Public License version 3.
2017-06-15 14:22:15 +02:00
*****************************************************************************/
#ifdef __ANDROID__
#include "platform.h"
#include "../config/Config.h"
2018-01-06 18:32:25 +01:00
#include "../localisation/Language.h"
2017-12-13 13:02:24 +01:00
#include "../util/Util.h"
2017-06-15 14:22:15 +02:00
#include <wchar.h>
#include <jni.h>
#include <SDL.h>
#ifndef NO_TTF
bool platform_get_font_path(TTFFontDescriptor *font, utf8 *buffer, size_t size)
{
STUB();
return false;
}
#endif
uint16_t platform_get_locale_language() {
2017-06-15 14:22:15 +02:00
return LANGUAGE_ENGLISH_UK;
}
uint8_t platform_get_locale_currency() {
2017-06-19 02:54:21 +02:00
return platform_get_currency_value(NULL);
2017-06-15 14:22:15 +02:00
}
uint8_t platform_get_locale_measurement_format() {
2017-06-19 02:54:21 +02:00
return MEASUREMENT_FORMAT_METRIC;
2017-06-15 14:22:15 +02:00
}
float platform_get_default_scale() {
2018-01-18 22:42:54 +01:00
JNIEnv *env = static_cast<JNIEnv *>(SDL_AndroidGetJNIEnv());
2017-06-15 14:22:15 +02:00
2018-01-18 22:42:54 +01:00
jobject activity = static_cast<jobject>(SDL_AndroidGetActivity());
jclass activityClass = env->GetObjectClass(activity);
jmethodID getDefaultScale = env->GetMethodID(activityClass, "getDefaultScale", "()F");
2017-06-15 14:22:15 +02:00
2018-01-18 22:42:54 +01:00
jfloat displayScale = env->CallFloatMethod(activity, getDefaultScale);
2017-06-15 14:22:15 +02:00
2018-01-18 22:42:54 +01:00
env->DeleteLocalRef(activity);
env->DeleteLocalRef(activityClass);
2017-06-15 14:22:15 +02:00
return displayScale;
}
2017-10-25 11:23:17 -04:00
bool platform_get_steam_path(utf8 * outPath, size_t outSize)
{
return false;
}
2017-06-15 14:22:15 +02:00
#endif