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

67 lines
1.9 KiB
C++
Raw Normal View History

2017-06-15 14:22:15 +02:00
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
/*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* A full copy of the GNU General Public License can be found in licence.txt
*****************************************************************************/
#pragma endregion
#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 platform_get_locale_language() {
return LANGUAGE_ENGLISH_UK;
}
uint8 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 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