Add a possibility to set android version in graphics restrictions.

This commit is contained in:
Deve 2017-07-10 22:54:38 +02:00
parent 1fd6a8aa86
commit 70c481cb26
6 changed files with 49 additions and 9 deletions

View File

@ -1,4 +1,4 @@
# Modify this file to change the last-modified date when you add/remove a file.
# Modify this file to change the last-modified date when you add/remove a file.
# This will then trigger a new cmake run automatically.
file(GLOB_RECURSE STK_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.hpp")
file(GLOB_RECURSE STK_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp")

View File

@ -25,6 +25,10 @@
#include "utils/string_utils.hpp"
#include "utils/types.hpp"
#ifdef ANDROID
#include "main_android.hpp"
#endif
#include <algorithm>
#include <array>
@ -130,6 +134,18 @@ public:
Version(const std::string &driver_version, const std::string &card_name)
{
m_version.clear();
#ifdef ANDROID
// Android version should be enough to disable certain features on this
// platform
int version = AConfiguration_getSdkVersion(global_android_app->config);
if (version > 0)
{
m_version.push_back(version);
return;
}
#endif
// Mesa needs to be tested first, otherwise (if testing for card name
// further down) it would be detected as a non-mesa driver.

View File

@ -99,10 +99,6 @@ using namespace irr;
#include <X11/Xutil.h>
#endif
#ifdef ANDROID
struct android_app* global_android_app;
#endif
/** singleton */
IrrDriver *irr_driver = NULL;

View File

@ -46,9 +46,7 @@
#include <vector>
#ifdef ANDROID
#include <android_native_app_glue.h>
extern struct android_app* global_android_app;
#include "main_android.hpp"
#endif

View File

@ -21,9 +21,10 @@
#include "graphics/irr_driver.hpp"
#include "utils/log.hpp"
extern int main(int argc, char *argv[]);
struct android_app* global_android_app;
void override_default_params()
{
// It has an effect only on the first run, when config file is created.

29
src/main_android.hpp Normal file
View File

@ -0,0 +1,29 @@
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2016-2017 SuperTuxKart-Team
//
// This program 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.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HEADER_MAIN_ANDROID_HPP
#define HEADER_MAIN_ANDROID_HPP
#ifdef ANDROID
#include <android_native_app_glue.h>
extern struct android_app* global_android_app;
#endif
#endif