Add support for ads
This commit is contained in:
parent
12b714424d
commit
a413e73b8d
1
.gitignore
vendored
1
.gitignore
vendored
@ -85,3 +85,4 @@ build/iOS/deps/*
|
|||||||
!build/iOS/deps/*.sh
|
!build/iOS/deps/*.sh
|
||||||
build/iOS/assets.zip
|
build/iOS/assets.zip
|
||||||
build/iOS/worlds.zip
|
build/iOS/worlds.zip
|
||||||
|
build/iOS/Ads
|
||||||
|
0
build/iOS/Ads/ads.h
Normal file
0
build/iOS/Ads/ads.h
Normal file
0
build/iOS/Ads/ads.mm
Normal file
0
build/iOS/Ads/ads.mm
Normal file
5
build/iOS/Ads/readme.txt
Normal file
5
build/iOS/Ads/readme.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
1. Uncomment relevant lines in Podfile and run "pod update"
|
||||||
|
|
||||||
|
2. Copy ads.mm and ads.h here (overwrite)
|
||||||
|
|
||||||
|
3. Enable Ads in src/client/clientlauncher.cpp
|
@ -9,6 +9,7 @@
|
|||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
EB4367AE23CAD13A43ADF4B1 /* libPods-MultiCraft.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8758CE009FCB7E91F4C84C28 /* libPods-MultiCraft.a */; };
|
EB4367AE23CAD13A43ADF4B1 /* libPods-MultiCraft.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8758CE009FCB7E91F4C84C28 /* libPods-MultiCraft.a */; };
|
||||||
F81F6BE51DDC7D99000B9E21 /* libintl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F81F6BE41DDC7D99000B9E21 /* libintl.a */; };
|
F81F6BE51DDC7D99000B9E21 /* libintl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F81F6BE41DDC7D99000B9E21 /* libintl.a */; };
|
||||||
|
F84D3A951DE79AB400ADE1A0 /* ads.mm in Sources */ = {isa = PBXBuildFile; fileRef = F84D3A941DE79AB400ADE1A0 /* ads.mm */; };
|
||||||
F85722891DDC74B700308383 /* libluajit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F85722881DDC74B700308383 /* libluajit.a */; };
|
F85722891DDC74B700308383 /* libluajit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F85722881DDC74B700308383 /* libluajit.a */; };
|
||||||
F8E6C4E71DCA3B7900F64426 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F8E6C4E51DCA3B7900F64426 /* Main.storyboard */; };
|
F8E6C4E71DCA3B7900F64426 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F8E6C4E51DCA3B7900F64426 /* Main.storyboard */; };
|
||||||
F8E6C4E91DCA3B7900F64426 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F8E6C4E81DCA3B7900F64426 /* Assets.xcassets */; };
|
F8E6C4E91DCA3B7900F64426 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F8E6C4E81DCA3B7900F64426 /* Assets.xcassets */; };
|
||||||
@ -213,6 +214,8 @@
|
|||||||
32528F14AAB9EA0E9CAB8526 /* Pods-MultiCraft.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MultiCraft.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-MultiCraft/Pods-MultiCraft.debug.xcconfig"; sourceTree = "<group>"; };
|
32528F14AAB9EA0E9CAB8526 /* Pods-MultiCraft.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MultiCraft.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-MultiCraft/Pods-MultiCraft.debug.xcconfig"; sourceTree = "<group>"; };
|
||||||
8758CE009FCB7E91F4C84C28 /* libPods-MultiCraft.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-MultiCraft.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
8758CE009FCB7E91F4C84C28 /* libPods-MultiCraft.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-MultiCraft.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
F81F6BE41DDC7D99000B9E21 /* libintl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libintl.a; path = ../deps/intl/libintl.a; sourceTree = "<group>"; };
|
F81F6BE41DDC7D99000B9E21 /* libintl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libintl.a; path = ../deps/intl/libintl.a; sourceTree = "<group>"; };
|
||||||
|
F84D3A931DE79AB400ADE1A0 /* ads.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ads.h; path = ../../Ads/ads.h; sourceTree = "<group>"; };
|
||||||
|
F84D3A941DE79AB400ADE1A0 /* ads.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ads.mm; path = ../../Ads/ads.mm; sourceTree = "<group>"; };
|
||||||
F85722881DDC74B700308383 /* libluajit.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libluajit.a; path = ../deps/luajit/lib/libluajit.a; sourceTree = "<group>"; };
|
F85722881DDC74B700308383 /* libluajit.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libluajit.a; path = ../deps/luajit/lib/libluajit.a; sourceTree = "<group>"; };
|
||||||
F8E6C4D91DCA3B7900F64426 /* MultiCraft.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MultiCraft.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
F8E6C4D91DCA3B7900F64426 /* MultiCraft.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MultiCraft.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
F8E6C4E61DCA3B7900F64426 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
F8E6C4E61DCA3B7900F64426 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||||
@ -667,6 +670,15 @@
|
|||||||
name = Pods;
|
name = Pods;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
F84D3A921DE79AA500ADE1A0 /* Ads */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
F84D3A931DE79AB400ADE1A0 /* ads.h */,
|
||||||
|
F84D3A941DE79AB400ADE1A0 /* ads.mm */,
|
||||||
|
);
|
||||||
|
name = Ads;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
F8E6C4D01DCA3B7900F64426 = {
|
F8E6C4D01DCA3B7900F64426 = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@ -702,6 +714,7 @@
|
|||||||
F8E6C4DC1DCA3B7900F64426 /* Supporting Files */ = {
|
F8E6C4DC1DCA3B7900F64426 /* Supporting Files */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
F84D3A921DE79AA500ADE1A0 /* Ads */,
|
||||||
F8E6C4F31DCA3EA400F64426 /* ioswrap.h */,
|
F8E6C4F31DCA3EA400F64426 /* ioswrap.h */,
|
||||||
F8E6C4F41DCA3EA400F64426 /* ioswrap.m */,
|
F8E6C4F41DCA3EA400F64426 /* ioswrap.m */,
|
||||||
F8E6C7E01DCA4EB300F64426 /* assets.zip */,
|
F8E6C7E01DCA4EB300F64426 /* assets.zip */,
|
||||||
@ -1354,6 +1367,7 @@
|
|||||||
F8E6C6351DCA3F9900F64426 /* mapgen_valleys.cpp in Sources */,
|
F8E6C6351DCA3F9900F64426 /* mapgen_valleys.cpp in Sources */,
|
||||||
F8E6C6101DCA3F9900F64426 /* environment.cpp in Sources */,
|
F8E6C6101DCA3F9900F64426 /* environment.cpp in Sources */,
|
||||||
F8E6C64E1DCA3F9900F64426 /* rollback_interface.cpp in Sources */,
|
F8E6C64E1DCA3F9900F64426 /* rollback_interface.cpp in Sources */,
|
||||||
|
F84D3A951DE79AB400ADE1A0 /* ads.mm in Sources */,
|
||||||
F8E6C6301DCA3F9900F64426 /* mapgen_fractal.cpp in Sources */,
|
F8E6C6301DCA3F9900F64426 /* mapgen_fractal.cpp in Sources */,
|
||||||
F8E6C6441DCA3F9900F64426 /* noise.cpp in Sources */,
|
F8E6C6441DCA3F9900F64426 /* noise.cpp in Sources */,
|
||||||
F8E6C7BB1DCA428800F64426 /* numeric.cpp in Sources */,
|
F8E6C7BB1DCA428800F64426 /* numeric.cpp in Sources */,
|
||||||
|
@ -46,5 +46,10 @@
|
|||||||
</array>
|
</array>
|
||||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||||
<false/>
|
<false/>
|
||||||
|
<key>NSAppTransportSecurity</key>
|
||||||
|
<dict>
|
||||||
|
<key>NSAllowsArbitraryLoads</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
@ -4,4 +4,8 @@ platform :ios, '8.0'
|
|||||||
target 'MultiCraft' do
|
target 'MultiCraft' do
|
||||||
pod 'SSZipArchive'
|
pod 'SSZipArchive'
|
||||||
pod 'SDVersion'
|
pod 'SDVersion'
|
||||||
|
|
||||||
|
#pod 'Appodeal/Core', '~> 1.1'
|
||||||
|
#pod 'Appodeal/Interstitial', '1.3.3'
|
||||||
|
#pod 'Appodeal/Video', '1.3.3'
|
||||||
end
|
end
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
cd irrlicht-src/
|
cd irrlicht-src/
|
||||||
|
|
||||||
if [ ! -f .patched ]; then
|
if [ ! -f .patched ]; then
|
||||||
for p in touchcount unscaled dblfreefix; do
|
for p in touchcount unscaled dblfreefix viewcontroller; do
|
||||||
patch -p0 <../../patches/irrlicht-$p.patch
|
patch -p0 <../../patches/irrlicht-$p.patch
|
||||||
done
|
done
|
||||||
touch .patched
|
touch .patched
|
||||||
|
26
build/iOS/patches/irrlicht-viewcontroller.patch
Normal file
26
build/iOS/patches/irrlicht-viewcontroller.patch
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
--- source/Irrlicht/CIrrDeviceiOS.h.bak 2016-11-21 17:59:52.000000000 +0100
|
||||||
|
+++ source/Irrlicht/CIrrDeviceiOS.h 2016-11-21 18:06:06.000000000 +0100
|
||||||
|
@@ -61,6 +61,8 @@
|
||||||
|
|
||||||
|
virtual E_DEVICE_TYPE getType() const _IRR_OVERRIDE_;
|
||||||
|
|
||||||
|
+ void *getViewController();
|
||||||
|
+
|
||||||
|
private:
|
||||||
|
void createWindow();
|
||||||
|
void createViewAndDriver();
|
||||||
|
--- source/Irrlicht/CIrrDeviceiOS.mm.bak 2016-11-21 18:00:26.000000000 +0100
|
||||||
|
+++ source/Irrlicht/CIrrDeviceiOS.mm 2016-11-21 18:06:35.000000000 +0100
|
||||||
|
@@ -687,6 +687,12 @@
|
||||||
|
return EIDT_IOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ void *CIrrDeviceiOS::getViewController()
|
||||||
|
+ {
|
||||||
|
+ SIrrDeviceiOSDataStorage* dataStorage = static_cast<SIrrDeviceiOSDataStorage*>(DataStorage);
|
||||||
|
+ return (__bridge void*) dataStorage->ViewController;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
void CIrrDeviceiOS::createWindow()
|
||||||
|
{
|
||||||
|
if (CreationParams.DriverType != video::EDT_NULL)
|
@ -34,6 +34,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "fontengine.h"
|
#include "fontengine.h"
|
||||||
#include "clientlauncher.h"
|
#include "clientlauncher.h"
|
||||||
|
|
||||||
|
#if 0 // toggle to 1 for ads
|
||||||
|
#define ADS
|
||||||
|
#include "ads.h"
|
||||||
|
namespace irr {
|
||||||
|
class CIrrDeviceiOS : public IrrlichtDevice {
|
||||||
|
public:
|
||||||
|
void *getViewController();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* mainmenumanager.h
|
/* mainmenumanager.h
|
||||||
*/
|
*/
|
||||||
gui::IGUIEnvironment *guienv = NULL;
|
gui::IGUIEnvironment *guienv = NULL;
|
||||||
@ -238,6 +249,9 @@ bool ClientLauncher::run(GameParams &game_params, const Settings &cmd_args)
|
|||||||
receiver->m_touchscreengui = new TouchScreenGUI(device, receiver);
|
receiver->m_touchscreengui = new TouchScreenGUI(device, receiver);
|
||||||
g_touchscreengui = receiver->m_touchscreengui;
|
g_touchscreengui = receiver->m_touchscreengui;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef ADS
|
||||||
|
ads_enable(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
the_game(
|
the_game(
|
||||||
kill,
|
kill,
|
||||||
@ -262,6 +276,9 @@ bool ClientLauncher::run(GameParams &game_params, const Settings &cmd_args)
|
|||||||
g_touchscreengui = NULL;
|
g_touchscreengui = NULL;
|
||||||
receiver->m_touchscreengui = NULL;
|
receiver->m_touchscreengui = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef ADS
|
||||||
|
ads_enable(false);
|
||||||
|
#endif
|
||||||
|
|
||||||
} //try
|
} //try
|
||||||
catch (con::PeerNotFoundException &e) {
|
catch (con::PeerNotFoundException &e) {
|
||||||
@ -498,9 +515,17 @@ void ClientLauncher::main_menu(MainMenuData *menudata)
|
|||||||
device->getCursorControl()->setVisible(true);
|
device->getCursorControl()->setVisible(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ADS
|
||||||
|
ads_enable(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* show main menu */
|
/* show main menu */
|
||||||
GUIEngine mymenu(device, guiroot, &g_menumgr, smgr, menudata, *kill);
|
GUIEngine mymenu(device, guiroot, &g_menumgr, smgr, menudata, *kill);
|
||||||
|
|
||||||
|
#ifdef ADS
|
||||||
|
ads_enable(false);
|
||||||
|
#endif
|
||||||
|
|
||||||
smgr->clear(); /* leave scene manager in a clean state */
|
smgr->clear(); /* leave scene manager in a clean state */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -556,6 +581,12 @@ bool ClientLauncher::create_engine_device()
|
|||||||
if (device) {
|
if (device) {
|
||||||
porting::initIrrlicht(device);
|
porting::initIrrlicht(device);
|
||||||
}
|
}
|
||||||
|
#ifdef ADS
|
||||||
|
if (device) {
|
||||||
|
CIrrDeviceiOS* dev = (CIrrDeviceiOS*) device;
|
||||||
|
ads_startup(dev->getViewController());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return device != NULL;
|
return device != NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user