iOS Modules: separate main platform code from modules

Moved previously builtin modules 'GameCenter', 'AppStore', 'iCloud' to separate modules to be represented as plugin.
Modified 'ARKit' and 'Camera' to not be builtin into engine and work as plugin.
Changed platform code so it's not affected by the move.
Modified Xcode project file to remove parameters that doesn't make any effect.
Added basic '.gdip' plugin config file.
This commit is contained in:
Sergey Minakov 2020-08-13 18:24:39 +03:00
parent 03ae26bb74
commit 30783d57cc
45 changed files with 594 additions and 224 deletions

View file

@ -153,81 +153,6 @@
DevelopmentTeam = $team_id;
ProvisioningStyle = Automatic;
SystemCapabilities = {
com.apple.AccessWiFi = {
enabled = $access_wifi;
};
com.apple.ApplePay = {
enabled = 0;
};
com.apple.ApplicationGroups.iOS = {
enabled = 0;
};
com.apple.AutoFillCredentialProvider = {
enabled = 0;
};
com.apple.BackgroundModes = {
enabled = 0;
};
com.apple.ClassKit = {
enabled = 0;
};
com.apple.DataProtection = {
enabled = 0;
};
com.apple.GameCenter.iOS = {
enabled = $game_center;
};
com.apple.HealthKit = {
enabled = 0;
};
com.apple.HomeKit = {
enabled = 0;
};
com.apple.HotspotConfiguration = {
enabled = 0;
};
com.apple.InAppPurchase = {
enabled = $in_app_purchases;
};
com.apple.InterAppAudio = {
enabled = 0;
};
com.apple.Keychain = {
enabled = 0;
};
com.apple.Maps.iOS = {
enabled = 0;
};
com.apple.Multipath = {
enabled = 0;
};
com.apple.NearFieldCommunicationTagReading = {
enabled = 0;
};
com.apple.NetworkExtensions.iOS = {
enabled = 0;
};
com.apple.Push = {
enabled = $push_notifications;
};
com.apple.SafariKeychain = {
enabled = 0;
};
com.apple.Siri = {
enabled = 0;
};
com.apple.VPNLite = {
enabled = 0;
};
com.apple.WAC = {
enabled = 0;
};
com.apple.Wallet = {
enabled = 0;
};
com.apple.iCloud = {
enabled = 0;
};
};
};
};

View file

@ -47,7 +47,14 @@ for name, path in env.module_list.items():
# Some modules are not linked automatically but can be enabled optionally
# on iOS, so we handle those specially.
if env["platform"] == "iphone" and name in ["arkit", "camera"]:
if env["platform"] == "iphone" and name in [
"arkit",
"camera",
"camera_iphone",
"gamecenter",
"inappstore",
"icloud",
]:
continue
lib = env_modules.add_library("module_%s" % name, env.modules_sources)

18
modules/arkit/arkit.gdip Normal file
View file

@ -0,0 +1,18 @@
[config]
name="ARKit"
binary="arkit_lib.a"
initialization="register_arkit_types"
deinitialization="unregister_arkit_types"
[dependencies]
linked=[]
embedded=[]
system=["AVFoundation.framework", "ARKit.framework"]
capabilities=["arkit"]
files=[]
[plist]
NSCameraUsageDescription="Device camera is used for some functionality"

View file

@ -1,5 +1,5 @@
/*************************************************************************/
/* register_types.cpp */
/* arkit_module.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "register_types.h"
#include "arkit_module.h"
#include "arkit_interface.h"

View file

@ -1,5 +1,5 @@
/*************************************************************************/
/* register_types.h */
/* arkit_module.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */

View file

@ -5,17 +5,7 @@ Import("env_modules")
env_camera = env_modules.Clone()
if env["platform"] == "iphone":
# (iOS) Enable module support
env_camera.Append(CCFLAGS=["-fmodules", "-fcxx-modules"])
# (iOS) Build as separate static library
modules_sources = []
env_camera.add_source_files(modules_sources, "register_types.cpp")
env_camera.add_source_files(modules_sources, "camera_ios.mm")
mod_lib = env_modules.add_library("#bin/libgodot_camera_module" + env["LIBSUFFIX"], modules_sources)
elif env["platform"] == "windows":
if env["platform"] == "windows":
env_camera.add_source_files(env.modules_sources, "register_types.cpp")
env_camera.add_source_files(env.modules_sources, "camera_win.cpp")

