Minor engine changes and fixes
This commit is contained in:
parent
f2ca6a6ca5
commit
b97d9bf018
@ -655,7 +655,7 @@ struct GameRunData {
|
|||||||
float jump_timer;
|
float jump_timer;
|
||||||
float damage_flash;
|
float damage_flash;
|
||||||
float update_draw_list_timer;
|
float update_draw_list_timer;
|
||||||
#if defined(__MACH__) && defined(__APPLE__) && !defined(__IOS__)
|
#if defined(__MACH__) && defined(__APPLE__)
|
||||||
float item_select_timer;
|
float item_select_timer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -701,9 +701,6 @@ public:
|
|||||||
#if defined(__ANDROID__) || defined(__IOS__)
|
#if defined(__ANDROID__) || defined(__IOS__)
|
||||||
void pauseGame();
|
void pauseGame();
|
||||||
#endif
|
#endif
|
||||||
#ifdef __IOS__
|
|
||||||
void customStatustext(const std::wstring &text);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@ -1141,14 +1138,14 @@ void Game::run()
|
|||||||
// + Sleep time until the wanted FPS are reached
|
// + Sleep time until the wanted FPS are reached
|
||||||
limitFps(&draw_times, &dtime);
|
limitFps(&draw_times, &dtime);
|
||||||
|
|
||||||
#if defined(__MACH__) && defined(__APPLE__) && !defined(__IOS__)
|
#if defined(__MACH__) && defined(__APPLE__) && !defined(__IOS__) && !defined(__aarch64__)
|
||||||
if (!device->isWindowFocused()) {
|
if (!device->isWindowFocused()) {
|
||||||
if (m_does_lost_focus_pause_game && !isMenuActive())
|
if (m_does_lost_focus_pause_game && !isMenuActive())
|
||||||
showPauseMenu();
|
showPauseMenu();
|
||||||
sleep_ms(50);
|
sleep_ms(50);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#elif defined(__ANDROID__) || defined(__IOS__)
|
#else
|
||||||
if (device->isWindowMinimized()) {
|
if (device->isWindowMinimized()) {
|
||||||
sleep_ms(50);
|
sleep_ms(50);
|
||||||
continue;
|
continue;
|
||||||
@ -2052,7 +2049,7 @@ void Game::processKeyInput()
|
|||||||
|
|
||||||
void Game::processItemSelection(f32 dtime, GameRunData *run_data)
|
void Game::processItemSelection(f32 dtime, GameRunData *run_data)
|
||||||
{
|
{
|
||||||
#if defined(__MACH__) && defined(__APPLE__) && !defined(__IOS__)
|
#if defined(__MACH__) && defined(__APPLE__)
|
||||||
if (run_data->item_select_timer)
|
if (run_data->item_select_timer)
|
||||||
run_data->item_select_timer = MYMAX(0.0f, run_data->item_select_timer - dtime);
|
run_data->item_select_timer = MYMAX(0.0f, run_data->item_select_timer - dtime);
|
||||||
#endif
|
#endif
|
||||||
@ -2075,7 +2072,7 @@ void Game::processItemSelection(f32 dtime, GameRunData *run_data)
|
|||||||
if (wasKeyDown(KeyType::HOTBAR_PREV))
|
if (wasKeyDown(KeyType::HOTBAR_PREV))
|
||||||
dir = 1;
|
dir = 1;
|
||||||
|
|
||||||
#if defined(__MACH__) && defined(__APPLE__) && !defined(__IOS__)
|
#if defined(__MACH__) && defined(__APPLE__)
|
||||||
if (dir && !run_data->item_select_timer) {
|
if (dir && !run_data->item_select_timer) {
|
||||||
run_data->item_select_timer = 0.05f;
|
run_data->item_select_timer = 0.05f;
|
||||||
#else
|
#else
|
||||||
@ -2410,16 +2407,13 @@ void Game::toggleFullViewRange()
|
|||||||
#if !defined(__ANDROID__) && !defined(__IOS__)
|
#if !defined(__ANDROID__) && !defined(__IOS__)
|
||||||
draw_control->range_all = !draw_control->range_all;
|
draw_control->range_all = !draw_control->range_all;
|
||||||
if (draw_control->range_all)
|
if (draw_control->range_all)
|
||||||
m_game_ui->showTranslatedStatusText("Enabled unlimited viewing range");
|
|
||||||
else
|
|
||||||
m_game_ui->showTranslatedStatusText("Disabled unlimited viewing range");
|
|
||||||
#else
|
#else
|
||||||
draw_control->extended_range = !draw_control->extended_range;
|
draw_control->extended_range = !draw_control->extended_range;
|
||||||
if (draw_control->extended_range)
|
if (draw_control->extended_range)
|
||||||
m_game_ui->showTranslatedStatusText("Enabled far viewing range");
|
|
||||||
else
|
|
||||||
m_game_ui->showTranslatedStatusText("Disabled far viewing range");
|
|
||||||
#endif
|
#endif
|
||||||
|
m_game_ui->showTranslatedStatusText("Enabled unlimited viewing range");
|
||||||
|
else
|
||||||
|
m_game_ui->showTranslatedStatusText("Disabled unlimited viewing range");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4226,13 +4220,6 @@ void Game::pauseGame()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __IOS__
|
|
||||||
void Game::customStatustext(const std::wstring &text)
|
|
||||||
{
|
|
||||||
m_game_ui->showStatusText(text);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
Shutdown / cleanup
|
Shutdown / cleanup
|
||||||
@ -4285,7 +4272,7 @@ void Game::showDeathFormspec()
|
|||||||
#define GET_KEY_NAME(KEY) gettext(getKeySetting(#KEY).name())
|
#define GET_KEY_NAME(KEY) gettext(getKeySetting(#KEY).name())
|
||||||
void Game::showPauseMenu()
|
void Game::showPauseMenu()
|
||||||
{
|
{
|
||||||
#ifdef HAVE_TOUCHSCREENGUI
|
/*#ifdef HAVE_TOUCHSCREENGUI
|
||||||
static const std::string control_text = strgettext("Default Controls:\n"
|
static const std::string control_text = strgettext("Default Controls:\n"
|
||||||
"No menu visible:\n"
|
"No menu visible:\n"
|
||||||
"- single tap: button activate\n"
|
"- single tap: button activate\n"
|
||||||
@ -4334,7 +4321,7 @@ void Game::showPauseMenu()
|
|||||||
|
|
||||||
std::string control_text = std::string(control_text_buf);
|
std::string control_text = std::string(control_text_buf);
|
||||||
str_formspec_escape(control_text);
|
str_formspec_escape(control_text);
|
||||||
#endif
|
#endif*/
|
||||||
|
|
||||||
float ypos = simple_singleplayer_mode ? 0.7f : 0.1f;
|
float ypos = simple_singleplayer_mode ? 0.7f : 0.1f;
|
||||||
#if defined(__ANDROID__) || defined(__IOS__)
|
#if defined(__ANDROID__) || defined(__IOS__)
|
||||||
@ -4379,7 +4366,7 @@ void Game::showPauseMenu()
|
|||||||
<< strgettext("Change Keys") << ";;false]";
|
<< strgettext("Change Keys") << ";;false]";
|
||||||
os << "image_button_exit[3.5," << (ypos++) << ";4,0.9;;btn_exit_menu;"
|
os << "image_button_exit[3.5," << (ypos++) << ";4,0.9;;btn_exit_menu;"
|
||||||
<< strgettext("Exit to Menu") << ";;false]";
|
<< strgettext("Exit to Menu") << ";;false]";
|
||||||
#ifndef __IOS__
|
#if !defined(__ANDROID__) && !defined(__IOS__)
|
||||||
os << "image_button_exit[3.5," << (ypos++) << ";4,0.9;;btn_exit_os;"
|
os << "image_button_exit[3.5," << (ypos++) << ";4,0.9;;btn_exit_os;"
|
||||||
<< strgettext("Exit to OS") << ";;false]";
|
<< strgettext("Exit to OS") << ";;false]";
|
||||||
#endif
|
#endif
|
||||||
@ -4540,12 +4527,3 @@ extern "C" void external_pause_game()
|
|||||||
g_game->pauseGame();
|
g_game->pauseGame();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __IOS__
|
|
||||||
extern "C" void external_statustext(const char *text)
|
|
||||||
{
|
|
||||||
if (!g_game)
|
|
||||||
return;
|
|
||||||
g_game->customStatustext(utf8_to_wide_c(text));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
@ -362,7 +362,7 @@ void Minimap::addMode(MinimapModeDef mode)
|
|||||||
porting::mt_snprintf(label_buf, sizeof(label_buf),
|
porting::mt_snprintf(label_buf, sizeof(label_buf),
|
||||||
mode.label.c_str(), zoom);
|
mode.label.c_str(), zoom);
|
||||||
mode.label = label_buf;
|
mode.label = label_buf;
|
||||||
#if !defined(__ANDROID__) && !defined(__IOS__)
|
#if defined(__ANDROID__) || defined(__IOS__)
|
||||||
mode.label = mode.label.substr(0, mode.label.find(", "));
|
mode.label = mode.label.substr(0, mode.label.find(", "));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -66,11 +66,7 @@ SubgameSpec findSubgame(const std::string &id)
|
|||||||
{
|
{
|
||||||
if (id.empty())
|
if (id.empty())
|
||||||
return SubgameSpec();
|
return SubgameSpec();
|
||||||
#ifndef __IOS__
|
|
||||||
std::string share = porting::path_share;
|
std::string share = porting::path_share;
|
||||||
#else
|
|
||||||
std::string share = porting::path_games;
|
|
||||||
#endif
|
|
||||||
std::string user = porting::path_user;
|
std::string user = porting::path_user;
|
||||||
|
|
||||||
// Get games install locations
|
// Get games install locations
|
||||||
@ -179,11 +175,7 @@ std::set<std::string> getAvailableGameIds()
|
|||||||
{
|
{
|
||||||
std::set<std::string> gameids;
|
std::set<std::string> gameids;
|
||||||
std::set<std::string> gamespaths;
|
std::set<std::string> gamespaths;
|
||||||
#ifndef __IOS__
|
|
||||||
gamespaths.insert(porting::path_share + DIR_DELIM + "games");
|
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");
|
gamespaths.insert(porting::path_user + DIR_DELIM + "games");
|
||||||
|
|
||||||
Strfnd search_paths(getSubgamePathEnv());
|
Strfnd search_paths(getSubgamePathEnv());
|
||||||
|
@ -77,7 +77,7 @@ void set_default_settings()
|
|||||||
settings->setDefault("enable_client_modding", "true");
|
settings->setDefault("enable_client_modding", "true");
|
||||||
settings->setDefault("max_out_chat_queue_size", "20");
|
settings->setDefault("max_out_chat_queue_size", "20");
|
||||||
settings->setDefault("pause_on_lost_focus", "true");
|
settings->setDefault("pause_on_lost_focus", "true");
|
||||||
settings->setDefault("enable_register_confirmation", "false");
|
settings->setDefault("enable_register_confirmation", "true");
|
||||||
|
|
||||||
// Keymap
|
// Keymap
|
||||||
settings->setDefault("remote_port", "30000");
|
settings->setDefault("remote_port", "30000");
|
||||||
@ -512,11 +512,12 @@ void set_default_settings()
|
|||||||
settings->setDefault("keymap_camera_mode", "KEY_KEY_C");
|
settings->setDefault("keymap_camera_mode", "KEY_KEY_C");
|
||||||
settings->setDefault("vsync", "true");
|
settings->setDefault("vsync", "true");
|
||||||
|
|
||||||
float ScaleFactor = [NSScreen mainScreen].backingScaleFactor;
|
int ScaleFactor = (int) [NSScreen mainScreen].backingScaleFactor;
|
||||||
settings->setDefault("screen_dpi", std::to_string(ScaleFactor * 72));
|
settings->setDefault("screen_dpi", std::to_string(ScaleFactor * 72));
|
||||||
if (ScaleFactor >= 2) {
|
if (ScaleFactor >= 2) {
|
||||||
settings->setDefault("hud_scaling", "1.5");
|
settings->setDefault("hud_scaling", "1.5");
|
||||||
} else {
|
} else {
|
||||||
|
settings->setDefault("font_size", std::to_string(TTF_DEFAULT_FONT_SIZE - 2));
|
||||||
settings->setDefault("hud_scaling", "1.25");
|
settings->setDefault("hud_scaling", "1.25");
|
||||||
settings->setDefault("gui_scaling", "1.5");
|
settings->setDefault("gui_scaling", "1.5");
|
||||||
}
|
}
|
||||||
|
@ -1613,7 +1613,7 @@ void GUIFormSpecMenu::createTextField(parserData *data, FieldSpec &spec,
|
|||||||
#else
|
#else
|
||||||
if (is_multiline) {
|
if (is_multiline) {
|
||||||
e = new GUIEditBoxWithScrollBar(spec.fdefault.c_str(), true, Environment,
|
e = new GUIEditBoxWithScrollBar(spec.fdefault.c_str(), true, Environment,
|
||||||
data->current_parent, spec.fid, rect, is_editable, true);
|
data->current_parent, spec.fid, rect, is_editable, !is_editable);
|
||||||
} else if (is_editable) {
|
} else if (is_editable) {
|
||||||
e = Environment->addEditBox(spec.fdefault.c_str(), rect, true,
|
e = Environment->addEditBox(spec.fdefault.c_str(), rect, true,
|
||||||
data->current_parent, spec.fid);
|
data->current_parent, spec.fid);
|
||||||
|
@ -145,7 +145,7 @@ int ModApiMainMenu::l_start(lua_State *L)
|
|||||||
data->serverdescription = getTextData(L,"serverdescription");
|
data->serverdescription = getTextData(L,"serverdescription");
|
||||||
data->servername = getTextData(L,"servername");
|
data->servername = getTextData(L,"servername");
|
||||||
|
|
||||||
#ifdef __IOS__
|
#if defined(__ANDROID__) || defined(__IOS__)
|
||||||
if (!g_settings_path.empty())
|
if (!g_settings_path.empty())
|
||||||
g_settings->updateConfigFile(g_settings_path.c_str());
|
g_settings->updateConfigFile(g_settings_path.c_str());
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user