merge diff branch

master
Maksim Gamarnik 2019-04-01 21:33:19 +02:00 committed by MoNTE48
parent 351257bd8a
commit e183a46be7
7 changed files with 127 additions and 86 deletions

View File

@ -77,14 +77,14 @@ IRRLICHT_TIMESTAMP = $(IRRLICHT_DIR)/timestamp
IRRLICHT_TIMESTAMP_INT = $(ANDR_ROOT)/deps/irrlicht_timestamp
IRRLICHT_URL_HTTP = https://github.com/zaki/irrlicht/archive/$(IRRLICHT_COMMIT).zip
CURL_VERSION = 7.62.0
CURL_VERSION = 7.64.0
CURL_DIR = $(ANDR_ROOT)/deps/curl
CURL_LIB = $(CURL_DIR)/lib/.libs/libcurl.a
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
FREETYPE_VERSION = 2.9.1
FREETYPE_VERSION = 2.10.0
FREETYPE_DIR = $(ANDR_ROOT)/deps/freetype
FREETYPE_LIB = $(FREETYPE_DIR)/objs/.libs/libfreetype.a
FREETYPE_TIMESTAMP = $(FREETYPE_DIR)/timestamp

View File

@ -411,7 +411,7 @@ void set_default_settings(Settings *settings)
// check screen size
float x_inches = ((double) porting::getDisplaySize().X /
(160 * porting::getDisplayDensity()));
(160 * porting::getDisplayDensity()));
if (x_inches <= 3.7) {
// small 4" phones
settings->setDefault("hud_scaling", "0.5");

View File

@ -68,10 +68,10 @@ void android_main(android_app *app)
/* TODO this doesn't work as expected, no idea why but there's a workaround */
/* for it right now */
extern "C" {
JNIEXPORT void JNICALL Java_mobi_MultiCraft_GameActivity_putMessageBoxResult(
JNIEXPORT void JNICALL Java_com_multicraft_game_GameActivity_putMessageBoxResult(
JNIEnv *env, jclass j_this, jstring text)
{
errorstream << "Java_mobi_MultiCraft_GameActivity_putMessageBoxResult got: "
errorstream << "Java_com_multicraft_game_GameActivity_putMessageBoxResult got: "
<< std::string((const char*)env->GetStringChars(text,0))
<< std::endl;
}
@ -125,7 +125,7 @@ void initAndroid()
exit(-1);
}
nativeActivity = findClass("mobi/MultiCraft/GameActivity");
nativeActivity = findClass("com/multicraft/game/GameActivity");
if (nativeActivity == 0) {
errorstream <<
"porting::initAndroid unable to find java native activity class" <<
@ -206,7 +206,7 @@ void initializePathsAndroid()
cls_File, mt_getAbsPath, "getCacheDir");
path_storage = getAndroidPath(cls_Env, NULL, cls_File, mt_getAbsPath,
"getExternalStorageDirectory");
path_user = path_storage + DIR_DELIM + "Android/data/mobi.MultiCraft/files";
path_user = path_storage + DIR_DELIM + "Android/data/com.multicraft.game/files";
path_share = path_user;
path_locale = path_user + DIR_DELIM + "locale";
}

View File

@ -1,3 +1,24 @@
/*
MultiCraft
Copyright (C) 2014-2019 Maksim Gamarnik [MoNTE48] MoNTE48@mail.ua
Copyright (C) 2016-2019 sfan5
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3.0 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <string>
#include "porting.h"
@ -7,40 +28,40 @@
static void *uiviewcontroller;
namespace porting {
void initializePathsiOS() {
char buf[128];
void initializePathsiOS() {
char buf[128];
ioswrap_paths(PATH_DOCUMENTS, buf, sizeof(buf));
path_user = std::string(buf);
ioswrap_paths(PATH_DOCUMENTS, buf, sizeof(buf));
path_user = std::string(buf);
ioswrap_paths(PATH_LIBRARY_SUPPORT, buf, sizeof(buf));
path_share = std::string(buf);
path_locale = std::string(buf) + "/locale";
ioswrap_paths(PATH_LIBRARY_CACHE, buf, sizeof(buf));
path_cache = std::string(buf);
}
ioswrap_paths(PATH_LIBRARY_CACHE, buf, sizeof(buf));
path_cache = std::string(buf);
}
void copyAssets() {
void copyAssets() {
ioswrap_assets();
}
}
float getDisplayDensity() {
return 1.0;
}
float getDisplayDensity() {
return 1.0;
}
v2u32 getDisplaySize() {
static bool firstrun = true;
static v2u32 retval;
v2u32 getDisplaySize() {
static bool firstrun = true;
static v2u32 retval;
if(firstrun) {
unsigned int values[2];
ioswrap_size(values);
retval.X = values[0];
retval.Y = values[1];
firstrun = false;
}
if(firstrun) {
unsigned int values[2];
ioswrap_size(values);
retval.X = values[0];
retval.Y = values[1];
firstrun = false;
}
return retval;
}
return retval;
}
void setViewController(void *v) {
uiviewcontroller = v;
@ -61,13 +82,13 @@ namespace porting {
ioswrap_get_dialog(&str);
return std::string(str);
}
void notifyServerConnect(bool is_multiplayer) {
#ifdef ADS
ads_allow(!is_multiplayer);
#endif
}
void notifyExitGame() {
#ifdef ADS
ads_allow(true);

View File

@ -1,3 +1,24 @@
/*
MultiCraft
Copyright (C) 2014-2019 Maksim Gamarnik [MoNTE48] MoNTE48@mail.ua
Copyright (C) 2016-2019 sfan5
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3.0 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef __PORTING__IOS_H__
#define __PORTING__IOS_H__
@ -11,16 +32,16 @@
#endif
namespace porting {
void initializePathsiOS();
void copyAssets();
void initializePathsiOS();
void copyAssets();
void setViewController(void *v);
void showInputDialog(const std::string &acceptButton, const std::string &hint,
const std::string &current, int editType);
const std::string &current, int editType);
int getInputDialogState();
std::string getInputDialogValue();
inline void notifyAbortLoading() {}
inline void notifyAbortLoading() {}
void notifyServerConnect(bool is_multiplayer);
void notifyExitGame();
}

View File

@ -1,5 +1,6 @@
/*
Copyright (C) 2014 sapier
Copyright (C) 2014-2019 Maksim Gamarnik [MoNTE48] MoNTE48@mail.ua
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
@ -57,9 +58,9 @@ const char* touchgui_button_imagenames[] = {
"noclip_btn.png",
#endif*/
"minimap_btn.png",
// "debug_btn.png",
//"debug_btn.png",
"chat.png",
// "camera.png",
//"camera.png",
"rangeview.png",
"rangeview_ios.png",
"empty.png",
@ -150,7 +151,7 @@ TouchScreenGUI *g_touchscreengui;
TouchScreenGUI::TouchScreenGUI(IrrlichtDevice *device, IEventReceiver* receiver):
m_device(device),
m_guienv(device->getGUIEnvironment()),
// m_camera_yaw(0.0),
//m_camera_yaw(0.0),
m_camera_pitch(0.0),
m_visible(false),
m_move_id(-1),
@ -222,7 +223,7 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc)
u32 control_pad_size =
MYMIN((2 * m_screensize.Y) / 3,
getMaxControlPadSize(porting::getDisplayDensity()));
getMaxControlPadSize(porting::getDisplayDensity()));
u32 button_size = getGuiButtonSize();
m_visible = true;
@ -292,17 +293,17 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc)
/* init inventory button */
initButton(inventory_id,
rect<s32>(m_screensize.X-(button_size),
m_screensize.Y-(button_size),
m_screensize.X,
m_screensize.Y),
m_screensize.Y-(button_size),
m_screensize.X,
m_screensize.Y),
L"inv", false, SLOW_BUTTON_REPEAT);
/* init drop button */
initButton(drop_id,
rect<s32>(m_screensize.X-(0.75*button_size),
m_screensize.Y/2-(1.5*button_size),
m_screensize.X,
m_screensize.Y/2-(0.75*button_size)),
rect<s32>(m_screensize.X-(0.75*button_size),
m_screensize.Y/2-(1.5*button_size),
m_screensize.X,
m_screensize.Y/2-(0.75*button_size)),
L"drop", false, SLOW_BUTTON_REPEAT);
/* init crunch button */
@ -315,77 +316,74 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc)
/* init jump button */
initButton(jump_id,
rect<s32>(m_screensize.X-(button_size*2),
m_screensize.Y-(button_size*2),
m_screensize.X-(button_size),
m_screensize.Y-(button_size)),
L"x", false, SLOW_BUTTON_REPEAT);
rect<s32>(m_screensize.X-(button_size*2),
m_screensize.Y-(button_size*2),
m_screensize.X-(button_size),
m_screensize.Y-(button_size)),
L"x", false, SLOW_BUTTON_REPEAT);
/*#ifdef ENABLE_ANDROID_NOCLIP
// init fly button
initButton(fly_id,
rect<s32>(m_screensize.X - (0.75*button_size),
m_screensize.Y - (3.25*button_size),
m_screensize.X,
m_screensize.Y - (button_size*2.5)),
m_screensize.Y - (3.25*button_size),
m_screensize.X,
m_screensize.Y - (button_size*2.5)),
L"fly", false, SLOW_BUTTON_REPEAT);
// init noclip button
initButton(noclip_id,
rect<s32>(m_screensize.X - (0.75*button_size),
m_screensize.Y - (4.75*button_size),
m_screensize.X,
m_screensize.Y - (button_size*4)),
m_screensize.Y - (4.75*button_size),
m_screensize.X,
m_screensize.Y - (button_size*4)),
L"clip", false, SLOW_BUTTON_REPEAT);
// init fast button
initButton(fast_id,
rect<s32>(m_screensize.X - (0.75*button_size),
m_screensize.Y - (4*button_size),
m_screensize.X,
m_screensize.Y - (button_size*3.25)),
m_screensize.Y - (4*button_size),
m_screensize.X,
m_screensize.Y - (button_size*3.25)),
L"fast", false, SLOW_BUTTON_REPEAT);
#endif*/
#ifdef __IOS__
// iOS bar
/* init pause button */
initButton(escape_id,
rect<s32>(m_screensize.X / 2 - (button_size * 0.75), 0,
m_screensize.X / 2,
(button_size * 0.75)),
rect<s32>(m_screensize.X / 2 - (button_size * 0.75), 0,
m_screensize.X / 2, (button_size * 0.75)),
L"Exit", false, SLOW_BUTTON_REPEAT);
/* init rangeselect button */
initButton(range_ios_id,
rect<s32>(m_screensize.X / 2, 0,
m_screensize.X / 2 + (button_size * 0.75),
(button_size * 0.75)),
L"far", false, SLOW_BUTTON_REPEAT);
rect<s32>(m_screensize.X / 2, 0,
m_screensize.X / 2 + (button_size * 0.75),
(button_size * 0.75)),
L"far", false, SLOW_BUTTON_REPEAT);
/* init chat button */
initButton(chat_id,
rect<s32>(m_screensize.X / 2 + (button_size * 0.75), 0,
m_screensize.X / 2 + (button_size * 1.5),
(button_size * 0.75)),
L"Chat", false, SLOW_BUTTON_REPEAT);
rect<s32>(m_screensize.X / 2 + (button_size * 0.75), 0,
m_screensize.X / 2 + (button_size * 1.5),
(button_size * 0.75)),
L"Chat", false, SLOW_BUTTON_REPEAT);
#else
// Android and Windows bar
/* init rangeselect button */
initButton(range_id,
rect<s32>(m_screensize.X / 2 - (button_size * 1.125), 0,
m_screensize.X / 2 - (button_size * 0.375),
(button_size * 0.75)),
L"far", false, SLOW_BUTTON_REPEAT);
rect<s32>(m_screensize.X / 2 - (button_size * 1.125), 0,
m_screensize.X / 2 - (button_size * 0.375),
(button_size * 0.75)),
L"far", false, SLOW_BUTTON_REPEAT);
/* init minimap button */
initButton(minimap_id,
rect<s32>(m_screensize.X / 2 - (button_size * 0.375), 0,
m_screensize.X / 2 + (button_size * 0.375),
(button_size * 0.75)),
L"minimap", false, SLOW_BUTTON_REPEAT);
rect<s32>(m_screensize.X / 2 - (button_size * 0.375), 0,
m_screensize.X / 2 + (button_size * 0.375),
(button_size * 0.75)),
L"minimap", false, SLOW_BUTTON_REPEAT);
/* init chat button */
initButton(chat_id,
@ -557,7 +555,7 @@ void TouchScreenGUI::handleReleaseEvent(size_t evt_id)
m_receiver->OnEvent(*translated);
delete translated;
} else if (m_control_pad_rect.isPointInside(v2s32(m_move_downlocation.X, m_move_downlocation.Y))) {
// ignore events inside the control pad not already handled
// ignore events inside the control pad not already handled
} else if (!m_move_has_really_moved) {
SEvent* translated = new SEvent;
memset(translated, 0, sizeof(SEvent));

View File

@ -1,5 +1,6 @@
/*
Copyright (C) 2014 sapier
Copyright (C) 2014-2019 Maksim Gamarnik [MoNTE48] MoNTE48@mail.ua
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
@ -54,9 +55,9 @@ typedef enum {
fast_id,
#endif
minimap_id,
// debug_id,
//debug_id,
chat_id,
// camera_id,
//camera_id,
range_id,
range_ios_id,
empty_id,