You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-27 15:57:02 +00:00
Style: Apply clang-format (3.9.1) to Obj-C++ files
This commit is contained in:
@@ -31,7 +31,7 @@ PARSE_EXTS=true
|
|||||||
|
|
||||||
# File types to parse. Only effective when PARSE_EXTS is true.
|
# File types to parse. Only effective when PARSE_EXTS is true.
|
||||||
# FILE_EXTS=".c .h .cpp .hpp"
|
# FILE_EXTS=".c .h .cpp .hpp"
|
||||||
FILE_EXTS=".c .h .cpp .hpp .cc .hh .cxx .m"
|
FILE_EXTS=".c .h .cpp .hpp .cc .hh .cxx .m .mm .inc"
|
||||||
|
|
||||||
# Use pygmentize instead of cat to parse diff with highlighting.
|
# Use pygmentize instead of cat to parse diff with highlighting.
|
||||||
# Install it with `pip install pygments` (Linux) or `easy_install Pygments` (Mac)
|
# Install it with `pip install pygments` (Linux) or `easy_install Pygments` (Mac)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ else
|
|||||||
RANGE=HEAD
|
RANGE=HEAD
|
||||||
fi
|
fi
|
||||||
|
|
||||||
FILES=$(git diff-tree --no-commit-id --name-only -r $RANGE | grep -v thirdparty/ | grep -e "\.cpp$" -e "\.h$" -e "\.inc$")
|
FILES=$(git diff-tree --no-commit-id --name-only -r $RANGE | grep -v thirdparty/ | grep -E "\.(c|h|cpp|hpp|cc|hh|cxx|m|mm|inc)$")
|
||||||
echo "Checking files:\n$FILES"
|
echo "Checking files:\n$FILES"
|
||||||
|
|
||||||
# create a random filename to store our generated patch
|
# create a random filename to store our generated patch
|
||||||
|
|||||||
@@ -28,11 +28,11 @@
|
|||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
#import "app_delegate.h"
|
#import "app_delegate.h"
|
||||||
#import "gl_view.h"
|
|
||||||
|
|
||||||
#include "os_iphone.h"
|
|
||||||
#include "core/global_config.h"
|
#include "core/global_config.h"
|
||||||
|
#import "gl_view.h"
|
||||||
#include "main/main.h"
|
#include "main/main.h"
|
||||||
|
#include "os_iphone.h"
|
||||||
|
|
||||||
#ifdef MODULE_FACEBOOKSCORER_IOS_ENABLED
|
#ifdef MODULE_FACEBOOKSCORER_IOS_ENABLED
|
||||||
#include "modules/FacebookScorer_ios/FacebookScorer.h"
|
#include "modules/FacebookScorer_ios/FacebookScorer.h"
|
||||||
@@ -45,8 +45,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MODULE_PARSE_ENABLED
|
#ifdef MODULE_PARSE_ENABLED
|
||||||
#import <Parse/Parse.h>
|
|
||||||
#import "FBSDKCoreKit/FBSDKCoreKit.h"
|
#import "FBSDKCoreKit/FBSDKCoreKit.h"
|
||||||
|
#import <Parse/Parse.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define kFilteringFactor 0.1
|
#define kFilteringFactor 0.1
|
||||||
@@ -90,7 +90,8 @@ static ViewController* mainViewController = nil;
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int frame_count = 0;
|
static int frame_count = 0;
|
||||||
- (void)drawView:(GLView*)view; {
|
- (void)drawView:(GLView *)view;
|
||||||
|
{
|
||||||
|
|
||||||
switch (frame_count) {
|
switch (frame_count) {
|
||||||
case 0: {
|
case 0: {
|
||||||
@@ -240,7 +241,6 @@ static int frame_count = 0;
|
|||||||
};
|
};
|
||||||
|
|
||||||
}; break;
|
}; break;
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -331,7 +331,6 @@ static int frame_count = 0;
|
|||||||
advertisingTrackingEnabled:[[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled]];
|
advertisingTrackingEnabled:[[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled]];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
- (void)applicationWillTerminate:(UIApplication *)application {
|
- (void)applicationWillTerminate:(UIApplication *)application {
|
||||||
@@ -401,13 +400,13 @@ static int frame_count = 0;
|
|||||||
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
|
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
|
||||||
#ifdef MODULE_PARSE_ENABLED
|
#ifdef MODULE_PARSE_ENABLED
|
||||||
NSLog(@"Handling application openURL");
|
NSLog(@"Handling application openURL");
|
||||||
return [[FBSDKApplicationDelegate sharedInstance] application:application
|
return [[FBSDKApplicationDelegate sharedInstance]
|
||||||
|
application:application
|
||||||
openURL:url
|
openURL:url
|
||||||
sourceApplication:sourceApplication
|
sourceApplication:sourceApplication
|
||||||
annotation:annotation];
|
annotation:annotation];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef MODULE_FACEBOOKSCORER_IOS_ENABLED
|
#ifdef MODULE_FACEBOOKSCORER_IOS_ENABLED
|
||||||
return [[[FacebookScorer sharedInstance] facebook] handleOpenURL:url];
|
return [[[FacebookScorer sharedInstance] facebook] handleOpenURL:url];
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ void GameCenter::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("pop_pending_event"), &GameCenter::pop_pending_event);
|
ClassDB::bind_method(D_METHOD("pop_pending_event"), &GameCenter::pop_pending_event);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Error GameCenter::connect() {
|
Error GameCenter::connect() {
|
||||||
|
|
||||||
//if this class isn't available, game center isn't implemented
|
//if this class isn't available, game center isn't implemented
|
||||||
@@ -78,7 +77,10 @@ Error GameCenter::connect() {
|
|||||||
ViewController *root_controller = (ViewController *)((AppDelegate *)[[UIApplication sharedApplication] delegate]).window.rootViewController;
|
ViewController *root_controller = (ViewController *)((AppDelegate *)[[UIApplication sharedApplication] delegate]).window.rootViewController;
|
||||||
ERR_FAIL_COND_V(!root_controller, FAILED);
|
ERR_FAIL_COND_V(!root_controller, FAILED);
|
||||||
|
|
||||||
//this handler is called serveral times. first when the view needs to be shown, then again after the view is cancelled or the user logs in. or if the user's already logged in, it's called just once to confirm they're authenticated. This is why no result needs to be specified in the presentViewController phase. in this case, more calls to this function will follow.
|
// This handler is called several times. First when the view needs to be shown, then again
|
||||||
|
// after the view is cancelled or the user logs in. Or if the user's already logged in, it's
|
||||||
|
// called just once to confirm they're authenticated. This is why no result needs to be specified
|
||||||
|
// in the presentViewController phase. In this case, more calls to this function will follow.
|
||||||
player.authenticateHandler = (^(UIViewController *controller, NSError *error) {
|
player.authenticateHandler = (^(UIViewController *controller, NSError *error) {
|
||||||
if (controller) {
|
if (controller) {
|
||||||
[root_controller presentViewController:controller animated:YES completion:nil];
|
[root_controller presentViewController:controller animated:YES completion:nil];
|
||||||
@@ -119,7 +121,8 @@ Error GameCenter::post_score(Variant p_score) {
|
|||||||
|
|
||||||
ERR_FAIL_COND_V([GKScore respondsToSelector:@selector(reportScores)], ERR_UNAVAILABLE);
|
ERR_FAIL_COND_V([GKScore respondsToSelector:@selector(reportScores)], ERR_UNAVAILABLE);
|
||||||
|
|
||||||
[GKScore reportScores:@[reporter] withCompletionHandler:^(NSError* error) {
|
[GKScore reportScores:@[ reporter ]
|
||||||
|
withCompletionHandler:^(NSError *error) {
|
||||||
|
|
||||||
Dictionary ret;
|
Dictionary ret;
|
||||||
ret["type"] = "post_score";
|
ret["type"] = "post_score";
|
||||||
@@ -156,7 +159,8 @@ Error GameCenter::award_achievement(Variant p_params) {
|
|||||||
achievement.showsCompletionBanner = params["show_completion_banner"] ? YES : NO;
|
achievement.showsCompletionBanner = params["show_completion_banner"] ? YES : NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
[GKAchievement reportAchievements:@[achievement] withCompletionHandler:^(NSError *error) {
|
[GKAchievement reportAchievements:@[ achievement ]
|
||||||
|
withCompletionHandler:^(NSError *error) {
|
||||||
|
|
||||||
Dictionary ret;
|
Dictionary ret;
|
||||||
ret["type"] = "award_achievement";
|
ret["type"] = "award_achievement";
|
||||||
@@ -229,7 +233,6 @@ void GameCenter::request_achievement_descriptions() {
|
|||||||
}];
|
}];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void GameCenter::request_achievements() {
|
void GameCenter::request_achievements() {
|
||||||
|
|
||||||
[GKAchievement loadAchievementsWithCompletionHandler:^(NSArray *achievements, NSError *error) {
|
[GKAchievement loadAchievementsWithCompletionHandler:^(NSArray *achievements, NSError *error) {
|
||||||
@@ -353,9 +356,6 @@ GameCenter::GameCenter() {
|
|||||||
connected = false;
|
connected = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GameCenter::~GameCenter(){};
|
||||||
GameCenter::~GameCenter() {
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
41
platform/iphone/gl_view.mm
Executable file → Normal file
41
platform/iphone/gl_view.mm
Executable file → Normal file
@@ -27,15 +27,15 @@
|
|||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
#import "gl_view.h"
|
||||||
|
|
||||||
#import <QuartzCore/QuartzCore.h>
|
|
||||||
#import <OpenGLES/EAGLDrawable.h>
|
|
||||||
#include "os_iphone.h"
|
|
||||||
#include "core/os/keyboard.h"
|
|
||||||
#include "core/global_config.h"
|
#include "core/global_config.h"
|
||||||
|
#include "core/os/keyboard.h"
|
||||||
|
#include "os_iphone.h"
|
||||||
#include "servers/audio_server.h"
|
#include "servers/audio_server.h"
|
||||||
|
|
||||||
#import "gl_view.h"
|
#import <OpenGLES/EAGLDrawable.h>
|
||||||
|
#import <QuartzCore/QuartzCore.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@interface GLView (private)
|
@interface GLView (private)
|
||||||
@@ -90,7 +90,8 @@ bool _play_video(String p_path, float p_volume, String p_audio_track, String p_s
|
|||||||
_instance.avPlayerLayer = [AVPlayerLayer playerLayerWithPlayer:_instance.avPlayer];
|
_instance.avPlayerLayer = [AVPlayerLayer playerLayerWithPlayer:_instance.avPlayer];
|
||||||
|
|
||||||
[_instance.avPlayer addObserver:_instance forKeyPath:@"status" options:0 context:nil];
|
[_instance.avPlayer addObserver:_instance forKeyPath:@"status" options:0 context:nil];
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:_instance
|
[[NSNotificationCenter defaultCenter]
|
||||||
|
addObserver:_instance
|
||||||
selector:@selector(playerItemDidReachEnd:)
|
selector:@selector(playerItemDidReachEnd:)
|
||||||
name:AVPlayerItemDidPlayToEndTimeNotification
|
name:AVPlayerItemDidPlayToEndTimeNotification
|
||||||
object:[_instance.avPlayer currentItem]];
|
object:[_instance.avPlayer currentItem]];
|
||||||
@@ -249,8 +250,7 @@ static void clear_touches() {
|
|||||||
//The GL view is stored in the nib file. When it's unarchived it's sent -initWithCoder:
|
//The GL view is stored in the nib file. When it's unarchived it's sent -initWithCoder:
|
||||||
- (id)initWithCoder:(NSCoder *)coder {
|
- (id)initWithCoder:(NSCoder *)coder {
|
||||||
active = FALSE;
|
active = FALSE;
|
||||||
if((self = [super initWithCoder:coder]))
|
if ((self = [super initWithCoder:coder])) {
|
||||||
{
|
|
||||||
self = [self initGLES];
|
self = [self initGLES];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
@@ -262,9 +262,11 @@ static void clear_touches() {
|
|||||||
|
|
||||||
// Configure it so that it is opaque, does not retain the contents of the backbuffer when displayed, and uses RGBA8888 color.
|
// Configure it so that it is opaque, does not retain the contents of the backbuffer when displayed, and uses RGBA8888 color.
|
||||||
eaglLayer.opaque = YES;
|
eaglLayer.opaque = YES;
|
||||||
eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
|
eaglLayer.drawableProperties = [NSDictionary
|
||||||
[NSNumber numberWithBool:FALSE], kEAGLDrawablePropertyRetainedBacking,
|
dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:FALSE],
|
||||||
kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat,
|
kEAGLDrawablePropertyRetainedBacking,
|
||||||
|
kEAGLColorFormatRGBA8,
|
||||||
|
kEAGLDrawablePropertyColorFormat,
|
||||||
nil];
|
nil];
|
||||||
|
|
||||||
// Create our EAGLContext, and if successful make it current and create our framebuffer.
|
// Create our EAGLContext, and if successful make it current and create our framebuffer.
|
||||||
@@ -303,7 +305,6 @@ static void clear_touches() {
|
|||||||
[self createFramebuffer];
|
[self createFramebuffer];
|
||||||
[self drawView];
|
[self drawView];
|
||||||
[self drawView];
|
[self drawView];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)createFramebuffer {
|
- (BOOL)createFramebuffer {
|
||||||
@@ -359,8 +360,7 @@ static void clear_touches() {
|
|||||||
glDeleteRenderbuffersOES(1, &viewRenderbuffer);
|
glDeleteRenderbuffersOES(1, &viewRenderbuffer);
|
||||||
viewRenderbuffer = 0;
|
viewRenderbuffer = 0;
|
||||||
|
|
||||||
if(depthRenderbuffer)
|
if (depthRenderbuffer) {
|
||||||
{
|
|
||||||
glDeleteRenderbuffersOES(1, &depthRenderbuffer);
|
glDeleteRenderbuffersOES(1, &depthRenderbuffer);
|
||||||
depthRenderbuffer = 0;
|
depthRenderbuffer = 0;
|
||||||
}
|
}
|
||||||
@@ -427,7 +427,8 @@ static void clear_touches() {
|
|||||||
[displayLink setPaused:YES];
|
[displayLink setPaused:YES];
|
||||||
|
|
||||||
// Process all input events
|
// Process all input events
|
||||||
while(CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, TRUE) == kCFRunLoopRunHandledSource);
|
while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, TRUE) == kCFRunLoopRunHandledSource)
|
||||||
|
;
|
||||||
|
|
||||||
// We are good to go, resume the CADisplayLink
|
// We are good to go, resume the CADisplayLink
|
||||||
[displayLink setPaused:NO];
|
[displayLink setPaused:NO];
|
||||||
@@ -496,7 +497,6 @@ static void clear_touches() {
|
|||||||
OSIPhone::get_singleton()->mouse_move(tid, prev_point.x * self.contentScaleFactor, prev_point.y * self.contentScaleFactor, touchPoint.x * self.contentScaleFactor, touchPoint.y * self.contentScaleFactor, first == tid);
|
OSIPhone::get_singleton()->mouse_move(tid, prev_point.x * self.contentScaleFactor, prev_point.y * self.contentScaleFactor, touchPoint.x * self.contentScaleFactor, touchPoint.y * self.contentScaleFactor, first == tid);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
|
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||||
@@ -527,7 +527,6 @@ static void clear_touches() {
|
|||||||
return YES;
|
return YES;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
- (void)open_keyboard {
|
- (void)open_keyboard {
|
||||||
//keyboard_text = p_existing;
|
//keyboard_text = p_existing;
|
||||||
[self becomeFirstResponder];
|
[self becomeFirstResponder];
|
||||||
@@ -588,14 +587,12 @@ static void clear_touches() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// When created via code however, we get initWithFrame
|
// When created via code however, we get initWithFrame
|
||||||
- (id)initWithFrame:(CGRect)frame {
|
- (id)initWithFrame:(CGRect)frame {
|
||||||
self = [super initWithFrame:frame];
|
self = [super initWithFrame:frame];
|
||||||
_instance = self;
|
_instance = self;
|
||||||
printf("after init super %p\n", self);
|
printf("after init super %p\n", self);
|
||||||
if(self != nil)
|
if (self != nil) {
|
||||||
{
|
|
||||||
self = [self initGLES];
|
self = [self initGLES];
|
||||||
printf("after init gles %p\n", self);
|
printf("after init gles %p\n", self);
|
||||||
}
|
}
|
||||||
@@ -603,7 +600,9 @@ static void clear_touches() {
|
|||||||
self.multipleTouchEnabled = YES;
|
self.multipleTouchEnabled = YES;
|
||||||
|
|
||||||
printf("******** adding observer for sound routing changes\n");
|
printf("******** adding observer for sound routing changes\n");
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioRouteChangeListenerCallback:)
|
[[NSNotificationCenter defaultCenter]
|
||||||
|
addObserver:self
|
||||||
|
selector:@selector(audioRouteChangeListenerCallback:)
|
||||||
name:AVAudioSessionRouteChangeNotification
|
name:AVAudioSessionRouteChangeNotification
|
||||||
object:nil];
|
object:nil];
|
||||||
|
|
||||||
|
|||||||
@@ -35,9 +35,10 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "app_delegate.h"
|
#import "app_delegate.h"
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
#ifndef __IPHONE_9_0
|
#ifndef __IPHONE_9_0
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
@@ -100,7 +101,6 @@ Variant nsobject_to_variant(NSObject* object) {
|
|||||||
Dictionary result;
|
Dictionary result;
|
||||||
NSDictionary *dic = (NSDictionary *)object;
|
NSDictionary *dic = (NSDictionary *)object;
|
||||||
|
|
||||||
|
|
||||||
NSArray *keys = [dic allKeys];
|
NSArray *keys = [dic allKeys];
|
||||||
int count = [keys count];
|
int count = [keys count];
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
@@ -191,7 +191,6 @@ NSObject* variant_to_nsobject(Variant v) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Error ICloud::remove_key(Variant p_param) {
|
Error ICloud::remove_key(Variant p_param) {
|
||||||
String param = p_param;
|
String param = p_param;
|
||||||
NSString *key = [[[NSString alloc] initWithUTF8String:param.utf8().get_data()] autorelease];
|
NSString *key = [[[NSString alloc] initWithUTF8String:param.utf8().get_data()] autorelease];
|
||||||
@@ -302,9 +301,8 @@ ICloud::ICloud() {
|
|||||||
instance = this;
|
instance = this;
|
||||||
//connected = false;
|
//connected = false;
|
||||||
|
|
||||||
[
|
[[NSNotificationCenter defaultCenter]
|
||||||
//[NSNotificationCenter defaultCenter] addObserverForName: @"notify"
|
addObserverForName:NSUbiquitousKeyValueStoreDidChangeExternallyNotification
|
||||||
[NSNotificationCenter defaultCenter] addObserverForName: NSUbiquitousKeyValueStoreDidChangeExternallyNotification
|
|
||||||
object:[NSUbiquitousKeyValueStore defaultStore]
|
object:[NSUbiquitousKeyValueStore defaultStore]
|
||||||
queue:nil
|
queue:nil
|
||||||
usingBlock:^(NSNotification *notification) {
|
usingBlock:^(NSNotification *notification) {
|
||||||
@@ -331,7 +329,6 @@ ICloud::ICloud() {
|
|||||||
|
|
||||||
ret["reason"] = reason;
|
ret["reason"] = reason;
|
||||||
|
|
||||||
|
|
||||||
NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore];
|
NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore];
|
||||||
|
|
||||||
NSArray *keys = [userInfo objectForKey:NSUbiquitousKeyValueStoreChangedKeysKey];
|
NSArray *keys = [userInfo objectForKey:NSUbiquitousKeyValueStoreChangedKeysKey];
|
||||||
@@ -351,13 +348,9 @@ ICloud::ICloud() {
|
|||||||
|
|
||||||
ret["changed_values"] = keyValues;
|
ret["changed_values"] = keyValues;
|
||||||
pending_events.push_back(ret);
|
pending_events.push_back(ret);
|
||||||
}
|
}];
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ICloud::~ICloud(){};
|
||||||
ICloud::~ICloud() {
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -29,15 +29,15 @@
|
|||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
#ifdef STOREKIT_ENABLED
|
#ifdef STOREKIT_ENABLED
|
||||||
|
|
||||||
|
#include "in_app_store.h"
|
||||||
|
|
||||||
#ifdef MODULE_FUSEBOXX_ENABLED
|
#ifdef MODULE_FUSEBOXX_ENABLED
|
||||||
#import "modules/fuseboxx/ios/FuseSDK.h"
|
#import "modules/fuseboxx/ios/FuseSDK.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "in_app_store.h"
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#import <StoreKit/StoreKit.h>
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
#import <StoreKit/StoreKit.h>
|
||||||
};
|
};
|
||||||
|
|
||||||
bool auto_finish_transactions = true;
|
bool auto_finish_transactions = true;
|
||||||
@@ -62,7 +62,6 @@ NSMutableDictionary* pending_transactions = [NSMutableDictionary dictionary];
|
|||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
InAppStore *InAppStore::instance = NULL;
|
InAppStore *InAppStore::instance = NULL;
|
||||||
|
|
||||||
void InAppStore::_bind_methods() {
|
void InAppStore::_bind_methods() {
|
||||||
@@ -76,7 +75,6 @@ void InAppStore::_bind_methods() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
@interface ProductsDelegate : NSObject <SKProductsRequestDelegate> {
|
@interface ProductsDelegate : NSObject <SKProductsRequestDelegate> {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -156,7 +154,6 @@ Error InAppStore::request_product_info(Variant p_params) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
@interface TransObserver : NSObject <SKPaymentTransactionObserver> {
|
@interface TransObserver : NSObject <SKPaymentTransactionObserver> {
|
||||||
|
|
||||||
};
|
};
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -254,7 +251,6 @@ Error InAppStore::request_product_info(Variant p_params) {
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
Error InAppStore::purchase(Variant p_params) {
|
Error InAppStore::purchase(Variant p_params) {
|
||||||
|
|
||||||
ERR_FAIL_COND_V(![SKPaymentQueue canMakePayments], ERR_UNAVAILABLE);
|
ERR_FAIL_COND_V(![SKPaymentQueue canMakePayments], ERR_UNAVAILABLE);
|
||||||
@@ -274,7 +270,6 @@ Error InAppStore::purchase(Variant p_params) {
|
|||||||
return OK;
|
return OK;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int InAppStore::get_pending_event_count() {
|
int InAppStore::get_pending_event_count() {
|
||||||
return pending_events.size();
|
return pending_events.size();
|
||||||
};
|
};
|
||||||
@@ -328,9 +323,6 @@ void InAppStore::set_auto_finish_transaction(bool b){
|
|||||||
auto_finish_transactions = b;
|
auto_finish_transactions = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
InAppStore::~InAppStore() {
|
InAppStore::~InAppStore(){};
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -27,8 +27,9 @@
|
|||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
#import <UIKit/UIKit.h>
|
|
||||||
#import "app_delegate.h"
|
#import "app_delegate.h"
|
||||||
|
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int gargc;
|
int gargc;
|
||||||
@@ -47,4 +48,3 @@ int main(int argc, char *argv[]) {
|
|||||||
[pool release];
|
[pool release];
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,8 +69,7 @@ extern "C" {
|
|||||||
|
|
||||||
return p_argc;
|
return p_argc;
|
||||||
};
|
};
|
||||||
|
}; // extern "C"
|
||||||
};
|
|
||||||
|
|
||||||
@interface ViewController ()
|
@interface ViewController ()
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,6 @@
|
|||||||
|
|
||||||
#include <Foundation/NSString.h>
|
#include <Foundation/NSString.h>
|
||||||
|
|
||||||
|
|
||||||
String DirAccessOSX::fix_unicode_name(const char *p_name) const {
|
String DirAccessOSX::fix_unicode_name(const char *p_name) const {
|
||||||
|
|
||||||
String fname;
|
String fname;
|
||||||
@@ -46,6 +45,4 @@ String DirAccessOSX::fix_unicode_name(const char* p_name) const {
|
|||||||
return fname;
|
return fname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif //posix_enabled
|
#endif //posix_enabled
|
||||||
|
|||||||
@@ -27,14 +27,13 @@
|
|||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
#include "os_osx.h"
|
|
||||||
#include "main/main.h"
|
#include "main/main.h"
|
||||||
|
|
||||||
|
#include "os_osx.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
//#define main godot_main
|
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
int first_arg = 1;
|
int first_arg = 1;
|
||||||
@@ -46,7 +45,6 @@ int main(int argc, char** argv) {
|
|||||||
printf("%i: %s\n", i, argv[i]);
|
printf("%i: %s\n", i, argv[i]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
if (argc >= 1 && argv[0][0] == '/') {
|
if (argc >= 1 && argv[0][0] == '/') {
|
||||||
//potentially launched from finder
|
//potentially launched from finder
|
||||||
int len = strlen(argv[0]);
|
int len = strlen(argv[0]);
|
||||||
@@ -69,18 +67,15 @@ int main(int argc, char** argv) {
|
|||||||
fclose(f);
|
fclose(f);
|
||||||
chdir(path);
|
chdir(path);
|
||||||
chdir("../Resources"); //data.pck, or just the files are here
|
chdir("../Resources"); //data.pck, or just the files are here
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free(path);
|
free(path);
|
||||||
free(pathinfo);
|
free(pathinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OS_OSX os;
|
OS_OSX os;
|
||||||
|
|
||||||
|
|
||||||
Error err = Main::setup(argv[0], argc - first_arg, &argv[first_arg]);
|
Error err = Main::setup(argv[0], argc - first_arg, &argv[first_arg]);
|
||||||
if (err != OK)
|
if (err != OK)
|
||||||
return 255;
|
return 255;
|
||||||
|
|||||||
@@ -27,9 +27,10 @@
|
|||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
#include "godot_osx.h"
|
||||||
|
|
||||||
#include <sys/param.h> /* for MAXPATHLEN */
|
#include <sys/param.h> /* for MAXPATHLEN */
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "godot_osx.h"
|
|
||||||
|
|
||||||
/* For some reaon, Apple removed setAppleMenu from the headers in 10.4,
|
/* For some reaon, Apple removed setAppleMenu from the headers in 10.4,
|
||||||
but the method still is there and works. To avoid warnings, we declare
|
but the method still is there and works. To avoid warnings, we declare
|
||||||
@@ -89,7 +90,6 @@ static void setApplicationMenu(void) {
|
|||||||
title = [@"Quit " stringByAppendingString:appName];
|
title = [@"Quit " stringByAppendingString:appName];
|
||||||
[appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
|
[appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
|
||||||
|
|
||||||
|
|
||||||
/* Put menu into the menubar */
|
/* Put menu into the menubar */
|
||||||
menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
|
menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
|
||||||
[menuItem setSubmenu:appleMenu];
|
[menuItem setSubmenu:appleMenu];
|
||||||
@@ -171,7 +171,6 @@ extern int godot_main(int argc, char** argv);
|
|||||||
#undef main
|
#undef main
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
/* Copy the arguments into a global variable */
|
/* Copy the arguments into a global variable */
|
||||||
/* This is passed if we are launched by double-clicking */
|
/* This is passed if we are launched by double-clicking */
|
||||||
@@ -207,4 +206,3 @@ int main (int argc, char **argv) {
|
|||||||
CustomApplicationMain(argc, argv);
|
CustomApplicationMain(argc, argv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,35 +27,32 @@
|
|||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
#import <Cocoa/Cocoa.h>
|
|
||||||
|
|
||||||
#include <Carbon/Carbon.h>
|
|
||||||
#include <IOKit/IOKitLib.h>
|
|
||||||
#include <IOKit/IOCFPlugIn.h>
|
|
||||||
#include <IOKit/hid/IOHIDLib.h>
|
|
||||||
#include <IOKit/hid/IOHIDKeys.h>
|
|
||||||
|
|
||||||
#include "sem_osx.h"
|
|
||||||
#include "servers/visual/visual_server_raster.h"
|
|
||||||
//#include "drivers/opengl/rasterizer_gl.h"
|
|
||||||
//#include "drivers/gles2/rasterizer_gles2.h"
|
|
||||||
#include "drivers/gles3/rasterizer_gles3.h"
|
|
||||||
#include "os_osx.h"
|
#include "os_osx.h"
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include "dir_access_osx.h"
|
||||||
#include "print_string.h"
|
#include "drivers/gles3/rasterizer_gles3.h"
|
||||||
#include "servers/physics/physics_server_sw.h"
|
|
||||||
// #include "drivers/gles2/rasterizer_instance_gles2.h"
|
|
||||||
// #include "servers/visual/visual_server_wrap_mt.h"
|
|
||||||
#include "main/main.h"
|
#include "main/main.h"
|
||||||
#include "os/keyboard.h"
|
#include "os/keyboard.h"
|
||||||
#include "dir_access_osx.h"
|
#include "print_string.h"
|
||||||
|
#include "sem_osx.h"
|
||||||
|
#include "servers/physics/physics_server_sw.h"
|
||||||
|
#include "servers/visual/visual_server_raster.h"
|
||||||
|
|
||||||
|
#include <Carbon/Carbon.h>
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
#include <IOKit/IOCFPlugIn.h>
|
||||||
|
#include <IOKit/IOKitLib.h>
|
||||||
|
#include <IOKit/hid/IOHIDKeys.h>
|
||||||
|
#include <IOKit/hid/IOHIDLib.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <libproc.h>
|
#include <libproc.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
//uses portions of glfw
|
//uses portions of glfw
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@@ -93,13 +90,11 @@ static NSRect convertRectToBacking(NSRect contentRect) {
|
|||||||
else
|
else
|
||||||
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
|
#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
|
||||||
return contentRect;
|
return contentRect;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static InputModifierState translateFlags(NSUInteger flags) {
|
static InputModifierState translateFlags(NSUInteger flags) {
|
||||||
InputModifierState mod;
|
InputModifierState mod;
|
||||||
|
|
||||||
|
|
||||||
mod.shift = (flags & NSShiftKeyMask);
|
mod.shift = (flags & NSShiftKeyMask);
|
||||||
mod.control = (flags & NSControlKeyMask);
|
mod.control = (flags & NSControlKeyMask);
|
||||||
mod.alt = (flags & NSAlternateKeyMask);
|
mod.alt = (flags & NSAlternateKeyMask);
|
||||||
@@ -114,7 +109,6 @@ static int prev_mouse_x = 0;
|
|||||||
static int prev_mouse_y = 0;
|
static int prev_mouse_y = 0;
|
||||||
static int button_mask = 0;
|
static int button_mask = 0;
|
||||||
|
|
||||||
|
|
||||||
@interface GodotApplication : NSApplication
|
@interface GodotApplication : NSApplication
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -177,7 +171,6 @@ static int button_mask = 0;
|
|||||||
|
|
||||||
@implementation GodotWindowDelegate
|
@implementation GodotWindowDelegate
|
||||||
|
|
||||||
|
|
||||||
- (BOOL)windowShouldClose:(id)sender {
|
- (BOOL)windowShouldClose:(id)sender {
|
||||||
//_GodotInputWindowCloseRequest(window);
|
//_GodotInputWindowCloseRequest(window);
|
||||||
if (OS_OSX::singleton->get_main_loop())
|
if (OS_OSX::singleton->get_main_loop())
|
||||||
@@ -186,9 +179,6 @@ static int button_mask = 0;
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- (void)windowDidResize:(NSNotification *)notification {
|
- (void)windowDidResize:(NSNotification *)notification {
|
||||||
[OS_OSX::singleton->context update];
|
[OS_OSX::singleton->context update];
|
||||||
|
|
||||||
@@ -198,7 +188,6 @@ static int button_mask = 0;
|
|||||||
OS_OSX::singleton->window_size.width = fbRect.size.width * OS_OSX::singleton->display_scale;
|
OS_OSX::singleton->window_size.width = fbRect.size.width * OS_OSX::singleton->display_scale;
|
||||||
OS_OSX::singleton->window_size.height = fbRect.size.height * OS_OSX::singleton->display_scale;
|
OS_OSX::singleton->window_size.height = fbRect.size.height * OS_OSX::singleton->display_scale;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
_GodotInputFramebufferSize(window, fbRect.size.width, fbRect.size.height);
|
_GodotInputFramebufferSize(window, fbRect.size.width, fbRect.size.height);
|
||||||
_GodotInputWindowSize(window, contentRect.size.width, contentRect.size.height);
|
_GodotInputWindowSize(window, contentRect.size.width, contentRect.size.height);
|
||||||
@@ -279,7 +268,6 @@ static int button_mask = 0;
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
[trackingArea release];
|
[trackingArea release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
@@ -306,8 +294,6 @@ static int button_mask = 0;
|
|||||||
ret.parse_utf8(utfs);
|
ret.parse_utf8(utfs);
|
||||||
free(utfs);
|
free(utfs);
|
||||||
files.push_back(ret);
|
files.push_back(ret);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (files.size()) {
|
if (files.size()) {
|
||||||
@@ -318,7 +304,6 @@ static int button_mask = 0;
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (BOOL)isOpaque {
|
- (BOOL)isOpaque {
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
@@ -546,7 +531,6 @@ static int button_mask = 0;
|
|||||||
OS_OSX::singleton->main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_ENTER);
|
OS_OSX::singleton->main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_ENTER);
|
||||||
if (OS_OSX::singleton->input)
|
if (OS_OSX::singleton->input)
|
||||||
OS_OSX::singleton->input->set_mouse_in_window(true);
|
OS_OSX::singleton->input->set_mouse_in_window(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewDidChangeBackingProperties {
|
- (void)viewDidChangeBackingProperties {
|
||||||
@@ -564,12 +548,14 @@ static int button_mask = 0;
|
|||||||
[trackingArea release];
|
[trackingArea release];
|
||||||
}
|
}
|
||||||
|
|
||||||
NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited |
|
NSTrackingAreaOptions options =
|
||||||
|
NSTrackingMouseEnteredAndExited |
|
||||||
NSTrackingActiveInKeyWindow |
|
NSTrackingActiveInKeyWindow |
|
||||||
NSTrackingCursorUpdate |
|
NSTrackingCursorUpdate |
|
||||||
NSTrackingInVisibleRect;
|
NSTrackingInVisibleRect;
|
||||||
|
|
||||||
trackingArea = [[NSTrackingArea alloc] initWithRect:[self bounds]
|
trackingArea = [[NSTrackingArea alloc]
|
||||||
|
initWithRect:[self bounds]
|
||||||
options:options
|
options:options
|
||||||
owner:self
|
owner:self
|
||||||
userInfo:nil];
|
userInfo:nil];
|
||||||
@@ -858,12 +844,12 @@ static int translateKey(unsigned int key) {
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface GodotWindow : NSWindow {}
|
@interface GodotWindow : NSWindow {
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation GodotWindow
|
@implementation GodotWindow
|
||||||
|
|
||||||
|
|
||||||
- (BOOL)canBecomeKeyWindow {
|
- (BOOL)canBecomeKeyWindow {
|
||||||
// Required for NSBorderlessWindowMask windows
|
// Required for NSBorderlessWindowMask windows
|
||||||
return YES;
|
return YES;
|
||||||
@@ -871,7 +857,6 @@ static int translateKey(unsigned int key) {
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
int OS_OSX::get_video_driver_count() const {
|
int OS_OSX::get_video_driver_count() const {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -891,7 +876,6 @@ OS::VideoMode OS_OSX::get_default_video_mode() const {
|
|||||||
return vm;
|
return vm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void OS_OSX::initialize_core() {
|
void OS_OSX::initialize_core() {
|
||||||
|
|
||||||
OS_Unix::initialize_core();
|
OS_Unix::initialize_core();
|
||||||
@@ -901,7 +885,6 @@ void OS_OSX::initialize_core() {
|
|||||||
DirAccess::make_default<DirAccessOSX>(DirAccess::ACCESS_FILESYSTEM);
|
DirAccess::make_default<DirAccessOSX>(DirAccess::ACCESS_FILESYSTEM);
|
||||||
|
|
||||||
SemaphoreOSX::make_default();
|
SemaphoreOSX::make_default();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool keyboard_layout_dirty = true;
|
static bool keyboard_layout_dirty = true;
|
||||||
@@ -939,7 +922,6 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
|
|||||||
|
|
||||||
unsigned int styleMask = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | (p_desired.resizable ? NSResizableWindowMask : 0);
|
unsigned int styleMask = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | (p_desired.resizable ? NSResizableWindowMask : 0);
|
||||||
|
|
||||||
|
|
||||||
window_object = [[GodotWindow alloc]
|
window_object = [[GodotWindow alloc]
|
||||||
initWithContentRect:NSMakeRect(0, 0, p_desired.width / display_scale, p_desired.height / display_scale)
|
initWithContentRect:NSMakeRect(0, 0, p_desired.width / display_scale, p_desired.height / display_scale)
|
||||||
styleMask:styleMask
|
styleMask:styleMask
|
||||||
@@ -975,9 +957,13 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
|
|||||||
|
|
||||||
// Fail if a robustness strategy was requested
|
// Fail if a robustness strategy was requested
|
||||||
|
|
||||||
|
#define ADD_ATTR(x) \
|
||||||
#define ADD_ATTR(x) { attributes[attributeCount++] = x; }
|
{ attributes[attributeCount++] = x; }
|
||||||
#define ADD_ATTR2(x, y) { ADD_ATTR(x); ADD_ATTR(y); }
|
#define ADD_ATTR2(x, y) \
|
||||||
|
{ \
|
||||||
|
ADD_ATTR(x); \
|
||||||
|
ADD_ATTR(y); \
|
||||||
|
}
|
||||||
|
|
||||||
// Arbitrary array size here
|
// Arbitrary array size here
|
||||||
NSOpenGLPixelFormatAttribute attributes[40];
|
NSOpenGLPixelFormatAttribute attributes[40];
|
||||||
@@ -1022,7 +1008,6 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
|
|||||||
pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
|
pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
|
||||||
ERR_FAIL_COND(pixelFormat == nil);
|
ERR_FAIL_COND(pixelFormat == nil);
|
||||||
|
|
||||||
|
|
||||||
context = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:nil];
|
context = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:nil];
|
||||||
|
|
||||||
ERR_FAIL_COND(context == nil);
|
ERR_FAIL_COND(context == nil);
|
||||||
@@ -1044,7 +1029,6 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
|
|||||||
|
|
||||||
bool use_gl2 = p_video_driver != 1;
|
bool use_gl2 = p_video_driver != 1;
|
||||||
|
|
||||||
|
|
||||||
AudioDriverManager::add_driver(&audio_driver_osx);
|
AudioDriverManager::add_driver(&audio_driver_osx);
|
||||||
|
|
||||||
// only opengl support here...
|
// only opengl support here...
|
||||||
@@ -1110,7 +1094,6 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
|
|||||||
int dpi = (displayPixelSize.width * 25.4f / displayPhysicalSize.width) * displayScale;
|
int dpi = (displayPixelSize.width * 25.4f / displayPhysicalSize.width) * displayScale;
|
||||||
|
|
||||||
screen_dpi.push_back(dpi);
|
screen_dpi.push_back(dpi);
|
||||||
|
|
||||||
};
|
};
|
||||||
restore_rect = Rect2(get_window_position(), get_window_size());
|
restore_rect = Rect2(get_window_position(), get_window_size());
|
||||||
}
|
}
|
||||||
@@ -1134,14 +1117,12 @@ void OS_OSX::finalize() {
|
|||||||
memdelete(physics_2d_server);
|
memdelete(physics_2d_server);
|
||||||
|
|
||||||
screens.clear();
|
screens.clear();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OS_OSX::set_main_loop(MainLoop *p_main_loop) {
|
void OS_OSX::set_main_loop(MainLoop *p_main_loop) {
|
||||||
|
|
||||||
main_loop = p_main_loop;
|
main_loop = p_main_loop;
|
||||||
input->set_main_loop(p_main_loop);
|
input->set_main_loop(p_main_loop);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OS_OSX::delete_main_loop() {
|
void OS_OSX::delete_main_loop() {
|
||||||
@@ -1152,7 +1133,6 @@ void OS_OSX::delete_main_loop() {
|
|||||||
main_loop = NULL;
|
main_loop = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
String OS_OSX::get_name() {
|
String OS_OSX::get_name() {
|
||||||
|
|
||||||
return "OSX";
|
return "OSX";
|
||||||
@@ -1204,11 +1184,9 @@ void OS_OSX::set_cursor_shape(CursorShape p_shape) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OS_OSX::set_mouse_show(bool p_show) {
|
void OS_OSX::set_mouse_show(bool p_show) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OS_OSX::set_mouse_grab(bool p_grab) {
|
void OS_OSX::set_mouse_grab(bool p_grab) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OS_OSX::is_mouse_grab_enabled() const {
|
bool OS_OSX::is_mouse_grab_enabled() const {
|
||||||
@@ -1258,14 +1236,14 @@ int OS_OSX::get_mouse_button_state() const {
|
|||||||
void OS_OSX::set_window_title(const String &p_title) {
|
void OS_OSX::set_window_title(const String &p_title) {
|
||||||
|
|
||||||
[window_object setTitle:[NSString stringWithUTF8String:p_title.utf8().get_data()]];
|
[window_object setTitle:[NSString stringWithUTF8String:p_title.utf8().get_data()]];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OS_OSX::set_icon(const Image &p_icon) {
|
void OS_OSX::set_icon(const Image &p_icon) {
|
||||||
|
|
||||||
Image img = p_icon;
|
Image img = p_icon;
|
||||||
img.convert(Image::FORMAT_RGBA8);
|
img.convert(Image::FORMAT_RGBA8);
|
||||||
NSBitmapImageRep *imgrep= [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes: NULL
|
NSBitmapImageRep *imgrep = [[[NSBitmapImageRep alloc]
|
||||||
|
initWithBitmapDataPlanes:NULL
|
||||||
pixelsWide:p_icon.get_width()
|
pixelsWide:p_icon.get_width()
|
||||||
pixelsHigh:p_icon.get_height()
|
pixelsHigh:p_icon.get_height()
|
||||||
bitsPerSample:8
|
bitsPerSample:8
|
||||||
@@ -1289,7 +1267,6 @@ void OS_OSX::set_icon(const Image& p_icon) {
|
|||||||
pixels[i * 4 + 1] = (uint8_t)(((uint16_t)r[i * 4 + 1] * alpha) / 255);
|
pixels[i * 4 + 1] = (uint8_t)(((uint16_t)r[i * 4 + 1] * alpha) / 255);
|
||||||
pixels[i * 4 + 2] = (uint8_t)(((uint16_t)r[i * 4 + 2] * alpha) / 255);
|
pixels[i * 4 + 2] = (uint8_t)(((uint16_t)r[i * 4 + 2] * alpha) / 255);
|
||||||
pixels[i * 4 + 3] = alpha;
|
pixels[i * 4 + 3] = alpha;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NSImage *nsimg = [[[NSImage alloc] initWithSize:NSMakeSize(img.get_width(), img.get_height())] autorelease];
|
NSImage *nsimg = [[[NSImage alloc] initWithSize:NSMakeSize(img.get_width(), img.get_height())] autorelease];
|
||||||
@@ -1297,7 +1274,6 @@ void OS_OSX::set_icon(const Image& p_icon) {
|
|||||||
[nsimg addRepresentation:imgrep];
|
[nsimg addRepresentation:imgrep];
|
||||||
|
|
||||||
[NSApp setApplicationIconImage:nsimg];
|
[NSApp setApplicationIconImage:nsimg];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MainLoop *OS_OSX::get_main_loop() const {
|
MainLoop *OS_OSX::get_main_loop() const {
|
||||||
@@ -1344,13 +1320,11 @@ String OS_OSX::get_clipboard() const {
|
|||||||
void OS_OSX::release_rendering_thread() {
|
void OS_OSX::release_rendering_thread() {
|
||||||
|
|
||||||
[NSOpenGLContext clearCurrentContext];
|
[NSOpenGLContext clearCurrentContext];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OS_OSX::make_rendering_thread() {
|
void OS_OSX::make_rendering_thread() {
|
||||||
|
|
||||||
[context makeCurrentContext];
|
[context makeCurrentContext];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Error OS_OSX::shell_open(String p_uri) {
|
Error OS_OSX::shell_open(String p_uri) {
|
||||||
@@ -1367,7 +1341,6 @@ String OS_OSX::get_locale() const {
|
|||||||
void OS_OSX::swap_buffers() {
|
void OS_OSX::swap_buffers() {
|
||||||
|
|
||||||
[context flushBuffer];
|
[context flushBuffer];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OS_OSX::wm_minimized(bool p_minimized) {
|
void OS_OSX::wm_minimized(bool p_minimized) {
|
||||||
@@ -1376,7 +1349,6 @@ void OS_OSX::wm_minimized(bool p_minimized) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void OS_OSX::set_video_mode(const VideoMode &p_video_mode, int p_screen) {
|
void OS_OSX::set_video_mode(const VideoMode &p_video_mode, int p_screen) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OS::VideoMode OS_OSX::get_video_mode(int p_screen) const {
|
OS::VideoMode OS_OSX::get_video_mode(int p_screen) const {
|
||||||
@@ -1389,7 +1361,6 @@ OS::VideoMode OS_OSX::get_video_mode(int p_screen) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OS_OSX::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen) const {
|
void OS_OSX::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen) const {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int OS_OSX::get_screen_count() const {
|
int OS_OSX::get_screen_count() const {
|
||||||
@@ -1432,7 +1403,6 @@ Point2 OS_OSX::get_window_position() const {
|
|||||||
return wp;
|
return wp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void OS_OSX::set_window_position(const Point2 &p_position) {
|
void OS_OSX::set_window_position(const Point2 &p_position) {
|
||||||
|
|
||||||
Point2 size = p_position;
|
Point2 size = p_position;
|
||||||
@@ -1443,7 +1413,6 @@ void OS_OSX::set_window_position(const Point2& p_position) {
|
|||||||
Size2 OS_OSX::get_window_size() const {
|
Size2 OS_OSX::get_window_size() const {
|
||||||
|
|
||||||
return window_size;
|
return window_size;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void OS_OSX::set_window_size(const Size2 p_size) {
|
void OS_OSX::set_window_size(const Size2 p_size) {
|
||||||
@@ -1514,7 +1483,6 @@ bool OS_OSX::is_window_minimized() const {
|
|||||||
return minimized;
|
return minimized;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void OS_OSX::set_window_maximized(bool p_enabled) {
|
void OS_OSX::set_window_maximized(bool p_enabled) {
|
||||||
|
|
||||||
if (p_enabled) {
|
if (p_enabled) {
|
||||||
@@ -1533,7 +1501,6 @@ bool OS_OSX::is_window_maximized() const {
|
|||||||
return maximized;
|
return maximized;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void OS_OSX::move_window_to_foreground() {
|
void OS_OSX::move_window_to_foreground() {
|
||||||
|
|
||||||
[window_object orderFrontRegardless];
|
[window_object orderFrontRegardless];
|
||||||
@@ -1560,7 +1527,6 @@ String OS_OSX::get_executable_path() const {
|
|||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns string representation of keys, if they are printable.
|
// Returns string representation of keys, if they are printable.
|
||||||
@@ -1645,10 +1611,12 @@ OS::LatinKeyboardVariant OS_OSX::get_latin_keyboard_variant() const {
|
|||||||
void OS_OSX::process_events() {
|
void OS_OSX::process_events() {
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask
|
NSEvent *event = [NSApp
|
||||||
|
nextEventMatchingMask:NSAnyEventMask
|
||||||
untilDate:[NSDate distantPast]
|
untilDate:[NSDate distantPast]
|
||||||
inMode:NSDefaultRunLoopMode
|
inMode:NSDefaultRunLoopMode
|
||||||
dequeue:YES];
|
dequeue:YES];
|
||||||
|
|
||||||
if (event == nil)
|
if (event == nil)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1659,8 +1627,6 @@ void OS_OSX::process_events() {
|
|||||||
autoreleasePool = [[NSAutoreleasePool alloc] init];
|
autoreleasePool = [[NSAutoreleasePool alloc] init];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void OS_OSX::push_input(const InputEvent &p_event) {
|
void OS_OSX::push_input(const InputEvent &p_event) {
|
||||||
|
|
||||||
InputEvent ev = p_event;
|
InputEvent ev = p_event;
|
||||||
@@ -1725,7 +1691,6 @@ OS::MouseMode OS_OSX::get_mouse_mode() const {
|
|||||||
return mouse_mode;
|
return mouse_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
String OS_OSX::get_joy_guid(int p_device) const {
|
String OS_OSX::get_joy_guid(int p_device) const {
|
||||||
return input->get_joy_guid_remapped(p_device);
|
return input->get_joy_guid_remapped(p_device);
|
||||||
}
|
}
|
||||||
@@ -1756,7 +1721,6 @@ OS_OSX::OS_OSX() {
|
|||||||
|
|
||||||
CGEventSourceSetLocalEventsSuppressionInterval(eventSource, 0.0);
|
CGEventSourceSetLocalEventsSuppressionInterval(eventSource, 0.0);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (pthread_key_create(&_Godot.nsgl.current, NULL) != 0) {
|
if (pthread_key_create(&_Godot.nsgl.current, NULL) != 0) {
|
||||||
_GodotInputError(Godot_PLATFORM_ERROR, "NSGL: Failed to create context TLS");
|
_GodotInputError(Godot_PLATFORM_ERROR, "NSGL: Failed to create context TLS");
|
||||||
@@ -1786,7 +1750,6 @@ OS_OSX::OS_OSX() {
|
|||||||
ERR_FAIL_COND(!delegate);
|
ERR_FAIL_COND(!delegate);
|
||||||
[NSApp setDelegate:delegate];
|
[NSApp setDelegate:delegate];
|
||||||
|
|
||||||
|
|
||||||
cursor_shape = CURSOR_ARROW;
|
cursor_shape = CURSOR_ARROW;
|
||||||
|
|
||||||
current_screen = 0;
|
current_screen = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user