1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-26 18:21:04 +00:00

Simplify loading of Android version of menu

This commit is contained in:
ShadowNinja 2014-11-20 14:59:19 -05:00
parent d2b5ba83b0
commit c4e393deea
6 changed files with 134 additions and 148 deletions

View file

@ -289,7 +289,6 @@ void set_default_settings(Settings *settings)
settings->setDefault("enable_particles", "false");
settings->setDefault("video_driver", "ogles1");
settings->setDefault("touchtarget", "true");
settings->setDefault("main_menu_script","/sdcard/Minetest/builtin/mainmenu/init_android.lua");
settings->setDefault("TMPFolder","/sdcard/Minetest/tmp/");
settings->setDefault("touchscreen_threshold","20");
settings->setDefault("smooth_lighting", "false");

View file

@ -371,6 +371,46 @@ v2u32 getDisplaySize();
v2u32 getWindowSize();
#endif
inline const char * getPlatformName()
{
return
#if defined(ANDROID)
"Android"
#elif defined(linux) || defined(__linux) || defined(__linux__)
"Linux"
#elif defined(_WIN32) || defined(_WIN64)
"Windows"
#elif defined(__DragonFly__) || defined(__FreeBSD__) || \
defined(__NetBSD__) || defined(__OpenBSD__)
"BSD"
#elif defined(__APPLE__) && defined(__MACH__)
#if TARGET_OS_MAC
"OSX"
#elif TARGET_OS_IPHONE
"iOS"
#else
"Apple"
#endif
#elif defined(_AIX)
"AIX"
#elif defined(__hpux)
"HP-UX"
#elif defined(__sun) && defined(__SVR4)
"Solaris"
#elif defined(__CYGWIN__)
"Cygwin"
#elif defined(__unix__) || defined(__unix)
#if defined(_POSIX_VERSION)
"Posix"
#else
"Unix"
#endif
#else
"?"
#endif
;
}
} // namespace porting
#ifdef __ANDROID__

View file

@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "filesys.h"
#include "log.h"
#include "mods.h"
#include "porting.h"
#include "util/string.h"
@ -98,6 +99,9 @@ ScriptApiBase::ScriptApiBase()
lua_pushstring(m_luastack, DIR_DELIM);
lua_setglobal(m_luastack, "DIR_DELIM");
lua_pushstring(m_luastack, porting::getPlatformName());
lua_setglobal(m_luastack, "PLATFORM");
m_server = NULL;
m_environment = NULL;
m_guiengine = NULL;