Fix merge prev commits and fix bugs

Android: mpir, x86 flags, range view, fix favorite server icon, other
This commit is contained in:
Maksim Gamarnik 2016-05-03 04:21:56 +03:00
parent 751550ee53
commit 75a555f90c
29 changed files with 114 additions and 110 deletions

View File

@ -61,10 +61,10 @@ COMPILER_VERSION = 4.9
# TARGET_ABI = x86
# TARGET_LIBDIR = x86
# TARGET_TOOLCHAIN = x86
# TARGET_CFLAGS_ADDON = -Ofast -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves
# TARGET_CFLAGS_ADDON = -Ofast -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -fvisibility=hidden
# TARGET_CXXFLAGS_ADDON = $(TARGET_CFLAGS_ADDON)
# TARGET_LDFLAGS_ADDON = -Wl,--no-warn-mismatch,--gc-sections
# TARGET_ARCH = x86
# ARGET_ARCH = x86
# CROSS_PREFIX = i686-linux-android-
# COMPILER_VERSION = 4.9
@ -107,12 +107,12 @@ CURL_TIMESTAMP = $(CURL_DIR)/timestamp
CURL_TIMESTAMP_INT = $(ANDR_ROOT)/deps/curl_timestamp
CURL_URL_HTTP = http://dl.uxnr.de/mirror/curl/curl-${CURL_VERSION}.tar.bz2
GMP_VERSION = 6.1.0
GMP_DIR = $(ANDR_ROOT)/deps/gmp
GMP_LIB = $(GMP_DIR)/usr/lib/libgmp.so
GMP_TIMESTAMP = $(GMP_DIR)/timestamp
GMP_TIMESTAMP_INT = $(ANDR_ROOT)/deps/gmp_timestamp
GMP_URL_HTTP = https://gmplib.org/download/gmp/gmp-$(GMP_VERSION).tar.bz2
MPIR_VERSION = 2.7.2
MPIR_DIR = $(ANDR_ROOT)/deps/mpir
MPIR_LIB = $(MPIR_DIR)/usr/lib/libmpir.a
MPIR_TIMESTAMP = $(MPIR_DIR)/timestamp
MPIR_TIMESTAMP_INT = $(ANDR_ROOT)/deps/mpir_timestamp
MPIR_URL_HTTP = http://mpir.org/mpir-$(MPIR_VERSION).tar.bz2
FREETYPE_VERSION = 2.6.3
FREETYPE_DIR = $(ANDR_ROOT)/deps/freetype
@ -299,7 +299,7 @@ openssl_download :
openssl : $(OPENSSL_LIB)
$(OPENSSL_LIB): $(OPENSSL_TIMESTAMP) $(GMP_LIB)
$(OPENSSL_LIB): $(OPENSSL_TIMESTAMP) $(MPIR_LIB)
@REFRESH=0; \
if [ ! -e ${OPENSSL_TIMESTAMP_INT} ] ; then \
echo "${OPENSSL_TIMESTAMP_INT} doesn't exist"; \
@ -317,7 +317,7 @@ $(OPENSSL_LIB): $(OPENSSL_TIMESTAMP) $(GMP_LIB)
--install-dir=$${TOOLCHAIN} --platform=${APP_PLATFORM}; \
export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \
CC=${CROSS_PREFIX}gcc ./Configure no-ssl2 no-ssl3 no-hw enable-gmp \
-DL_ENDIAN -I${GMP_DIR} -L${GMP_DIR}/usr/lib android-${TARGET_ARCH}; \
-DL_ENDIAN -I${MPIR_DIR} -L${MPIR_DIR}/usr/lib android-${TARGET_ARCH}; \
CC=${CROSS_PREFIX}gcc ANDROID_DEV=/tmp/ndk-${TARGET_HOST} make depend; \
CC=${CROSS_PREFIX}gcc ANDROID_DEV=/tmp/ndk-${TARGET_HOST} make build_libs; \
touch ${OPENSSL_TIMESTAMP}; \
@ -572,61 +572,59 @@ $(CURL_LIB): $(CURL_TIMESTAMP)
clean_curl :
$(RM) -R ${CURL_DIR}
$(GMP_TIMESTAMP) : gmp_download
@LAST_MODIF=$$(find ${GMP_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
$(MPIR_TIMESTAMP) : mpir_download
@LAST_MODIF=$$(find ${MPIR_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \
touch ${GMP_TIMESTAMP}; \
touch ${MPIR_TIMESTAMP}; \
fi
gmp_download :
@if [ ! -d "${GMP_DIR}" ] ; then \
echo "gmp sources missing, downloading..."; \
mpir_download :
@if [ ! -d "${MPIR_DIR}" ] ; then \
echo "mpir sources missing, downloading..."; \
mkdir -p ${ANDR_ROOT}/deps; \
cd deps; \
wget ${GMP_URL_HTTP} || exit 1; \
tar -xjf gmp-${GMP_VERSION}.tar.bz2 || exit 1; \
rm gmp-${GMP_VERSION}.tar.bz2; \
mv gmp-${GMP_VERSION} gmp; \
wget ${MPIR_URL_HTTP} || exit 1; \
tar -xjf mpir-${MPIR_VERSION}.tar.bz2 || exit 1; \
rm mpir-${MPIR_VERSION}.tar.bz2; \
mv mpir-${MPIR_VERSION} mpir; \
fi
gmp : $(GMP_LIB)
mpir : $(MPIR_LIB)
$(GMP_LIB): $(GMP_TIMESTAMP)
$(MPIR_LIB): $(MPIR_TIMESTAMP)
@REFRESH=0; \
if [ ! -e ${GMP_TIMESTAMP_INT} ] ; then \
if [ ! -e ${MPIR_TIMESTAMP_INT} ] ; then \
REFRESH=1; \
fi; \
if [ ! -e ${GMP_LIB} ] ; then \
if [ ! -e ${MPIR_LIB} ] ; then \
REFRESH=1; \
fi; \
if [ ${GMP_TIMESTAMP} -nt ${GMP_TIMESTAMP_INT} ] ; then \
if [ ${MPIR_TIMESTAMP} -nt ${MPIR_TIMESTAMP_INT} ] ; then \
REFRESH=1; \
fi; \
if [ $$REFRESH -ne 0 ] ; then \
mkdir -p ${GMP_DIR}; \
echo "changed timestamp for gmp detected building..."; \
cd deps/gmp; \
mkdir -p ${MPIR_DIR}; \
echo "changed timestamp for mpir detected building..."; \
cd deps/mpir; \
export CROSS_PREFIX=${CROSS_PREFIX}; \
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-gmp; \
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-mpir; \
${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \
--toolchain=${TARGET_TOOLCHAIN}-${COMPILER_VERSION} \
--platform=${APP_PLATFORM} --install-dir=$${TOOLCHAIN}; \
export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \
export CC=${CROSS_PREFIX}gcc; \
export CXX=${CROSS_PREFIX}g++; \
export LIBGMP_LDFLAGS="-avoid-version"; \
export LIBGMPXX_LDFLAGS="-avoid-version"; \
./configure --host=${TARGET_HOST} --prefix=/usr; \
$(MAKE) install DESTDIR=/${GMP_DIR} || exit 1; \
touch ${GMP_TIMESTAMP}; \
touch ${GMP_TIMESTAMP_INT}; \
$(MAKE) install DESTDIR=/${MPIR_DIR} || exit 1; \
touch ${MPIR_TIMESTAMP}; \
touch ${MPIR_TIMESTAMP_INT}; \
$(RM) -rf $${TOOLCHAIN}; \
else \
echo "nothing to be done for gmp"; \
echo "nothing to be done for mpir"; \
fi
clean_gmp:
$(RM) -R deps/gmp
clean_mpir:
$(RM) -R deps/mpir
sqlite3_download: deps/sqlite/sqlite3.c
@ -753,7 +751,7 @@ assets : $(ASSETS_TIMESTAMP)
clean_assets :
@$(RM) -r assets
apk: local.properties $(ICONV_LIB) $(IRRLICHT_LIB) $(CURL_LIB) $(GMP_LIB) $(LUAJIT_LIB) \
apk: local.properties $(ICONV_LIB) $(IRRLICHT_LIB) $(CURL_LIB) $(MPIR_LIB) $(LUAJIT_LIB) \
$(OPENAL_LIB) $(VORBIS_LIB) prep_srcdir $(ANDR_ROOT)/jni/src/android_version.h \
$(ANDR_ROOT)/jni/src/android_version_githash.h sqlite3_download
@$(MAKE) assets; \

View File

@ -4,7 +4,7 @@ LOCAL_PATH := $(call my-dir)/..
include $(CLEAR_VARS)
LOCAL_MODULE := Irrlicht
LOCAL_SRC_FILES := deps/irrlicht/lib/Android/libIrrlicht.a
LOCAL_SRC_FILES := deps/irrlicht/source/Irrlicht/Android/obj/local/$(APP_ABI)/libIrrlicht.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
@ -33,9 +33,9 @@ LOCAL_SRC_FILES := deps/libvorbis-android/obj/local/$(APP_ABI)/libvorbis.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := gmp
LOCAL_SRC_FILES := deps/gmp/usr/lib/libgmp.so
include $(PREBUILT_SHARED_LIBRARY)
LOCAL_MODULE := mpir
LOCAL_SRC_FILES := deps/mpir/usr/lib/libmpir.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := LuaJIT
@ -75,7 +75,8 @@ LOCAL_CFLAGS += -pg
endif
ifeq ($(TARGET_ARCH_ABI),x86)
LOCAL_CFLAGS += -mhard-float -Ofast -fno-fast-math -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -Wno-deprecated-declarations -fvisibility=hidden -fno-stack-protector
LOCAL_CFLAGS += -mhard-float -Ofast -fno-fast-math -funsafe-math-optimizations -fno-trapping-math -ffinite-math-only -fno-rounding-math -fno-signaling-nans -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -fvisibility=hidden -fno-stack-protector
LOCAL_CXXFLAGS += -Ofast -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -fvisibility=hidden
LOCAL_LDFLAGS = -Wl,--no-warn-mismatch,--gc-sections
LOCAL_DISABLE_FATAL_LINKER_WARNINGS := true
endif
@ -91,7 +92,7 @@ LOCAL_C_INCLUDES := \
deps/curl/include \
deps/openal-soft/include \
deps/libvorbis-android/jni/include \
deps/gmp/usr/include \
deps/mpir/usr/include \
deps/sqlite/ \
deps/luajit/src
@ -288,9 +289,7 @@ LOCAL_SRC_FILES += \
# JSONCPP
LOCAL_SRC_FILES += jni/src/json/jsoncpp.cpp
LOCAL_SHARED_LIBRARIES := gmp
LOCAL_STATIC_LIBRARIES := Irrlicht freetype curl iconv LuaJIT openal vorbis android_native_app_glue $(PROFILER_LIBS)
LOCAL_STATIC_LIBRARIES := Irrlicht freetype curl iconv LuaJIT openal vorbis mpir android_native_app_glue $(PROFILER_LIBS)
LOCAL_LDLIBS := -lEGL -llog -lGLESv1_CM -lGLESv2 -lz -landroid -lOpenSLES

View File

@ -1,6 +1,6 @@
--- irrlicht/source/Irrlicht/Android/jni/Android.mk.orig 2016-02-15 05:33:03.000000000 +0200
+++ irrlicht/source/Irrlicht/Android/jni/Android.mk 2016-02-15 05:34:34.913711815 +0200
@@ -11,7 +11,11 @@
@@ -11,7 +11,17 @@
ifndef NDEBUG
LOCAL_CFLAGS += -g -D_DEBUG
else
@ -9,6 +9,12 @@
+LOCAL_CFLAGS += -mfpu=vfpv3-d16 -D_NDK_MATH_NO_SOFTFP=1 -mhard-float -march=armv7-a -Ofast -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -fvisibility=hidden
+LOCAL_CXXFLAGS += -mfpu=vfpv3-d16 -D_NDK_MATH_NO_SOFTFP=1 -mhard-float -march=armv7-a -Ofast -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -fvisibility=hidden
+LOCAL_LDFLAGS += -Wl,--no-warn-mismatch,--gc-sections -lm_hard
+endif
+ifeq ($(TARGET_ARCH_ABI),x86)
+LOCAL_CFLAGS += -mhard-float -Ofast -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -fvisibility=hidden -fno-stack-protector
+LOCAL_CXXFLAGS += -Ofast -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -fvisibility=hidden
+LOCAL_LDFLAGS = -Wl,--no-warn-mismatch,--gc-sections
+LOCAL_DISABLE_FATAL_LINKER_WARNINGS := true
+endif
endif

View File

@ -95,7 +95,7 @@ local function init_globals()
-- Create main tabview
local tv_main = tabview_create("maintab", {x = 12, y = 5.2}, {x = 0, y = 0})
--tv_main:set_autosave_tab(true)
tv_main:set_autosave_tab(true)
tv_main:add(tabs.singleplayer)
tv_main:add(tabs.multiplayer)
tv_main:add(tabs.server)
@ -111,9 +111,7 @@ local function init_globals()
tv_main:set_global_event_handler(main_event_handler)
tv_main:set_fixed_size(false)
--if PLATFORM ~= "Android" then
-- tv_main:set_tab(core.setting_get("maintab_LAST"))
--end
tv_main:set_tab(core.setting_get("maintab_LAST"))
ui.set_default("maintab")
tv_main:show()
@ -129,7 +127,6 @@ local function init_globals()
core.sound_play("main_menu", false)
minetest.set_clouds(false)
--core.set_background("background", defaulttexturedir .. "background.jpg");
mm_texture.set_dirt_bg()
end

View File

@ -247,6 +247,10 @@ void ClientMap::updateDrawList(video::IVideoDriver* driver)
block->mesh->updateCameraOffset(m_camera_offset);
float range = 100000 * BS;
#ifdef __ANDROID__
range = m_control.wanted_range * 4 * BS;
#endif
if (m_control.range_all == false)
range = m_control.wanted_range * BS;

View File

@ -12,7 +12,7 @@
#if defined USE_CMAKE_CONFIG_H
#include "cmake_config.h"
#elif defined (__ANDROID__) || defined (ANDROID)
#elif defined (__ANDROID__)
#define PROJECT_NAME "MultiCraft"
#define PROJECT_NAME_C "MultiCraft"
#define STATIC_SHAREDIR ""

View File

@ -183,7 +183,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("enable_vbo", "true");
settings->setDefault("enable_minimap", "true");
settings->setDefault("minimap_shape_round", "false");
settings->setDefault("minimap_shape_round", "true");
settings->setDefault("minimap_double_scan_height", "false");
settings->setDefault("send_pre_v25_init", "true");
@ -215,7 +215,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("fallback_font_shadow_alpha", "128");
std::stringstream fontsize;
fontsize << DEFAULT_FONT_SIZE;
fontsize << TTF_DEFAULT_FONT_SIZE - 5;
settings->setDefault("font_size", fontsize.str());
settings->setDefault("mono_font_size", fontsize.str());
@ -362,7 +362,6 @@ void set_default_settings(Settings *settings)
settings->setDefault("directional_colored_fog", "false");
settings->setDefault("viewing_range", "25");
settings->setDefault("viewing_range_secondary", "150");
settings->setDefault("inventory_image_hack", "false");
// check for device with small screen
@ -376,6 +375,7 @@ void set_default_settings(Settings *settings)
// small 4" phones
settings->setDefault("hud_scaling", "0.5");
settings->setDefault("gui_scaling", "1.0");
settings->setDefault("mouse_sensitivity", "0.15");
}
if (x_inches > 5) {
// tablets

View File

@ -2008,7 +2008,7 @@ void ServerEnvironment::activateObjects(MapBlock *block, u32 dtime_s)
<<" objects)"<<std::endl;
bool large_amount = (block->m_static_objects.m_stored.size() > g_settings->getU16("max_objects_per_block"));
if (large_amount) {
verbosestream<<"suspiciously large amount of objects detected: "
infostream<<"suspiciously large amount of objects detected: "
<<block->m_static_objects.m_stored.size()<<" in "
<<PP(block->getPos())
<<"; removing all of them."<<std::endl;

View File

@ -1164,17 +1164,16 @@ static void show_pause_menu(GUIFormSpecMenu **cur_formspec,
float ypos = singleplayermode ? 0.5 : 0.1;
std::ostringstream os;
os << FORMSPEC_VERSION_STRING << SIZE_TAG
<< "bgcolor[#00000060;true]"
<< "button_exit[4," << (ypos++) << ";3,0.5;btn_continue;"
<< strgettext("Continue") << "]";
#ifndef __ANDROID__
if (!singleplayermode) {
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_change_password;"
<< strgettext("Change Password") << "]";
}
#ifndef __ANDROID__
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_sound;"
<< strgettext("Sound Volume") << "]";
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_key_config;"
@ -1245,7 +1244,6 @@ static void updateChat(Client &client, f32 dtime, bool show_debug,
chat_y + guitext_chat->getTextHeight());
guitext_chat->setRelativePosition(rect);
// Don't show chat if disabled or empty or profiler is enabled
guitext_chat->setVisible(
@ -2327,7 +2325,7 @@ bool Game::connectToServer(const std::string &playername,
// Only time out if we aren't waiting for the server we started
if ((*address != "") && (wait_time > 10)) {
*error_message = "Connection timed out.";
errorstream << *error_message << std::endl;
infostream << *error_message << std::endl;
break;
}
@ -2473,7 +2471,7 @@ inline bool Game::handleCallbacks()
if (g_gamecallback->changepassword_requested) {
(new GUIPasswordChange(guienv, guiroot, -1,
&g_menumgr, client))->drop();
&g_menumgr, client))->drop();
g_gamecallback->changepassword_requested = false;
}
@ -3078,24 +3076,21 @@ void Game::decreaseViewRange(float *statustext_time)
void Game::toggleFullViewRange(float *statustext_time)
{
#ifdef __ANDROID__
static s16 other_range = g_settings->getS16("viewing_range_secondary");
s16 range_new = other_range;
other_range = g_settings->getS16("viewing_range");
g_settings->set("viewing_range", itos(range_new));
//statustext = utf8_to_wide("Viewing range changed to "
// + itos(range_new));
static const wchar_t *msg[] = {
L"Disabled far viewing range",
L"Enabled far viewing range"
};
#else
static const wchar_t *msg[] = {
L"Disabled full viewing range",
L"Enabled full viewing range"
};
#endif
draw_control->range_all = !draw_control->range_all;
infostream << msg[draw_control->range_all] << std::endl;
statustext = msg[draw_control->range_all];
*statustext_time = 0;
#endif
}
@ -3967,6 +3962,9 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats,
if (draw_control->range_all) {
runData->fog_range = 100000 * BS;
#ifdef __ANDROID__
runData->fog_range = 0.9 * draw_control->wanted_range * 4 * BS;
#endif
} else {
runData->fog_range = 0.9 * draw_control->wanted_range * BS;
}

View File

@ -2998,8 +2998,8 @@ bool GUIFormSpecMenu::preprocessEvent(const SEvent& event)
else if (event.TouchInput.touchedCount == 2) {
dont_send_event = true;
}
else if (event.TouchInput.touchedCount > 5) {
errorstream
else if (event.TouchInput.touchedCount > 3) {
infostream
<< "GUIFormSpecMenu::preprocessEvent to many multitouch events "
<< event.TouchInput.touchedCount << " ignoring them" << std::endl;
}

View File

@ -553,3 +553,4 @@ public:
};
#endif

View File

@ -381,7 +381,7 @@ const HTTPFetchResult * HTTPFetchOngoing::complete(CURLcode res)
}
if (res != CURLE_OK) {
errorstream << request.url << " not found ("
infostream << request.url << " not found ("
<< curl_easy_strerror(res) << ")"
<< " (response code " << result.response_code << ")"
<< std::endl;

View File

@ -190,4 +190,4 @@ void drawItemStack(video::IVideoDriver *driver,
#endif
#endif
#endif

View File

@ -316,7 +316,7 @@ KeyPress::KeyPress(const irr::SEvent::SKeyInput &in, bool prefer_character)
int written = wctomb(&m_name[0], Char);
if(written < 0){
std::string hexstr = hex_encode((const char*)&Char, sizeof(Char));
infostream<<"KeyPress: Unexpected multibyte character "<<hexstr<<std::endl;
errorstream<<"KeyPress: Unexpected multibyte character "<<hexstr<<std::endl;
}
}
}

View File

@ -385,3 +385,4 @@ u8 light_decode_table[LIGHT_MAX+1] =
};
#endif

View File

@ -1510,4 +1510,4 @@ void MeshCollector::append(const TileSpec &tile,
u32 j = indices[i] + vertex_count;
p->indices.push_back(j);
}
}
}

View File

@ -220,3 +220,4 @@ TileSpec getNodeTileN(MapNode mn, v3s16 p, u8 tileindex, MeshMakeData *data);
TileSpec getNodeTile(MapNode mn, v3s16 p, v3s16 dir, MeshMakeData *data);
#endif

View File

@ -743,4 +743,4 @@ void MapgenFractal::generateCaves(s16 max_stone_y)
CaveV5 cave(this, &ps);
cave.makeCave(node_min, node_max, max_stone_y);
}
}
}

