Minor changes and fixes
parent
75a5c0876e
commit
3f4adfd6bb
|
@ -558,9 +558,7 @@ void ClientLauncher::main_menu(MainMenuData *menudata)
|
|||
infostream << "Waited for other menus" << std::endl;
|
||||
|
||||
// Cursor can be non-visible when coming from the game
|
||||
#ifndef __IOS__
|
||||
RenderingEngine::get_raw_device()->getCursorControl()->setVisible(true);
|
||||
#endif
|
||||
|
||||
/* show main menu */
|
||||
GUIEngine mymenu(&input->joystick, guiroot, &g_menumgr, menudata, *kill);
|
||||
|
|
|
@ -959,7 +959,7 @@ private:
|
|||
#endif
|
||||
|
||||
#if defined(__ANDROID__) || defined(__IOS__)
|
||||
bool m_android_chat_open;
|
||||
bool m_android_chat_open = false;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -1950,7 +1950,7 @@ void Game::processKeyInput()
|
|||
} else if (wasKeyDown(KeyType::FREEMOVE)) {
|
||||
toggleFreeMove();
|
||||
} else if (wasKeyDown(KeyType::JUMP)) {
|
||||
#if defined(__ANDROID__) || defined(__IOS__)
|
||||
#ifdef HAVE_TOUCHSCREENGUI
|
||||
if (isKeyDown(KeyType::SNEAK) && client->checkPrivilege("fly"))
|
||||
toggleFast();
|
||||
else
|
||||
|
@ -2435,13 +2435,11 @@ void Game::updateCameraDirection(CameraOrientation *cam, float dtime)
|
|||
if ((device->isWindowActive() && device->isWindowFocused()
|
||||
&& !isMenuActive()) || input->isRandom()) {
|
||||
|
||||
#ifndef __IOS__
|
||||
if (!input->isRandom()) {
|
||||
// Mac OSX gets upset if this is set every frame
|
||||
if (device->getCursorControl()->isVisible())
|
||||
device->getCursorControl()->setVisible(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (m_first_loop_after_window_activation) {
|
||||
m_first_loop_after_window_activation = false;
|
||||
|
@ -2454,11 +2452,9 @@ void Game::updateCameraDirection(CameraOrientation *cam, float dtime)
|
|||
|
||||
} else {
|
||||
|
||||
#ifndef __IOS__
|
||||
// Mac OSX gets upset if this is set every frame
|
||||
if (!device->getCursorControl()->isVisible())
|
||||
device->getCursorControl()->setVisible(true);
|
||||
#endif
|
||||
|
||||
m_first_loop_after_window_activation = true;
|
||||
|
||||
|
@ -4345,7 +4341,7 @@ void Game::showPauseMenu()
|
|||
#endif
|
||||
|
||||
float ypos = simple_singleplayer_mode ? 0.7f : 0.1f;
|
||||
#ifdef __ANDROID__
|
||||
#if defined(__ANDROID__) || defined(__IOS__)
|
||||
bool hasRealKeyboard = porting::hasRealKeyboard();
|
||||
if (simple_singleplayer_mode && hasRealKeyboard)
|
||||
ypos -= 0.6f;
|
||||
|
@ -4380,13 +4376,11 @@ void Game::showPauseMenu()
|
|||
<< strgettext("Sound Volume") << ";;false]";
|
||||
}
|
||||
#endif
|
||||
#ifndef __IOS__
|
||||
#ifdef __ANDROID__
|
||||
#if defined(__ANDROID__) || defined(__IOS__)
|
||||
if (hasRealKeyboard)
|
||||
#endif
|
||||
os << "image_button_exit[3.5," << (ypos++) << ";4,0.9;;btn_key_config;"
|
||||
<< strgettext("Change Keys") << ";;false]";
|
||||
#endif
|
||||
os << "image_button_exit[3.5," << (ypos++) << ";4,0.9;;btn_exit_menu;"
|
||||
<< strgettext("Exit to Menu") << ";;false]";
|
||||
#ifndef __IOS__
|
||||
|
|
|
@ -57,15 +57,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "defaultsettings.h"
|
||||
#endif
|
||||
|
||||
#ifdef __IOS__
|
||||
namespace irr {
|
||||
class CIrrDeviceiOS : public IrrlichtDevice {
|
||||
public:
|
||||
void *getViewController();
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
RenderingEngine *RenderingEngine::s_singleton = nullptr;
|
||||
|
||||
|
||||
|
@ -167,13 +158,6 @@ RenderingEngine::RenderingEngine(IEventReceiver *receiver)
|
|||
if (m_device)
|
||||
set_default_settings();
|
||||
#endif
|
||||
|
||||
#ifdef __IOS__
|
||||
if (m_device) {
|
||||
CIrrDeviceiOS* dev = (CIrrDeviceiOS*) m_device;
|
||||
porting::setViewController(dev->getViewController());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
RenderingEngine::~RenderingEngine()
|
||||
|
|
|
@ -66,7 +66,11 @@ SubgameSpec findSubgame(const std::string &id)
|
|||
{
|
||||
if (id.empty())
|
||||
return SubgameSpec();
|
||||
#ifndef __IOS__
|
||||
std::string share = porting::path_share;
|
||||
#else
|
||||
std::string share = porting::path_games;
|
||||
#endif
|
||||
std::string user = porting::path_user;
|
||||
|
||||
// Get games install locations
|
||||
|
@ -175,7 +179,11 @@ std::set<std::string> getAvailableGameIds()
|
|||
{
|
||||
std::set<std::string> gameids;
|
||||
std::set<std::string> gamespaths;
|
||||
#ifndef __IOS__
|
||||
gamespaths.insert(porting::path_share + DIR_DELIM + "games");
|
||||
#else
|
||||
gamespaths.insert(porting::path_games + DIR_DELIM + "games");
|
||||
#endif
|
||||
gamespaths.insert(porting::path_user + DIR_DELIM + "games");
|
||||
|
||||
Strfnd search_paths(getSubgamePathEnv());
|
||||
|
|
|
@ -60,12 +60,7 @@ void sanity_check_fn(const char *assertion, const char *file,
|
|||
std::string capture = "An engine assumption failed: \"" + std::string(assertion) +
|
||||
"\" in file: " + std::string(file) + ":" + std::to_string(line) +
|
||||
" (" + std::string(function) + ")";
|
||||
|
||||
#ifdef __ANDROID__
|
||||
porting::finishGame(capture);
|
||||
#elif defined(__IOS__)
|
||||
ioswrap_finish_game(capture.c_str());
|
||||
#endif
|
||||
#else
|
||||
abort();
|
||||
#endif
|
||||
|
@ -87,12 +82,7 @@ void fatal_error_fn(const char *msg, const char *file,
|
|||
std::string capture = "A fatal error occurred: \"" + std::string(msg) +
|
||||
"\" in file: " + std::string(file) + ":" + std::to_string(line) +
|
||||
" (" + std::string(function) + ")";
|
||||
|
||||
#ifdef __ANDROID__
|
||||
porting::finishGame(capture);
|
||||
#elif defined(__IOS__)
|
||||
ioswrap_finish_game(capture.c_str());
|
||||
#endif
|
||||
#else
|
||||
abort();
|
||||
#endif
|
||||
|
|
|
@ -234,7 +234,7 @@ void set_default_settings()
|
|||
settings->setDefault("node_highlighting", "box");
|
||||
settings->setDefault("crosshair_color", "(255,255,255)");
|
||||
settings->setDefault("crosshair_alpha", "255");
|
||||
settings->setDefault("recent_chat_messages", "6");
|
||||
settings->setDefault("recent_chat_messages", "10");
|
||||
settings->setDefault("hud_scaling", "1.0");
|
||||
settings->setDefault("gui_scaling", "1.0");
|
||||
settings->setDefault("gui_scaling_filter", "false");
|
||||
|
@ -255,7 +255,7 @@ void set_default_settings()
|
|||
settings->setDefault("enable_shaders", "true");
|
||||
#endif
|
||||
settings->setDefault("enable_particles", "true");
|
||||
settings->setDefault("arm_inertia", "false");
|
||||
settings->setDefault("arm_inertia", "true");
|
||||
settings->setDefault("show_nametag_backgrounds", "false");
|
||||
|
||||
settings->setDefault("enable_minimap", "true");
|
||||
|
@ -326,10 +326,10 @@ void set_default_settings()
|
|||
settings->setDefault("fallback_font_path", porting::getDataPath("fonts" DIR_DELIM "DroidSansFallbackFull.ttf"));
|
||||
#else
|
||||
#ifdef __ANDROID__
|
||||
settings->setDefault("mono_font_path", "/system/fonts/Roboto-Regular.ttf");
|
||||
settings->setDefault("mono_font_path_italic", "/system/fonts/Roboto-Regular.ttf");
|
||||
settings->setDefault("mono_font_path_bold", "/system/fonts/Roboto-Regular.ttf");
|
||||
settings->setDefault("mono_font_path_bold_italic", "/system/fonts/Roboto-Regular.ttf");
|
||||
settings->setDefault("mono_font_path", "/system/fonts/DroidSansMono.ttf");
|
||||
settings->setDefault("mono_font_path_italic", "/system/fonts/DroidSansMono.ttf");
|
||||
settings->setDefault("mono_font_path_bold", "/system/fonts/DroidSansMono.ttf");
|
||||
settings->setDefault("mono_font_path_bold_italic", "/system/fonts/DroidSansMono.ttf");
|
||||
if (android_get_device_api_level() >= __ANDROID_API_N__)
|
||||
settings->setDefault("fallback_font_path", "/system/fonts/NotoSansCJK-Regular.ttc");
|
||||
else
|
||||
|
@ -512,7 +512,7 @@ void set_default_settings()
|
|||
settings->setDefault("keymap_camera_mode", "KEY_KEY_C");
|
||||
settings->setDefault("vsync", "true");
|
||||
|
||||
float ScaleFactor = [[NSScreen mainScreen] backingScaleFactor];
|
||||
float ScaleFactor = [NSScreen mainScreen].backingScaleFactor;
|
||||
settings->setDefault("screen_dpi", std::to_string(ScaleFactor * 72));
|
||||
if (ScaleFactor >= 2) {
|
||||
settings->setDefault("hud_scaling", "1.5");
|
||||
|
@ -544,15 +544,12 @@ void set_default_settings()
|
|||
settings->setDefault("doubletap_jump", "true");
|
||||
settings->setDefault("gui_scaling_filter_txr2img", "false");
|
||||
settings->setDefault("autosave_screensize", "false");
|
||||
settings->setDefault("recent_chat_messages", "6");
|
||||
|
||||
// Set the optimal settings depending on the memory size [Android] | model [iOS]
|
||||
#ifdef __ANDROID__
|
||||
float memoryMax = porting::getTotalSystemMemory();
|
||||
#elif __IOS__
|
||||
float iOS_ver = [[[UIDevice currentDevice] systemVersion] floatValue];
|
||||
#endif
|
||||
|
||||
#ifdef __ANDROID__
|
||||
if (memoryMax < 2) {
|
||||
// minimal settings for less than 2GB RAM
|
||||
#elif __IOS__
|
||||
|
@ -562,66 +559,65 @@ void set_default_settings()
|
|||
settings->setDefault("client_unload_unused_data_timeout", "60");
|
||||
settings->setDefault("client_mapblock_limit", "50");
|
||||
settings->setDefault("fps_max", "30");
|
||||
settings->setDefault("pause_fps_max", "5");
|
||||
settings->setDefault("fps_max_unfocused", "10");
|
||||
settings->setDefault("viewing_range", "30");
|
||||
settings->setDefault("smooth_lighting", "false");
|
||||
settings->setDefault("enable_3d_clouds", "false");
|
||||
settings->setDefault("active_object_send_range_blocks", "1");
|
||||
settings->setDefault("active_block_range", "1");
|
||||
settings->setDefault("dedicated_server_step", "0.2");
|
||||
settings->setDefault("abm_interval", "3.0");
|
||||
settings->setDefault("chunksize", "3");
|
||||
settings->setDefault("max_block_generate_distance", "1");
|
||||
settings->setDefault("enable_weather", "false");
|
||||
settings->setDefault("arm_inertia", "false");
|
||||
#ifdef __ANDROID__
|
||||
} else if (memoryMax >= 2 && memoryMax < 4) {
|
||||
// low settings for 2-4GB RAM
|
||||
#elif __IOS__
|
||||
} else if (iOS_ver < 13.0) {
|
||||
} else if (!IOS_VERSION_AVAILABLE("13.0")) {
|
||||
// low settings
|
||||
#endif
|
||||
settings->setDefault("client_unload_unused_data_timeout", "120");
|
||||
settings->setDefault("client_mapblock_limit", "200");
|
||||
settings->setDefault("fps_max", "35");
|
||||
settings->setDefault("pause_fps_max", "10");
|
||||
settings->setDefault("fps_max_unfocused", "10");
|
||||
settings->setDefault("viewing_range", "40");
|
||||
settings->setDefault("smooth_lighting", "false");
|
||||
settings->setDefault("active_block_range", "1");
|
||||
settings->setDefault("active_object_send_range_blocks", "1");
|
||||
settings->setDefault("active_block_range", "2");
|
||||
settings->setDefault("dedicated_server_step", "0.2");
|
||||
settings->setDefault("abm_interval", "2.0");
|
||||
settings->setDefault("chunksize", "3");
|
||||
settings->setDefault("max_block_generate_distance", "2");
|
||||
settings->setDefault("enable_weather", "false");
|
||||
settings->setDefault("arm_inertia", "false");
|
||||
#ifdef __ANDROID__
|
||||
} else if (memoryMax >= 4 && memoryMax < 6) {
|
||||
// medium settings for 4.1-6GB RAM
|
||||
#elif __IOS__
|
||||
} else if (([SDVersion deviceVersion] == iPhone6S) || ([SDVersion deviceVersion] == iPhone6SPlus) || ([SDVersion deviceVersion] == iPhoneSE) ||
|
||||
([SDVersion deviceVersion] == iPhone7) || ([SDVersion deviceVersion] == iPhone7Plus) ||
|
||||
([SDVersion deviceVersion] == iPadMini4) || ([SDVersion deviceVersion] == iPadAir)) {
|
||||
([SDVersion deviceVersion] == iPadMini4) || ([SDVersion deviceVersion] == iPadAir2) || ([SDVersion deviceVersion] == iPad5))
|
||||
{
|
||||
// medium settings
|
||||
#endif
|
||||
settings->setDefault("client_unload_unused_data_timeout", "300");
|
||||
settings->setDefault("client_unload_unused_data_timeout", "180");
|
||||
settings->setDefault("client_mapblock_limit", "300");
|
||||
settings->setDefault("fps_max", "35");
|
||||
settings->setDefault("viewing_range", "60");
|
||||
settings->setDefault("active_object_send_range_blocks", "2");
|
||||
settings->setDefault("active_block_range", "2");
|
||||
settings->setDefault("max_block_generate_distance", "3");
|
||||
} else {
|
||||
// high settings
|
||||
settings->setDefault("client_mapblock_limit", "500");
|
||||
settings->setDefault("viewing_range", "125");
|
||||
settings->setDefault("active_object_send_range_blocks", "4");
|
||||
settings->setDefault("max_block_generate_distance", "5");
|
||||
|
||||
#ifdef __IOS__
|
||||
if (@available(iOS 13, *)) {
|
||||
#endif
|
||||
// enable visual shader effects
|
||||
settings->setDefault("enable_waving_water", "true");
|
||||
settings->setDefault("enable_waving_leaves", "true");
|
||||
settings->setDefault("enable_waving_plants", "true");
|
||||
#ifdef __IOS__
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Android Settings
|
||||
|
@ -654,23 +650,28 @@ void set_default_settings()
|
|||
// 7" tablets
|
||||
g_settings->setDefault("hud_scaling", "0.9");
|
||||
g_settings->setDefault("selectionbox_width", "6");
|
||||
}
|
||||
|
||||
if (x_inches >= 7.0)
|
||||
} else if (x_inches >= 7.0) {
|
||||
settings->setDefault("device_is_tablet", "true");
|
||||
settings->setDefault("recent_chat_messages", "8");
|
||||
}
|
||||
|
||||
if (x_inches <= 4.5) {
|
||||
settings->setDefault("font_size", std::to_string(TTF_DEFAULT_FONT_SIZE - 1));
|
||||
} else if (x_inches >= 7.0) {
|
||||
settings->setDefault("font_size", std::to_string(TTF_DEFAULT_FONT_SIZE + 1));
|
||||
}
|
||||
|
||||
// Settings for the Rounded or Cutout Screen
|
||||
int RoundScreen = porting::getRoundScreen();
|
||||
if (RoundScreen > 0)
|
||||
settings->setDefault("round_screen", std::to_string(RoundScreen));
|
||||
}
|
||||
#endif // Android
|
||||
|
||||
// iOS Settings
|
||||
#ifdef __IOS__
|
||||
// Switch to olges2 with shaders in new iOS versions
|
||||
if (@available(iOS 13, *)) {
|
||||
if (IOS_VERSION_AVAILABLE("13.0")) {
|
||||
settings->setDefault("video_driver", "ogles2");
|
||||
settings->setDefault("enable_shaders", "true");
|
||||
} else {
|
||||
|
@ -680,8 +681,10 @@ void set_default_settings()
|
|||
|
||||
settings->setDefault("debug_log_level", "none");
|
||||
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
settings->setDefault("device_is_tablet", "true");
|
||||
settings->setDefault("recent_chat_messages", "8");
|
||||
}
|
||||
|
||||
// Set the size of the elements depending on the screen size
|
||||
if SDVersion4Inch {
|
||||
|
@ -730,8 +733,15 @@ void set_default_settings()
|
|||
|
||||
// Settings for the Rounded Screen and Home Bar
|
||||
if SDVersionRoundScreen {
|
||||
settings->setDefault("hud_move_upwards", "22");
|
||||
settings->setDefault("round_screen", SDVersioniPhone12Series ? "80" : "40");
|
||||
int upwards = 25, round = 40;
|
||||
if SDVersioniPhone12Series {
|
||||
upwards = 20, round = 90;
|
||||
} else if SDVersion8and3Inch {
|
||||
upwards = 15, round = 20;
|
||||
}
|
||||
|
||||
settings->setDefault("hud_move_upwards", std::to_string(upwards));
|
||||
settings->setDefault("round_screen", std::to_string(round));
|
||||
}
|
||||
#endif // iOS
|
||||
#endif
|
||||
|
|
|
@ -30,14 +30,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include <SDL.h>
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#ifdef __IOS__
|
||||
#import <UIKit/UIKit.h>
|
||||
#else
|
||||
#import <AppKit/AppKit.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if USE_GETTEXT && defined(_MSC_VER)
|
||||
#include <windows.h>
|
||||
#include <map>
|
||||
|
@ -233,12 +225,6 @@ void init_gettext(const char *path, const std::string &configured_language,
|
|||
|
||||
SDL_free(locale);
|
||||
}
|
||||
#elif defined(__IOS__)
|
||||
char lang[3] = {0};
|
||||
NSString *syslang = [[NSLocale preferredLanguages] firstObject];
|
||||
[syslang getBytes:lang maxLength:2 usedLength:nil encoding:NSASCIIStringEncoding options:0 range:NSMakeRange(0, 2) remainingRange:nil];
|
||||
setenv("LANG", lang, 1);
|
||||
setenv("LANGUAGE", lang, 1);
|
||||
#endif
|
||||
setlocale(LC_ALL, "");
|
||||
}
|
||||
|
|
|
@ -3751,9 +3751,7 @@ void GUIFormSpecMenu::drawMenu()
|
|||
if (!TouchScreenGUI::isActive())
|
||||
#endif
|
||||
{
|
||||
#ifndef __IOS__
|
||||
m_pointer = RenderingEngine::get_raw_device()->getCursorControl()->getPosition();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3762,11 +3760,9 @@ void GUIFormSpecMenu::drawMenu()
|
|||
gui::IGUIElement *hovered =
|
||||
Environment->getRootGUIElement()->getElementFromPoint(m_pointer);
|
||||
|
||||
#ifndef __IOS__
|
||||
gui::ICursorControl *cursor_control = RenderingEngine::get_raw_device()->
|
||||
getCursorControl();
|
||||
gui::ECURSOR_ICON current_cursor_icon = cursor_control->getActiveIcon();
|
||||
#endif
|
||||
bool hovered_element_found = false;
|
||||
|
||||
if (hovered != NULL) {
|
||||
|
@ -3802,11 +3798,9 @@ void GUIFormSpecMenu::drawMenu()
|
|||
m_tooltips[field.fname].bgcolor);
|
||||
}
|
||||
|
||||
#ifndef __IOS__
|
||||
if (field.ftype != f_HyperText && // Handled directly in guiHyperText
|
||||
current_cursor_icon != field.fcursor_icon)
|
||||
cursor_control->setActiveIcon(field.fcursor_icon);
|
||||
#endif
|
||||
|
||||
hovered_element_found = true;
|
||||
|
||||
|
@ -3817,10 +3811,8 @@ void GUIFormSpecMenu::drawMenu()
|
|||
|
||||
if (!hovered_element_found) {
|
||||
// no element is hovered
|
||||
#ifndef __IOS__
|
||||
if (current_cursor_icon != ECI_NORMAL)
|
||||
cursor_control->setActiveIcon(ECI_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
m_tooltip_element->draw();
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 279 B After Width: | Height: | Size: 233 B |
Binary file not shown.
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 105 B |
Binary file not shown.
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 128 B |
Loading…
Reference in New Issue