View file

@ -1,5 +1,5 @@
def can_build(env, platform):
return platform == "iphone" or platform == "osx" or platform == "windows"
return platform == "osx" or platform == "windows"
def configure(env):

View file

@ -33,9 +33,6 @@
#if defined(WINDOWS_ENABLED)
#include "camera_win.h"
#endif
#if defined(IPHONE_ENABLED)
#include "camera_ios.h"
#endif
#if defined(OSX_ENABLED)
#include "camera_osx.h"
#endif
@ -44,9 +41,6 @@ void register_camera_types() {
#if defined(WINDOWS_ENABLED)
CameraServer::make_default<CameraWindows>();
#endif
#if defined(IPHONE_ENABLED)
CameraServer::make_default<CameraIOS>();
#endif
#if defined(OSX_ENABLED)
CameraServer::make_default<CameraOSX>();
#endif

View file

@ -0,0 +1,15 @@
#!/usr/bin/env python
Import("env")
Import("env_modules")
env_camera = env_modules.Clone()
# (iOS) Enable module support
env_camera.Append(CCFLAGS=["-fmodules", "-fcxx-modules"])
# (iOS) Build as separate static library
modules_sources = []
env_camera.add_source_files(modules_sources, "*.cpp")
env_camera.add_source_files(modules_sources, "*.mm")
mod_lib = env_modules.add_library("#bin/libgodot_camera_module" + env["LIBSUFFIX"], modules_sources)

View file

@ -0,0 +1,18 @@
[config]
name="Camera"
binary="camera_lib.a"
initialization="register_camera_types"
deinitialization="unregister_camera_types"
[dependencies]
linked=[]
embedded=[]
system=["AVFoundation.framework"]
capabilities=[]
files=[]
[plist]
NSCameraUsageDescription="Device camera is used for some functionality"

View file

@ -0,0 +1,40 @@
/*************************************************************************/
/* camera_module.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "camera_module.h"
#include "camera_ios.h"
void register_camera_types() {
CameraServer::make_default<CameraIOS>();
}
void unregister_camera_types() {
}

View file

@ -0,0 +1,32 @@
/*************************************************************************/
/* camera_module.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
void register_camera_types();
void unregister_camera_types();

View file

@ -0,0 +1,6 @@
def can_build(env, platform):
return platform == "iphone"
def configure(env):
pass

15
modules/gamecenter/SCsub Normal file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env python
Import("env")
Import("env_modules")
env_gamecenter = env_modules.Clone()
# (iOS) Enable module support
env_gamecenter.Append(CCFLAGS=["-fmodules", "-fcxx-modules"])
# (iOS) Build as separate static library
modules_sources = []
env_gamecenter.add_source_files(modules_sources, "*.cpp")
env_gamecenter.add_source_files(modules_sources, "*.mm")
mod_lib = env_modules.add_library("#bin/libgodot_gamecenter_module" + env["LIBSUFFIX"], modules_sources)

View file

@ -0,0 +1,6 @@
def can_build(env, platform):
return platform == "iphone"
def configure(env):
pass

View file

@ -28,8 +28,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifdef GAME_CENTER_ENABLED
#ifndef GAME_CENTER_H
#define GAME_CENTER_H
@ -71,5 +69,3 @@ public:
};
#endif
#endif

View file

@ -28,28 +28,15 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifdef GAME_CENTER_ENABLED
#include "game_center.h"
#import "platform/iphone/app_delegate.h"
#ifdef __IPHONE_9_0
#import "game_center_delegate.h"
#import "platform/iphone/view_controller.h"
#import <GameKit/GameKit.h>
extern "C" {
#else
extern "C" {
#import <GameKit/GameKit.h>
#endif
#import "app_delegate.h"
};
#import "view_controller.h"
GameCenter *GameCenter::instance = NULL;
GodotGameCenterDelegate *gameCenterDelegate = nil;
void GameCenter::_bind_methods() {
ClassDB::bind_method(D_METHOD("authenticate"), &GameCenter::authenticate);
@ -76,7 +63,7 @@ Error GameCenter::authenticate() {
GKLocalPlayer *player = [GKLocalPlayer localPlayer];
ERR_FAIL_COND_V(![player respondsToSelector:@selector(authenticateHandler)], ERR_UNAVAILABLE);
ViewController *root_controller = (ViewController *)((AppDelegate *)[[UIApplication sharedApplication] delegate]).window.rootViewController;
UIViewController *root_controller = [[UIApplication sharedApplication] delegate].window.rootViewController;
ERR_FAIL_COND_V(!root_controller, FAILED);
// This handler is called several times. First when the view needs to be shown, then again
@ -305,10 +292,10 @@ Error GameCenter::show_game_center(Dictionary p_params) {
GKGameCenterViewController *controller = [[GKGameCenterViewController alloc] init];
ERR_FAIL_COND_V(!controller, FAILED);
ViewController *root_controller = (ViewController *)((AppDelegate *)[[UIApplication sharedApplication] delegate]).window.rootViewController;
UIViewController *root_controller = [[UIApplication sharedApplication] delegate].window.rootViewController;
ERR_FAIL_COND_V(!root_controller, FAILED);
controller.gameCenterDelegate = root_controller;
controller.gameCenterDelegate = gameCenterDelegate;
controller.viewState = view_state;
if (view_state == GKGameCenterViewControllerStateLeaderboards) {
controller.leaderboardIdentifier = nil;
@ -382,8 +369,12 @@ GameCenter::GameCenter() {
ERR_FAIL_COND(instance != NULL);
instance = this;
authenticated = false;
gameCenterDelegate = [[GodotGameCenterDelegate alloc] init];
};
GameCenter::~GameCenter() {}
#endif
GameCenter::~GameCenter() {
if (gameCenterDelegate) {
gameCenterDelegate = nil;
}
}

View file

@ -0,0 +1,35 @@
/*************************************************************************/
/* game_center_delegate.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#import <GameKit/GameKit.h>
@interface GodotGameCenterDelegate : NSObject <GKGameCenterControllerDelegate>
@end

View file

@ -0,0 +1,45 @@
/*************************************************************************/
/* game_center_delegate.mm */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#import "game_center_delegate.h"
#include "game_center.h"
@implementation GodotGameCenterDelegate
- (void)gameCenterViewControllerDidFinish:(GKGameCenterViewController *)gameCenterViewController {
//[gameCenterViewController dismissViewControllerAnimated:YES completion:^{GameCenter::get_singleton()->game_center_closed();}];//version for signaling when overlay is completely gone
if (GameCenter::get_singleton()) {
GameCenter::get_singleton()->game_center_closed();
}
[gameCenterViewController dismissViewControllerAnimated:YES completion:nil];
}
@end

View file

@ -0,0 +1,48 @@
/*************************************************************************/
/* game_center_module.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "game_center_module.h"
#include "core/config/engine.h"
#include "game_center.h"
GameCenter *game_center;
void register_gamecenter_types() {
game_center = memnew(GameCenter);
Engine::get_singleton()->add_singleton(Engine::Singleton("GameCenter", game_center));
}
void unregister_gamecenter_types() {
if (game_center) {
memdelete(game_center);
}
}

View file

@ -0,0 +1,32 @@
/*************************************************************************/
/* game_center_module.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
void register_gamecenter_types();
void unregister_gamecenter_types();

View file

@ -0,0 +1,17 @@
[config]
name="GameCenter"
binary="gamecenter_lib.a"
initialization="register_gamecenter_types"
deinitialization="unregister_gamecenter_types"
[dependencies]
linked=[]
embedded=[]
system=["GameKit.framework"]
capabilities=["gamekit"]
files=[]
[plist]

15
modules/icloud/SCsub Normal file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env python
Import("env")
Import("env_modules")
env_icloud = env_modules.Clone()
# (iOS) Enable module support
env_icloud.Append(CCFLAGS=["-fmodules", "-fcxx-modules"])
# (iOS) Build as separate static library
modules_sources = []
env_icloud.add_source_files(modules_sources, "*.cpp")
env_icloud.add_source_files(modules_sources, "*.mm")
mod_lib = env_modules.add_library("#bin/libgodot_icloud_module" + env["LIBSUFFIX"], modules_sources)

6
modules/icloud/config.py Normal file
View file

@ -0,0 +1,6 @@
def can_build(env, platform):
return platform == "iphone"
def configure(env):
pass

View file

@ -0,0 +1,17 @@
[config]
name="iCloud"
binary="icloud_lib.a"
initialization="register_icloud_types"
deinitialization="unregister_icloud_types"
[dependencies]
linked=[]
embedded=[]
system=[]
capabilities=[]
files=[]
[plist]

View file

@ -28,8 +28,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifdef ICLOUD_ENABLED
#ifndef ICLOUD_H
#define ICLOUD_H
@ -60,5 +58,3 @@ public:
};
#endif
#endif

View file

@ -28,22 +28,12 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifdef ICLOUD_ENABLED
#include "icloud.h"
#ifndef __IPHONE_9_0
extern "C" {
#endif
#import "app_delegate.h"
#import "platform/iphone/app_delegate.h"
#import <Foundation/Foundation.h>
#ifndef __IPHONE_9_0
};
#endif
ICloud *ICloud::instance = NULL;
void ICloud::_bind_methods() {
@ -353,5 +343,3 @@ ICloud::ICloud() {
}
ICloud::~ICloud() {}
#endif

View file

@ -0,0 +1,48 @@
/*************************************************************************/
/* icloud_module.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "icloud_module.h"
#include "core/config/engine.h"
#include "icloud.h"
ICloud *icloud;
void register_icloud_types() {
icloud = memnew(ICloud);
Engine::get_singleton()->add_singleton(Engine::Singleton("ICloud", icloud));
}
void unregister_icloud_types() {
if (icloud) {
memdelete(icloud);
}
}

View file

@ -0,0 +1,32 @@
/*************************************************************************/
/* icloud_module.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
void register_icloud_types();
void unregister_icloud_types();

15
modules/inappstore/SCsub Normal file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env python
Import("env")
Import("env_modules")
env_inappstore = env_modules.Clone()
# (iOS) Enable module support
env_inappstore.Append(CCFLAGS=["-fmodules", "-fcxx-modules"])
# (iOS) Build as separate static library
modules_sources = []
env_inappstore.add_source_files(modules_sources, "*.cpp")
env_inappstore.add_source_files(modules_sources, "*.mm")
mod_lib = env_modules.add_library("#bin/libgodot_inappstore_module" + env["LIBSUFFIX"], modules_sources)

View file

@ -0,0 +1,6 @@
def can_build(env, platform):
return platform == "iphone"
def configure(env):
pass

View file

@ -28,8 +28,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifdef STOREKIT_ENABLED
#ifndef IN_APP_STORE_H
#define IN_APP_STORE_H
@ -77,5 +75,3 @@ public:
};
#endif
#endif

View file

@ -28,8 +28,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifdef STOREKIT_ENABLED
#include "in_app_store.h"
#import <Foundation/Foundation.h>
@ -411,5 +409,3 @@ InAppStore::~InAppStore() {
[[SKPaymentQueue defaultQueue] removeTransactionObserver:transactions_observer];
transactions_observer = nil;
}
#endif

View file

@ -0,0 +1,48 @@
/*************************************************************************/
/* in_app_store_module.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "in_app_store_module.h"
#include "core/config/engine.h"
#include "in_app_store.h"
InAppStore *store_kit;
void register_inappstore_types() {
store_kit = memnew(InAppStore);
Engine::get_singleton()->add_singleton(Engine::Singleton("InAppStore", store_kit));
}
void unregister_inappstore_types() {
if (store_kit) {
memdelete(store_kit);
}
}

View file

@ -0,0 +1,32 @@
/*************************************************************************/
/* in_app_store_module.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
void register_inappstore_types();
void unregister_inappstore_types();

View file

@ -0,0 +1,17 @@
[config]
name="InAppStore"
binary="inappstore_lib.a"
initialization="register_inappstore_types"
deinitialization="unregister_inappstore_types"
[dependencies]
linked=[]
embedded=[]
system=["StoreKit.framework"]
capabilities=[]
files=[]
[plist]

View file

@ -8,9 +8,6 @@ iphone_lib = [
"main.m",
"app_delegate.mm",
"view_controller.mm",
"game_center.mm",
"in_app_store.mm",
"icloud.mm",
"ios.mm",
"vulkan_context_iphone.mm",
"display_server_iphone.mm",

View file

@ -36,6 +36,7 @@
#include "os_iphone.h"
#import "view_controller.h"
#import <AVFoundation/AVFoundation.h>
#import <AudioToolbox/AudioServices.h>
#define kRenderingFrequency 60

View file

@ -35,9 +35,6 @@ def get_opts():
" validation layers)",
False,
),
BoolVariable("game_center", "Support for game center", True),
BoolVariable("store_kit", "Support for in-app store", True),
BoolVariable("icloud", "Support for iCloud", True),
BoolVariable("ios_exceptions", "Enable exceptions", False),
("ios_triple", "Triple for ios toolchain", ""),
]
@ -222,18 +219,6 @@ def configure(env):
]
)
# Feature options
if env["game_center"]:
env.Append(CPPDEFINES=["GAME_CENTER_ENABLED"])
env.Append(LINKFLAGS=["-framework", "GameKit"])
if env["store_kit"]:
env.Append(CPPDEFINES=["STOREKIT_ENABLED"])
env.Append(LINKFLAGS=["-framework", "StoreKit"])
if env["icloud"]:
env.Append(CPPDEFINES=["ICLOUD_ENABLED"])
env.Prepend(
CPPPATH=[
"$IPHONESDK/usr/include",

View file

@ -35,9 +35,6 @@
#include "drivers/coreaudio/audio_driver_coreaudio.h"
#include "drivers/unix/os_unix.h"
#include "game_center.h"
#include "icloud.h"
#include "in_app_store.h"
#include "ios.h"
#include "joypad_iphone.h"
#include "servers/audio_server.h"
@ -55,15 +52,6 @@ private:
AudioDriverCoreAudio audio_driver;
#ifdef GAME_CENTER_ENABLED
GameCenter *game_center;
#endif
#ifdef STOREKIT_ENABLED
InAppStore *store_kit;
#endif
#ifdef ICLOUD_ENABLED
ICloud *icloud;
#endif
iOS *ios;
JoypadIPhone *joypad_iphone;

View file

@ -125,21 +125,6 @@ void OSIPhone::initialize() {
}
void OSIPhone::initialize_modules() {
#ifdef GAME_CENTER_ENABLED
game_center = memnew(GameCenter);
Engine::get_singleton()->add_singleton(Engine::Singleton("GameCenter", game_center));
#endif
#ifdef STOREKIT_ENABLED
store_kit = memnew(InAppStore);
Engine::get_singleton()->add_singleton(Engine::Singleton("InAppStore", store_kit));
#endif
#ifdef ICLOUD_ENABLED
icloud = memnew(ICloud);
Engine::get_singleton()->add_singleton(Engine::Singleton("ICloud", icloud));
#endif
ios = memnew(iOS);
Engine::get_singleton()->add_singleton(Engine::Singleton("iOS", ios));
@ -154,24 +139,6 @@ void OSIPhone::deinitialize_modules() {
if (ios) {
memdelete(ios);
}
#ifdef GAME_CENTER_ENABLED
if (game_center) {
memdelete(game_center);
}
#endif
#ifdef STOREKIT_ENABLED
if (store_kit) {
memdelete(store_kit);
}
#endif
#ifdef ICLOUD_ENABLED
if (icloud) {
memdelete(icloud);
}
#endif
}
void OSIPhone::set_main_loop(MainLoop *p_main_loop) {

View file

@ -28,13 +28,12 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#import <GameKit/GameKit.h>
#import <UIKit/UIKit.h>
@class GodotView;
@class GodotNativeVideoView;
@interface ViewController : UIViewController <GKGameCenterControllerDelegate>
@interface ViewController : UIViewController
@property(nonatomic, readonly, strong) GodotView *godotView;
@property(nonatomic, readonly, strong) GodotNativeVideoView *videoView;

View file

@ -36,6 +36,7 @@
#import "native_video_view.h"
#include "os_iphone.h"
#import <AVFoundation/AVFoundation.h>
#import <GameController/GameController.h>
@interface ViewController ()
@ -214,14 +215,4 @@
}
}
// MARK: Delegates
#ifdef GAME_CENTER_ENABLED
- (void)gameCenterViewControllerDidFinish:(GKGameCenterViewController *)gameCenterViewController {
//[gameCenterViewController dismissViewControllerAnimated:YES completion:^{GameCenter::get_singleton()->game_center_closed();}];//version for signaling when overlay is completely gone
GameCenter::get_singleton()->game_center_closed();
[gameCenterViewController dismissViewControllerAnimated:YES completion:nil];
}
#endif
@end