View File

@ -131,4 +131,4 @@ struct MapgenFactoryFractal : public MapgenFactory {
};
};
#endif
#endif

View File

@ -194,3 +194,4 @@ ScriptApiPlayer::~ScriptApiPlayer()
{
}

View File

@ -39,7 +39,7 @@ using namespace irr::core;
extern Settings *g_settings;
const char *touchgui_button_imagenames[] = {
const char* touchgui_button_imagenames[] = {
"up_one.png",
"up_two.png",
"up_three.png",
@ -155,14 +155,15 @@ TouchScreenGUI::TouchScreenGUI(IrrlichtDevice *device, IEventReceiver* receiver)
m_buttons[i].repeatdelay = BUTTON_REPEAT_DELAY;
}
m_screensize = m_device->getVideoDriver()->getScreenSize();
m_screensize = device->getVideoDriver()->getScreenSize();
}
void TouchScreenGUI::loadButtonTexture(button_info* btn, const char* path, rect<s32> button_rect)
{
unsigned int tid;
video::ITexture *texture = guiScalingImageButton(m_device->getVideoDriver(),
m_texturesource->getTexture(path, &tid), button_rect.getWidth(), button_rect.getHeight());
m_texturesource->getTexture(path, &tid), button_rect.getWidth(),
button_rect.getHeight());
if (texture) {
btn->guibutton->setUseAlphaChannel(true);
if (g_settings->getBool("gui_scaling_filter")) {
@ -193,7 +194,7 @@ void TouchScreenGUI::initButton(touch_gui_button_id id, rect<s32> button_rect,
btn->immediate_release = immediate_release;
btn->ids.clear();
loadButtonTexture(btn,touchgui_button_imagenames[id], button_rect);
loadButtonTexture(btn,touchgui_button_imagenames[id],button_rect);
}
static int getMaxControlPadSize(float density) {
@ -219,8 +220,7 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc)
u32 button_size = getGuiButtonSize();
m_visible = true;
m_texturesource = tsrc;
m_control_pad_rect = rect<s32>(
0, m_screensize.Y - control_pad_size,
m_control_pad_rect = rect<s32>(0, m_screensize.Y - control_pad_size,
0 + control_pad_size, m_screensize.Y);
/*
@ -231,7 +231,6 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc)
*/
int number = 0;
for (int y = 0; y < 3; ++y)
for (int x = 0; x < 3; ++x, ++number) {
v2s32 tl;
@ -277,20 +276,19 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc)
id = right_id;
caption = L">";
break;
}
if (id != after_last_element_id) {
initButton(id, button_rect, caption, false);
}
}
}
/* init inventory button */
initButton(inventory_id,
rect<s32>(m_screensize.X-(button_size),
m_screensize.Y-(button_size),
m_screensize.X,
m_screensize.Y),
L"inv", false, SLOW_BUTTON_REPEAT);
rect<s32>(m_screensize.X-(button_size),
m_screensize.Y-(button_size),
m_screensize.X,
m_screensize.Y),
L"inv", false, SLOW_BUTTON_REPEAT);
/* init drop button */
initButton(drop_id,
@ -307,6 +305,7 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc)
m_screensize.X-(button_size),
m_screensize.Y),
L"H", false, SLOW_BUTTON_REPEAT);
/* init jump button */
initButton(jump_id,
rect<s32>(m_screensize.X-(button_size*2),
@ -500,6 +499,7 @@ void TouchScreenGUI::handleButtonEvent(touch_gui_button_id button,
delete translated;
}
void TouchScreenGUI::handleReleaseEvent(int evt_id)
{
touch_gui_button_id button = getButtonID(evt_id);
@ -566,7 +566,6 @@ void TouchScreenGUI::handleReleaseEvent(int evt_id)
}
}
void TouchScreenGUI::translateEvent(const SEvent &event)
{
if (!m_visible) {
@ -598,9 +597,7 @@ void TouchScreenGUI::translateEvent(const SEvent &event)
/* handle button events */
if (button != after_last_element_id) {
handleButtonEvent(button, eventID, true);
}
else if (isHUDButton(event))
{
} else if (isHUDButton(event)) {
/* already handled in isHUDButton() */
} else if (m_control_pad_rect.isPointInside(v2s32(toadd.X, toadd.Y))) {
// ignore events inside the control pad not already handled
@ -653,7 +650,7 @@ void TouchScreenGUI::translateEvent(const SEvent &event)
s32 dy = Y - m_pointerpos[event.TouchInput.ID].Y;
/* adapt to similar behaviour as pc screen */
double d = g_settings->getFloat("mouse_sensitivity") ;
double d = g_settings->getFloat("mouse_sensitivity");
double old_yaw = m_camera_yaw;
double old_pitch = m_camera_pitch;
@ -682,7 +679,7 @@ void TouchScreenGUI::translateEvent(const SEvent &event)
->getRayFromScreenCoordinates(
v2s32(event.TouchInput.X,event.TouchInput.Y));
}
}else {
} else {
handleChangedButton(event);
}
}
@ -745,7 +742,7 @@ bool TouchScreenGUI::doubleTapDetection()
m_key_events[1].x = m_move_downlocation.X;
m_key_events[1].y = m_move_downlocation.Y;
u32 delta = porting::getDeltaMs(m_key_events[0].down_time,getTimeMs());
u32 delta = porting::getDeltaMs(m_key_events[0].down_time, getTimeMs());
if (delta > 400)
return false;

View File

@ -99,7 +99,6 @@ private:
std::map<int,rect<s32> > m_hud_rects;
std::map<int,irr::EKEY_CODE> m_hud_ids;
bool m_visible; // is the gui visible
rect<s32> controlpadarea;
/* value in degree */
double m_camera_yaw;
@ -160,9 +159,6 @@ private:
/* handle released hud buttons */
bool isReleaseHUDButton(int eventID);
/* get size of regular gui control button */
int getGuiButtonSize();
/* handle double taps */
bool doubleTapDetection();
@ -170,6 +166,9 @@ private:
/* handle release event */
void handleReleaseEvent(int evt_id);
/* get size of regular gui control button */
int getGuiButtonSize();
/* doubleclick detection variables */
struct key_event {
unsigned int down_time;

View File

@ -41,8 +41,10 @@
#include <config.h>
#if USE_SYSTEM_GMP || defined (__ANDROID__) || defined (ANDROID)
#if USE_SYSTEM_GMP
#include <gmp.h>
#elif defined (__ANDROID__)
#include <mpir.h>
#else
#include <gmp/mini-gmp.h>
#endif

View File

@ -732,4 +732,4 @@ static bool parseNamedColorString(const std::string &value, video::SColor &color
void str_replace(std::string &str, char from, char to)
{
std::replace(str.begin(), str.end(), from, to);
}
}

View File

@ -543,4 +543,4 @@ scene::IMesh * getExtrudedMesh(ITextureSource *tsrc,
scaleMesh(mesh, v3f(2.0, 2.0, 2.0));
return mesh;
}
}

View File

@ -81,4 +81,4 @@ scene::IMesh *getItemMesh(IGameDef *gamedef, const ItemStack &item);
scene::IMesh *getExtrudedMesh(ITextureSource *tsrc,
const std::string &imagename);
#endif
#endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 916 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 823 B