summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/android/detect.py32
-rw-r--r--platform/android/java/res/values-ko/strings.xml51
-rw-r--r--platform/android/java/res/values/strings.xml4
-rw-r--r--platform/bb10/detect.py4
-rw-r--r--platform/flash/detect.py10
-rw-r--r--platform/iphone/app_delegate.mm30
-rw-r--r--platform/iphone/detect.py6
-rw-r--r--platform/iphone/game_center.mm46
-rwxr-xr-xplatform/iphone/gl_view.mm54
-rw-r--r--platform/iphone/icloud.mm84
-rw-r--r--platform/iphone/in_app_store.mm28
-rw-r--r--platform/isim/detect.py4
-rw-r--r--platform/javascript/detect.py4
-rw-r--r--platform/javascript/dom_keys.h375
-rw-r--r--platform/javascript/javascript_main.cpp110
-rw-r--r--platform/javascript/os_javascript.cpp88
-rw-r--r--platform/javascript/os_javascript.h3
-rw-r--r--platform/nacl/detect.py2
-rw-r--r--platform/osx/detect.py2
-rw-r--r--platform/osx/dir_access_osx.mm10
-rw-r--r--platform/osx/godot_osx.mm20
-rw-r--r--platform/osx/os_osx.mm4
-rw-r--r--platform/server/detect.py10
-rw-r--r--platform/windows/detect.py58
-rw-r--r--platform/winrt/detect.py10
-rw-r--r--platform/x11/detect.py16
-rw-r--r--platform/x11/joystick_linux.cpp2
-rw-r--r--platform/x11/os_x11.cpp2
28 files changed, 728 insertions, 341 deletions
diff --git a/platform/android/detect.py b/platform/android/detect.py
index d4038f6584..366ec6321d 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -5,7 +5,7 @@ import platform
def is_active():
return True
-
+
def get_name():
return "Android"
@@ -56,9 +56,9 @@ def configure(env):
# http://www.scons.org/wiki/LongCmdLinesOnWin32
import os
if (os.name=="nt"):
-
+
import subprocess
-
+
def mySubProcess(cmdline,env):
#print "SPAWNED : " + cmdline
startupinfo = subprocess.STARTUPINFO()
@@ -72,26 +72,26 @@ def configure(env):
print err
print "====="
return rv
-
+
def mySpawn(sh, escape, cmd, args, env):
-
+
newargs = ' '.join(args[1:])
cmdline = cmd + " " + newargs
-
+
rv=0
if len(cmdline) > 32000 and cmd.endswith("ar") :
cmdline = cmd + " " + args[1] + " " + args[2] + " "
for i in range(3,len(args)) :
rv = mySubProcess( cmdline + args[i], env )
if rv :
- break
- else:
+ break
+ else:
rv = mySubProcess( cmdline, env )
-
+
return rv
-
+
env['SPAWN'] = mySpawn
-
+
ndk_platform=env['ndk_platform']
if env['android_arch'] not in ['armv7','armv6','x86']:
@@ -114,7 +114,7 @@ def configure(env):
print("Godot Android!!!!! ("+env['android_arch']+")"+neon_text)
env.Append(CPPPATH=['#platform/android'])
-
+
if env['android_arch']=='x86':
env.extra_suffix=".x86"+env.extra_suffix
elif env['android_arch']=='armv6':
@@ -126,7 +126,7 @@ def configure(env):
env.extra_suffix=".armv7"+env.extra_suffix
gcc_path=env["ANDROID_NDK_ROOT"]+"/toolchains/"+env["NDK_TARGET"]+"/prebuilt/";
-
+
import os
if (sys.platform.find("linux")==0):
if (platform.architecture()[0]=='64bit' or os.path.isdir(gcc_path+"linux-x86_64/bin")): # check was not working
@@ -138,8 +138,8 @@ def configure(env):
env['SHLINKFLAGS'][1] = '-shared'
elif (os.name=="nt"):
gcc_path=gcc_path+"/windows-x86_64/bin" #this may be wrong
-
-
+
+
env['ENV']['PATH'] = gcc_path+":"+env['ENV']['PATH']
if env['android_arch']=='x86':
@@ -224,7 +224,7 @@ def configure(env):
elif env["android_arch"]=="armv7":
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include"])
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a"])
-
+
env.Append(LIBS=["gnustl_static","supc++"])
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"]+"/sources/cpufeatures"])
diff --git a/platform/android/java/res/values-ko/strings.xml b/platform/android/java/res/values-ko/strings.xml
index 6d27498af8..b997b934b2 100644
--- a/platform/android/java/res/values-ko/strings.xml
+++ b/platform/android/java/res/values-ko/strings.xml
@@ -1,4 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="godot_project_name_string">godot-project-name-ko</string>
+ <string name="text_paused_cellular">모바일 네트워크를 사용하여 다운로드 하시겠습니까? 남은 데이터 사용량에 따라, 요금이 부과될 수 있습니다.</string>
+ <string name="text_paused_cellular_2">모바일 네트워크를 사용하여 다운로드 하지 않을 경우, 와이파이 연결이 가능할 때 자동적으로 다운로드가 이루어집니다.</string>
+ <string name="text_button_resume_cellular">다운로드 계속하기</string>
+ <string name="text_button_wifi_settings">와이파이 설정</string>
+ <string name="text_verifying_download">다운로드 확인중</string>
+ <string name="text_validation_complete">추가 파일 확인이 완료되었습니다. 확인을 눌러 진행하세요.</string>
+ <string name="text_validation_failed">추가 파일 확인에 실패하였습니다.</string>
+ <string name="text_button_pause">다운로드 일시정지</string>
+ <string name="text_button_resume">다운로드 계속하기</string>
+ <string name="text_button_cancel">취소</string>
+ <string name="text_button_cancel_verify">파일 확인 취소</string>
+
+ <!-- APK Expansion Strings -->
+
+ <!-- When a download completes, a notification is displayed, and this
+ string is used to indicate that the download successfully completed.
+ Note that such a download could have been initiated by a variety of
+ applications, including (but not limited to) the browser, an email
+ application, a content marketplace. -->
+ <string name="notification_download_complete">다운로드 완료</string>
+
+ <!-- When a download completes, a notification is displayed, and this
+ string is used to indicate that the download failed.
+ Note that such a download could have been initiated by a variety of
+ applications, including (but not limited to) the browser, an email
+ application, a content marketplace. -->
+ <string name="notification_download_failed">다운로드 실패</string>
+
+
+ <string name="state_unknown">시작중...</string>
+ <string name="state_idle">다운로드 시작을 기다리는 중</string>
+ <string name="state_fetching_url">다운로드할 항목을 찾는 중</string>
+ <string name="state_connecting">다운로드 서버에 연결 중</string>
+ <string name="state_downloading">다운로드 중</string>
+ <string name="state_completed">다운로드 종료</string>
+ <string name="state_paused_network_unavailable">와이파이를 찾을 수 없어 다운로드가 일시정지 되었습니다.</string>
+ <string name="state_paused_network_setup_failure">다운로드가 일시정지 되었습니다. 네트워크 연결 상태를 확인하세요.</string>
+ <string name="state_paused_by_request">다운로드 일시정지</string>
+ <string name="state_paused_wifi_unavailable">와이파이가 사용하능하지 않아 다운로드가 일시정지 되었습니다.</string>
+ <string name="state_paused_wifi_disabled">와이파이가 비활성화 되어 다운로드가 일시정지 되었습니다.</string>
+ <string name="state_paused_roaming">로밍 상태이어서 다운로드가 일시정지 되었습니다.</string>
+ <string name="state_paused_sdcard_unavailable">외부 저장소를 사용할 수 없어 다운로드가 일시정지 되었습니다.</string>
+ <string name="state_failed_unlicensed">이 앱을 구매하지 않아 다운로드가 정지 되었습니다.</string>
+ <string name="state_failed_fetching_url">다운로드 항목을 찾을 수 없어 다운로드가 정지 되었습니다.</string>
+ <string name="state_failed_sdcard_full">외부 저장소가 가득차서 다운로드가 실패하였습니다.</string>
+ <string name="state_failed_cancelled">다운로드 취소</string>
+ <string name="state_failed">다운로드 실패</string>
+
+ <string name="kilobytes_per_second">%1$s KB/s</string>
+ <string name="time_remaining">남은 시간: %1$s</string>
+ <string name="time_remaining_notification">%1$s 남음</string>
</resources> \ No newline at end of file
diff --git a/platform/android/java/res/values/strings.xml b/platform/android/java/res/values/strings.xml
index e1dbdfc062..f0ea56148f 100644
--- a/platform/android/java/res/values/strings.xml
+++ b/platform/android/java/res/values/strings.xml
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="godot_project_name_string">godot-project-name</string>
- <string name="testuf8">元気です</string>
- <string name="testuf2">元気です元気です元気です</string>
<string name="text_paused_cellular">Would you like to enable downloading over cellular connections? Depending on your data plan, this may cost you money.</string>
<string name="text_paused_cellular_2">If you choose not to enable downloading over cellular connections, the download will automatically resume when wi-fi is available.</string>
<string name="text_button_resume_cellular">Resume download</string>
@@ -32,7 +30,7 @@
<string name="notification_download_failed">Download unsuccessful</string>
- <string name="state_unknown">Starting..."</string>
+ <string name="state_unknown">Starting...</string>
<string name="state_idle">Waiting for download to start</string>
<string name="state_fetching_url">Looking for resources to download</string>
<string name="state_connecting">Connecting to the download server</string>
diff --git a/platform/bb10/detect.py b/platform/bb10/detect.py
index f134a9df19..9ab94e619a 100644
--- a/platform/bb10/detect.py
+++ b/platform/bb10/detect.py
@@ -6,7 +6,7 @@ import methods
def is_active():
return True
-
+
def get_name():
return "BlackBerry 10"
@@ -36,7 +36,7 @@ def get_flags():
('tools', 'no'),
('nedmalloc', 'no'),
('theora', 'no'),
-
+
]
def configure(env):
diff --git a/platform/flash/detect.py b/platform/flash/detect.py
index f079f21fdd..7f558a2b75 100644
--- a/platform/flash/detect.py
+++ b/platform/flash/detect.py
@@ -4,7 +4,7 @@ import string
def is_active():
return True
-
+
def get_name():
return "Flash"
@@ -18,7 +18,7 @@ def can_build():
def get_opts():
return []
-
+
def get_flags():
@@ -52,7 +52,7 @@ def configure(env):
if (ccroot.find("/cygdrive")==0):
unit = ccroot[ ccroot.find("/") + 1 ]
ccroot=ccroot.replace("/cygdrive/"+unit,unit+":")
-
+
env['FLASCC_ROOT'] = ccroot
if env['PLATFORM'] == 'win32':
import methods
@@ -71,11 +71,11 @@ def configure(env):
env['AR'] = ccroot+'/sdk/usr/bin/ar'
env['LINK'] = ccroot+'/sdk/usr/bin/gcc'
-
+
env['OBJSUFFIX'] = ".fl.o"
env['LIBSUFFIX'] = ".fl.a"
env['PROGSUFFIX'] = "_flash"
-
+
#env["CXX"]='gcc-4'
import string
#include path
diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm
index a3af8ff163..dab75e08c8 100644
--- a/platform/iphone/app_delegate.mm
+++ b/platform/iphone/app_delegate.mm
@@ -100,7 +100,7 @@ static int frame_count = 0;
int backingHeight;
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
-
+
OS::VideoMode vm;
vm.fullscreen = true;
@@ -118,7 +118,7 @@ static int frame_count = 0;
NSString *documentsDirectory = [paths objectAtIndex:0];
//NSString *documentsDirectory = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
OSIPhone::get_singleton()->set_data_dir(String::utf8([documentsDirectory UTF8String]));
-
+
NSString *locale_code = [[[NSLocale preferredLanguages] objectAtIndex:0] substringToIndex:2];
OSIPhone::get_singleton()->set_locale(String::utf8([locale_code UTF8String]));
@@ -218,7 +218,7 @@ static int frame_count = 0;
[application setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
// disable idle timer
//application.idleTimerDisabled = YES;
-
+
//Create a full-screen window
window = [[UIWindow alloc] initWithFrame:rect];
//window.autoresizesSubviews = YES;
@@ -236,9 +236,9 @@ static int frame_count = 0;
int backingHeight;
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
-
+
iphone_main(backingWidth, backingHeight, gargc, gargv);
-
+
view_controller = [[ViewController alloc] init];
view_controller.view = glView;
window.rootViewController = view_controller;
@@ -248,7 +248,7 @@ static int frame_count = 0;
printf("cadisaplylink: %d", glView.useCADisplayLink);
glView.animationInterval = 1.0 / kRenderingFrequency;
[glView startAnimation];
-
+
//Show the window
[window makeKeyAndVisible];
@@ -261,9 +261,9 @@ static int frame_count = 0;
//OSIPhone::screen_width = rect.size.width - rect.origin.x;
//OSIPhone::screen_height = rect.size.height - rect.origin.y;
-
+
mainViewController = view_controller;
-
+
#ifdef MODULE_GAME_ANALYTICS_ENABLED
printf("********************* didFinishLaunchingWithOptions\n");
if(!Globals::get_singleton()->has("mobileapptracker/advertiser_id"))
@@ -274,24 +274,24 @@ static int frame_count = 0;
{
return;
}
-
+
String adid = GLOBAL_DEF("mobileapptracker/advertiser_id","");
String convkey = GLOBAL_DEF("mobileapptracker/conversion_key","");
-
+
NSString * advertiser_id = [NSString stringWithUTF8String:adid.utf8().get_data()];
NSString * conversion_key = [NSString stringWithUTF8String:convkey.utf8().get_data()];
-
+
// Account Configuration info - must be set
[MobileAppTracker initializeWithMATAdvertiserId:advertiser_id
MATConversionKey:conversion_key];
-
+
// Used to pass us the IFA, enables highly accurate 1-to-1 attribution.
// Required for many advertising networks.
[MobileAppTracker setAppleAdvertisingIdentifier:[[ASIdentifierManager sharedManager] advertisingIdentifier]
advertisingTrackingEnabled:[[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled]];
-
+
#endif
-
+
};
- (void)applicationWillTerminate:(UIApplication*)application {
@@ -389,7 +389,7 @@ static int frame_count = 0;
[PFPush handlePush:userInfo];
NSDictionary *aps = [userInfo objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
-
+
NSLog(@"Push Notification Payload (app active) %@", aps);
[defaults setObject:aps forKey:@"notificationInfo"];
[defaults synchronize];
diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py
index 9472f05e16..c3ee098350 100644
--- a/platform/iphone/detect.py
+++ b/platform/iphone/detect.py
@@ -108,7 +108,7 @@ def configure(env):
if env['store_kit'] == 'yes':
env.Append(CPPFLAGS=['-DSTOREKIT_ENABLED'])
env.Append(LINKFLAGS=['-framework', 'StoreKit'])
-
+
if env['icloud'] == 'yes':
env.Append(CPPFLAGS=['-DICLOUD_ENABLED'])
@@ -117,7 +117,7 @@ def configure(env):
if (env["target"]=="release"):
env.Append(CCFLAGS=['-O3', '-DNS_BLOCK_ASSERTIONS=1','-Wall', '-gdwarf-2']) # removed -ffast-math
- env.Append(LINKFLAGS=['-O3']) #
+ env.Append(LINKFLAGS=['-O3']) #
elif env["target"] == "release_debug":
env.Append(CCFLAGS=['-Os', '-DNS_BLOCK_ASSERTIONS=1','-Wall','-DDEBUG_ENABLED'])
@@ -151,7 +151,7 @@ def configure(env):
env.Append(CPPFLAGS=['-fno-exceptions'])
#env['neon_enabled']=True
env['S_compiler'] = '$IPHONEPATH/Developer/usr/bin/gcc'
-
+
import methods
env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
diff --git a/platform/iphone/game_center.mm b/platform/iphone/game_center.mm
index 3756b58699..a5b90514da 100644
--- a/platform/iphone/game_center.mm
+++ b/platform/iphone/game_center.mm
@@ -94,10 +94,10 @@ Error GameCenter::connect() {
ret["error_description"] = [error.localizedDescription UTF8String];
GameCenter::get_singleton()->connected = false;
};
-
+
pending_events.push_back(ret);
};
-
+
});
return OK;
@@ -156,7 +156,7 @@ Error GameCenter::award_achievement(Variant p_params) {
if (params.has("show_completion_banner")) {
achievement.showsCompletionBanner = params["show_completion_banner"] ? YES : NO;
}
-
+
[GKAchievement reportAchievements:@[achievement] withCompletionHandler:^(NSError *error) {
Dictionary ret;
@@ -189,30 +189,30 @@ void GameCenter::request_achievement_descriptions() {
IntArray maximum_points;
Array hidden;
Array replayable;
-
+
for (int i=0; i<[descriptions count]; i++) {
GKAchievementDescription* description = [descriptions objectAtIndex:i];
-
+
const char* str = [description.identifier UTF8String];
names.push_back(String::utf8(str != NULL ? str : ""));
-
+
str = [description.title UTF8String];
titles.push_back(String::utf8(str != NULL ? str : ""));
-
+
str = [description.unachievedDescription UTF8String];
unachieved_descriptions.push_back(String::utf8(str != NULL ? str : ""));
-
+
str = [description.achievedDescription UTF8String];
achieved_descriptions.push_back(String::utf8(str != NULL ? str : ""));
-
+
maximum_points.push_back(description.maximumPoints);
-
+
hidden.push_back(description.hidden == YES);
-
+
replayable.push_back(description.replayable == YES);
}
-
+
ret["names"] = names;
ret["titles"] = titles;
ret["unachieved_descriptions"] = unachieved_descriptions;
@@ -220,7 +220,7 @@ void GameCenter::request_achievement_descriptions() {
ret["maximum_points"] = maximum_points;
ret["hidden"] = hidden;
ret["replayable"] = replayable;
-
+
} else {
ret["result"] = "error";
ret["error_code"] = error.code;
@@ -241,19 +241,19 @@ void GameCenter::request_achievements() {
ret["result"] = "ok";
StringArray names;
RealArray percentages;
-
+
for (int i=0; i<[achievements count]; i++) {
GKAchievement* achievement = [achievements objectAtIndex:i];
const char* str = [achievement.identifier UTF8String];
names.push_back(String::utf8(str != NULL ? str : ""));
-
+
percentages.push_back(achievement.percentComplete);
}
-
+
ret["names"] = names;
ret["progress"] = percentages;
-
+
} else {
ret["result"] = "error";
ret["error_code"] = error.code;
@@ -275,7 +275,7 @@ void GameCenter::reset_achievements() {
ret["result"] = "error";
ret["error_code"] = error.code;
};
-
+
pending_events.push_back(ret);
}];
};
@@ -311,7 +311,7 @@ Error GameCenter::show_game_center(Variant p_params) {
ViewController *root_controller=(ViewController *)((AppDelegate *)[[UIApplication sharedApplication] delegate]).window.rootViewController;
ERR_FAIL_COND_V(!root_controller, FAILED);
-
+
controller.gameCenterDelegate = root_controller;
controller.viewState = view_state;
if (view_state == GKGameCenterViewControllerStateLeaderboards) {
@@ -322,14 +322,14 @@ Error GameCenter::show_game_center(Variant p_params) {
controller.leaderboardIdentifier = name_str;
}
}
-
+
[root_controller presentViewController: controller animated: YES completion:nil];
-
- return OK;
+
+ return OK;
};
void GameCenter::game_center_closed() {
-
+
Dictionary ret;
ret["type"] = "show_game_center";
ret["result"] = "ok";
diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm
index 94fbb9e174..607352ab0b 100755
--- a/platform/iphone/gl_view.mm
+++ b/platform/iphone/gl_view.mm
@@ -107,7 +107,7 @@ bool _play_video(String p_path, float p_volume, String p_audio_track, String p_s
{
NSString* language = [[track locale] localeIdentifier];
NSLog(@"subtitle lang: %@", language);
-
+
if ([language isEqualToString:[NSString stringWithUTF8String:p_audio_track.utf8()]])
{
AVMutableAudioMixInputParameters *audioInputParams = [AVMutableAudioMixInputParameters audioMixInputParameters];
@@ -132,7 +132,7 @@ bool _play_video(String p_path, float p_volume, String p_audio_track, String p_s
{
NSString* language = [[track locale] localeIdentifier];
NSLog(@"subtitle lang: %@", language);
-
+
if ([language isEqualToString:[NSString stringWithUTF8String:p_subtitle_track.utf8()]])
{
[_instance.avPlayer.currentItem selectMediaOption:track inMediaSelectionGroup: subtitlesGroup];
@@ -147,7 +147,7 @@ bool _play_video(String p_path, float p_volume, String p_audio_track, String p_s
bool _is_video_playing() {
if (_instance.avPlayer.error) {
- printf("Error during playback\n");
+ printf("Error during playback\n");
}
return (_instance.avPlayer.rate > 0 && !_instance.avPlayer.error);
}
@@ -257,7 +257,7 @@ static void clear_touches() {
if((self = [super initWithCoder:coder]))
{
self = [self initGLES];
- }
+ }
return self;
}
@@ -265,14 +265,14 @@ static void clear_touches() {
{
// Get our backing layer
CAEAGLLayer *eaglLayer = (CAEAGLLayer*) self.layer;
-
+
// 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.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:FALSE], kEAGLDrawablePropertyRetainedBacking,
kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat,
nil];
-
+
// Create our EAGLContext, and if successful make it current and create our framebuffer.
context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
@@ -281,7 +281,7 @@ static void clear_touches() {
[self release];
return nil;
}
-
+
// Default the animation interval to 1/60th of a second.
animationInterval = 1.0 / 60.0;
return self;
@@ -327,17 +327,17 @@ static void clear_touches() {
glGenFramebuffersOES(1, &viewFramebuffer);
glGenRenderbuffersOES(1, &viewRenderbuffer);
-
+
glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
// This call associates the storage for the current render buffer with the EAGLDrawable (our CAEAGLLayer)
// allowing us to draw into a buffer that will later be rendered to screen whereever the layer is (which corresponds with our view).
[context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(id<EAGLDrawable>)self.layer];
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, viewRenderbuffer);
-
+
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
-
+
// For this sample, we also need a depth buffer, so we'll create and attach one via another renderbuffer.
glGenRenderbuffersOES(1, &depthRenderbuffer);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, depthRenderbuffer);
@@ -371,7 +371,7 @@ static void clear_touches() {
viewFramebuffer = 0;
glDeleteRenderbuffersOES(1, &viewRenderbuffer);
viewRenderbuffer = 0;
-
+
if(depthRenderbuffer)
{
glDeleteRenderbuffersOES(1, &depthRenderbuffer);
@@ -461,21 +461,21 @@ static void clear_touches() {
// Make sure that you are drawing to the current context
[EAGLContext setCurrentContext:context];
-
+
// If our drawing delegate needs to have the view setup, then call -setupView: and flag that it won't need to be called again.
if(!delegateSetup)
{
[delegate setupView:self];
delegateSetup = YES;
}
-
+
glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
[delegate drawView:self];
-
+
glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
[context presentRenderbuffer:GL_RENDERBUFFER_OES];
-
+
#ifdef DEBUG_ENABLED
GLenum err = glGetError();
if(err)
@@ -487,9 +487,9 @@ static void clear_touches() {
{
NSArray* tlist = [[event allTouches] allObjects];
for (unsigned int i=0; i< [tlist count]; i++) {
-
+
if ( [touches containsObject:[tlist objectAtIndex:i]] ) {
-
+
UITouch* touch = [tlist objectAtIndex:i];
if (touch.phase != UITouchPhaseBegan)
continue;
@@ -506,9 +506,9 @@ static void clear_touches() {
NSArray* tlist = [[event allTouches] allObjects];
for (unsigned int i=0; i< [tlist count]; i++) {
-
+
if ( [touches containsObject:[tlist objectAtIndex:i]] ) {
-
+
UITouch* touch = [tlist objectAtIndex:i];
if (touch.phase != UITouchPhaseMoved)
continue;
@@ -527,9 +527,9 @@ static void clear_touches() {
{
NSArray* tlist = [[event allTouches] allObjects];
for (unsigned int i=0; i< [tlist count]; i++) {
-
+
if ( [touches containsObject:[tlist objectAtIndex:i]] ) {
-
+
UITouch* touch = [tlist objectAtIndex:i];
if (touch.phase != UITouchPhaseEnded)
continue;
@@ -543,7 +543,7 @@ static void clear_touches() {
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
-
+
OSIPhone::get_singleton()->touches_cancelled();
clear_touches();
};
@@ -652,12 +652,12 @@ static void clear_touches() {
- (void)dealloc
{
[self stopAnimation];
-
+
if([EAGLContext currentContext] == context)
{
[EAGLContext setCurrentContext:nil];
}
-
+
[context release];
context = nil;
@@ -673,8 +673,8 @@ static void clear_touches() {
video_found_error = true;
}
- if(_instance.avPlayer.status == AVPlayerStatusReadyToPlay &&
- _instance.avPlayerItem.status == AVPlayerItemStatusReadyToPlay &&
+ if(_instance.avPlayer.status == AVPlayerStatusReadyToPlay &&
+ _instance.avPlayerItem.status == AVPlayerItemStatusReadyToPlay &&
CMTIME_COMPARE_INLINE(video_current_time, ==, kCMTimeZero)) {
//NSLog(@"time: %@", video_current_time);
@@ -703,7 +703,7 @@ static void clear_touches() {
/*
- (void)moviePlayBackDidFinish:(NSNotification*)notification {
-
+
NSNumber* reason = [[notification userInfo] objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey];
switch ([reason intValue]) {
diff --git a/platform/iphone/icloud.mm b/platform/iphone/icloud.mm
index 449670667f..0b3efe41fc 100644
--- a/platform/iphone/icloud.mm
+++ b/platform/iphone/icloud.mm
@@ -49,7 +49,7 @@ void ICloud::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_key_value"),&ICloud::get_key_value);
ObjectTypeDB::bind_method(_MD("synchronize_key_values"),&ICloud::synchronize_key_values);
ObjectTypeDB::bind_method(_MD("get_all_key_values"),&ICloud::get_all_key_values);
-
+
ObjectTypeDB::bind_method(_MD("get_pending_event_count"),&ICloud::get_pending_event_count);
ObjectTypeDB::bind_method(_MD("pop_pending_event"),&ICloud::pop_pending_event);
};
@@ -83,7 +83,7 @@ Variant nsobject_to_variant(NSObject* object) {
if ([data length] > 0) {
ret.resize([data length]);
{
- ByteArray::Write w = ret.write();
+ ByteArray::Write w = ret.write();
copymem(w.ptr(), [data bytes], [data length]);
}
}
@@ -101,14 +101,14 @@ Variant nsobject_to_variant(NSObject* object) {
else if ([object isKindOfClass:[NSDictionary class]]) {
Dictionary result;
NSDictionary* dic = (NSDictionary*)object;
-
-
+
+
NSArray* keys = [dic allKeys];
int count = [keys count];
for (int i=0; i < count; ++i) {
NSObject* k = [ keys objectAtIndex:i];
NSObject* v = [dic objectForKey:k];
-
+
result[nsobject_to_variant(k)] = nsobject_to_variant(v);
}
return result;
@@ -121,29 +121,29 @@ Variant nsobject_to_variant(NSObject* object) {
NSNumber* num = (NSNumber*)object;
if(strcmp([num objCType], @encode(BOOL)) == 0) {
return Variant((int)[num boolValue]);
- }
+ }
else if(strcmp([num objCType], @encode(char)) == 0) {
return Variant((int)[num charValue]);
- }
+ }
else if(strcmp([num objCType], @encode(int)) == 0) {
return Variant([num intValue]);
- }
+ }
else if(strcmp([num objCType], @encode(unsigned int)) == 0) {
return Variant((int)[num unsignedIntValue]);
- }
+ }
else if(strcmp([num objCType], @encode(long long)) == 0) {
return Variant((int)[num longValue]);
- }
+ }
else if(strcmp([num objCType], @encode(float)) == 0) {
return Variant([num floatValue]);
- }
+ }
else if(strcmp([num objCType], @encode(double)) == 0) {
return Variant((float)[num doubleValue]);
}
}
else if ([object isKindOfClass:[NSDate class]]) {
//this is a type that icloud supports...but how did you submit it in the first place?
- //I guess this is a type that *might* show up, if you were, say, trying to make your game
+ //I guess this is a type that *might* show up, if you were, say, trying to make your game
//compatible with existing cloud data written by another engine's version of your game
WARN_PRINT("NSDate unsupported, returning null Variant")
return Variant();
@@ -177,13 +177,13 @@ NSObject* variant_to_nsobject(Variant v) {
for (unsigned int i = 0; i < keys.size(); ++i) {
NSString* key = [[[NSString alloc] initWithUTF8String:((String)(keys[i])).utf8().get_data()] autorelease];
NSObject* value = variant_to_nsobject(dic[keys[i]]);
-
+
if (key == NULL || value == NULL) {
return NULL;
}
-
+
[result setObject:value forKey:key];
- }
+ }
return result;
}
else if (v.get_type() == Variant::ARRAY) {
@@ -213,13 +213,13 @@ NSObject* variant_to_nsobject(Variant v) {
Error ICloud::remove_key(Variant p_param) {
String param = p_param;
NSString* key = [[[NSString alloc] initWithUTF8String:param.utf8().get_data()] autorelease];
-
+
NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore];
-
+
if (![[store dictionaryRepresentation] objectForKey:key]) {
return ERR_INVALID_PARAMETER;
}
-
+
[store removeObjectForKey:key];
return OK;
}
@@ -228,26 +228,26 @@ Error ICloud::remove_key(Variant p_param) {
Variant ICloud::set_key_values(Variant p_params) {
Dictionary params = p_params;
Array keys = params.keys();
-
+
Array error_keys;
-
+
for (unsigned int i = 0; i < keys.size(); ++i) {
String variant_key = keys[i];
Variant variant_value = params[variant_key];
-
+
NSString* key = [[[NSString alloc] initWithUTF8String:variant_key.utf8().get_data()] autorelease];
if (key == NULL) {
error_keys.push_back(variant_key);
continue;
}
-
+
NSObject* value = variant_to_nsobject(variant_value);
-
+
if (value == NULL) {
error_keys.push_back(variant_key);
continue;
}
-
+
NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore];
[store setObject:value forKey:key];
}
@@ -257,37 +257,37 @@ Variant ICloud::set_key_values(Variant p_params) {
Variant ICloud::get_key_value(Variant p_param) {
String param = p_param;
-
+
NSString* key = [[[NSString alloc] initWithUTF8String:param.utf8().get_data()] autorelease];
NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore];
-
+
if (![[store dictionaryRepresentation] objectForKey:key]) {
return Variant();
}
-
+
Variant result = nsobject_to_variant([[store dictionaryRepresentation] objectForKey:key]);
-
+
return result;
}
Variant ICloud::get_all_key_values() {
Dictionary result;
-
+
NSUbiquitousKeyValueStore* store = [NSUbiquitousKeyValueStore defaultStore];
NSDictionary* store_dictionary = [store dictionaryRepresentation];
-
+
NSArray* keys = [store_dictionary allKeys];
int count = [keys count];
for (int i=0; i < count; ++i) {
NSString* k = [ keys objectAtIndex:i];
NSObject* v = [store_dictionary objectForKey:k];
-
+
const char* str = [k UTF8String];
if (str != NULL) {
result[String::utf8(str)] = nsobject_to_variant(v);
}
}
-
+
return result;
}
@@ -320,7 +320,7 @@ ICloud::ICloud() {
ERR_FAIL_COND(instance != NULL);
instance = this;
//connected = false;
-
+
[
//[NSNotificationCenter defaultCenter] addObserverForName: @"notify"
[NSNotificationCenter defaultCenter] addObserverForName: NSUbiquitousKeyValueStoreDidChangeExternallyNotification
@@ -337,7 +337,7 @@ ICloud::ICloud() {
//Array result_values;
Dictionary keyValues;
String reason = "";
-
+
if (change == NSUbiquitousKeyValueStoreServerChange) {
reason = "server";
}
@@ -350,27 +350,27 @@ ICloud::ICloud() {
else if (change == NSUbiquitousKeyValueStoreAccountChange) {
reason = "account";
}
-
+
ret["reason"] = reason;
-
-
+
+
NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore];
-
+
NSArray * keys = [userInfo objectForKey:NSUbiquitousKeyValueStoreChangedKeysKey];
for (NSString* key in keys) {
const char* str = [key UTF8String];
if (str == NULL) {
continue;
}
-
+
NSObject* object = [store objectForKey:key];
-
+
//figure out what kind of object it is
Variant value = nsobject_to_variant(object);
-
+
keyValues[String::utf8(str)] = value;
}
-
+
ret["changed_values"] = keyValues;
pending_events.push_back(ret);
}
diff --git a/platform/iphone/in_app_store.mm b/platform/iphone/in_app_store.mm
index fec007b7b6..a2efe2711b 100644
--- a/platform/iphone/in_app_store.mm
+++ b/platform/iphone/in_app_store.mm
@@ -179,35 +179,35 @@ Error InAppStore::request_product_info(Variant p_params) {
ret["result"] = "ok";
ret["product_id"] = pid;
ret["transaction_id"] = transactionId;
-
+
NSData* receipt = nil;
int sdk_version = 6;
-
+
if([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0){
-
+
NSURL *receiptFileURL = nil;
NSBundle *bundle = [NSBundle mainBundle];
if ([bundle respondsToSelector:@selector(appStoreReceiptURL)]) {
-
+
// Get the transaction receipt file path location in the app bundle.
receiptFileURL = [bundle appStoreReceiptURL];
-
+
// Read in the contents of the transaction file.
receipt = [NSData dataWithContentsOfURL:receiptFileURL];
sdk_version = 7;
-
+
} else {
// Fall back to deprecated transaction receipt,
// which is still available in iOS 7.
-
+
// Use SKPaymentTransaction's transactionReceipt.
receipt = transaction.transactionReceipt;
}
-
+
}else{
receipt = transaction.transactionReceipt;
}
-
+
NSString* receipt_to_send = nil;
if (receipt != nil)
{
@@ -217,16 +217,16 @@ Error InAppStore::request_product_info(Variant p_params) {
receipt_ret["receipt"] = String::utf8(receipt_to_send != nil ? [receipt_to_send UTF8String] : "");
receipt_ret["sdk"] = sdk_version;
ret["receipt"] = receipt_ret;
-
+
InAppStore::get_singleton()->_post_event(ret);
-
+
if (auto_finish_transactions){
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
}
else{
[pending_transactions setObject:transaction forKey:transaction.payment.productIdentifier];
}
-
+
#ifdef MODULE_FUSEBOXX_ENABLED
printf("Registering transaction on Fuseboxx!\n");
[FuseSDK registerInAppPurchase: transaction];
@@ -251,7 +251,7 @@ Error InAppStore::request_product_info(Variant p_params) {
default:
printf("status default %i!\n", (int)transaction.transactionState);
-
+
break;
};
};
@@ -322,7 +322,7 @@ InAppStore::InAppStore() {
void InAppStore::finish_transaction(String product_id){
NSString* prod_id = [NSString stringWithCString:product_id.utf8().get_data() encoding:NSUTF8StringEncoding];
-
+
if ([pending_transactions objectForKey:prod_id]){
[[SKPaymentQueue defaultQueue] finishTransaction:[pending_transactions objectForKey:prod_id]];
[pending_transactions removeObjectForKey:prod_id];
diff --git a/platform/isim/detect.py b/platform/isim/detect.py
index 0adbd9f413..809b0ac368 100644
--- a/platform/isim/detect.py
+++ b/platform/isim/detect.py
@@ -4,10 +4,10 @@ import sys
def is_active():
return False
-
+
def get_name():
return "iSIM"
-
+
def can_build():
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py
index 0a6c8b1457..ae33a43f0d 100644
--- a/platform/javascript/detect.py
+++ b/platform/javascript/detect.py
@@ -4,7 +4,7 @@ import string
def is_active():
return True
-
+
def get_name():
return "JavaScript"
@@ -95,7 +95,7 @@ def configure(env):
env.Append(LINKFLAGS=['-s','ASM_JS=1'])
env.Append(LINKFLAGS=['-O2'])
#env.Append(LINKFLAGS=['-g4'])
-
+
#print "CCCOM is:", env.subst('$CCCOM')
#print "P: ", env['p'], " Platofrm: ", env['platform']
diff --git a/platform/javascript/dom_keys.h b/platform/javascript/dom_keys.h
new file mode 100644
index 0000000000..555c90a529
--- /dev/null
+++ b/platform/javascript/dom_keys.h
@@ -0,0 +1,375 @@
+/*************************************************************************/
+/* dom_keys.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* 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. */
+/*************************************************************************/
+#ifndef DOM_KEYS_H
+#define DOM_KEYS_H
+
+#include "os/keyboard.h"
+
+// https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode#Constants_for_keyCode_value
+#define DOM_VK_CANCEL 0x03
+#define DOM_VK_HELP 0x06
+#define DOM_VK_BACK_SPACE 0x08
+#define DOM_VK_TAB 0x09
+#define DOM_VK_CLEAR 0x0C
+#define DOM_VK_RETURN 0x0D
+#define DOM_VK_ENTER 0x0E // "Reserved, but not used."
+#define DOM_VK_SHIFT 0x10
+#define DOM_VK_CONTROL 0x11
+#define DOM_VK_ALT 0x12
+#define DOM_VK_PAUSE 0x13
+#define DOM_VK_CAPS_LOCK 0x14
+#define DOM_VK_KANA 0x15
+#define DOM_VK_HANGUL 0x15
+#define DOM_VK_EISU 0x16
+#define DOM_VK_JUNJA 0x17
+#define DOM_VK_FINAL 0x18
+#define DOM_VK_HANJA 0x19
+#define DOM_VK_KANJI 0x19
+#define DOM_VK_ESCAPE 0x1B
+#define DOM_VK_CONVERT 0x1C
+#define DOM_VK_NONCONVERT 0x1D
+#define DOM_VK_ACCEPT 0x1E
+#define DOM_VK_MODECHANGE 0x1F
+#define DOM_VK_SPACE 0x20
+#define DOM_VK_PAGE_UP 0x21
+#define DOM_VK_PAGE_DOWN 0x22
+#define DOM_VK_END 0x23
+#define DOM_VK_HOME 0x24
+#define DOM_VK_LEFT 0x25
+#define DOM_VK_UP 0x26
+#define DOM_VK_RIGHT 0x27
+#define DOM_VK_DOWN 0x28
+#define DOM_VK_SELECT 0x29
+#define DOM_VK_PRINT 0x2A
+#define DOM_VK_EXECUTE 0x2B
+#define DOM_VK_PRINTSCREEN 0x2C
+#define DOM_VK_INSERT 0x2D
+#define DOM_VK_DELETE 0x2E
+#define DOM_VK_0 0x30
+#define DOM_VK_1 0x31
+#define DOM_VK_2 0x32
+#define DOM_VK_3 0x33
+#define DOM_VK_4 0x34
+#define DOM_VK_5 0x35
+#define DOM_VK_6 0x36
+#define DOM_VK_7 0x37
+#define DOM_VK_8 0x38
+#define DOM_VK_9 0x39
+#define DOM_VK_COLON 0x3A
+#define DOM_VK_SEMICOLON 0x3B
+#define DOM_VK_LESS_THAN 0x3C
+#define DOM_VK_EQUALS 0x3D
+#define DOM_VK_GREATER_THAN 0x3E
+#define DOM_VK_QUESTION_MARK 0x3F
+#define DOM_VK_AT 0x40
+#define DOM_VK_A 0x41
+#define DOM_VK_B 0x42
+#define DOM_VK_C 0x43
+#define DOM_VK_D 0x44
+#define DOM_VK_E 0x45
+#define DOM_VK_F 0x46
+#define DOM_VK_G 0x47
+#define DOM_VK_H 0x48
+#define DOM_VK_I 0x49
+#define DOM_VK_J 0x4A
+#define DOM_VK_K 0x4B
+#define DOM_VK_L 0x4C
+#define DOM_VK_M 0x4D
+#define DOM_VK_N 0x4E
+#define DOM_VK_O 0x4F
+#define DOM_VK_P 0x50
+#define DOM_VK_Q 0x51
+#define DOM_VK_R 0x52
+#define DOM_VK_S 0x53
+#define DOM_VK_T 0x54
+#define DOM_VK_U 0x55
+#define DOM_VK_V 0x56
+#define DOM_VK_W 0x57
+#define DOM_VK_X 0x58
+#define DOM_VK_Y 0x59
+#define DOM_VK_Z 0x5A
+#define DOM_VK_WIN 0x5B
+#define DOM_VK_CONTEXT_MENU 0x5D
+#define DOM_VK_SLEEP 0x5F
+#define DOM_VK_NUMPAD0 0x60
+#define DOM_VK_NUMPAD1 0x61
+#define DOM_VK_NUMPAD2 0x62
+#define DOM_VK_NUMPAD3 0x63
+#define DOM_VK_NUMPAD4 0x64
+#define DOM_VK_NUMPAD5 0x65
+#define DOM_VK_NUMPAD6 0x66
+#define DOM_VK_NUMPAD7 0x67
+#define DOM_VK_NUMPAD8 0x68
+#define DOM_VK_NUMPAD9 0x69
+#define DOM_VK_MULTIPLY 0x6A
+#define DOM_VK_ADD 0x6B
+#define DOM_VK_SEPARATOR 0x6C
+#define DOM_VK_SUBTRACT 0x6D
+#define DOM_VK_DECIMAL 0x6E
+#define DOM_VK_DIVIDE 0x6F
+#define DOM_VK_F1 0x70
+#define DOM_VK_F2 0x71
+#define DOM_VK_F3 0x72
+#define DOM_VK_F4 0x73
+#define DOM_VK_F5 0x74
+#define DOM_VK_F6 0x75
+#define DOM_VK_F7 0x76
+#define DOM_VK_F8 0x77
+#define DOM_VK_F9 0x78
+#define DOM_VK_F10 0x79
+#define DOM_VK_F11 0x7A
+#define DOM_VK_F12 0x7B
+#define DOM_VK_F13 0x7C
+#define DOM_VK_F14 0x7D
+#define DOM_VK_F15 0x7E
+#define DOM_VK_F16 0x7F
+#define DOM_VK_F17 0x80
+#define DOM_VK_F18 0x81
+#define DOM_VK_F19 0x82
+#define DOM_VK_F20 0x83
+#define DOM_VK_F21 0x84
+#define DOM_VK_F22 0x85
+#define DOM_VK_F23 0x86
+#define DOM_VK_F24 0x87
+#define DOM_VK_NUM_LOCK 0x90
+#define DOM_VK_SCROLL_LOCK 0x91
+#define DOM_VK_WIN_OEM_FJ_JISHO 0x92
+#define DOM_VK_WIN_OEM_FJ_MASSHOU 0x93
+#define DOM_VK_WIN_OEM_FJ_TOUROKU 0x94
+#define DOM_VK_WIN_OEM_FJ_LOYA 0x95
+#define DOM_VK_WIN_OEM_FJ_ROYA 0x96
+#define DOM_VK_CIRCUMFLEX 0xA0
+#define DOM_VK_EXCLAMATION 0xA1
+#define DOM_VK_DOUBLE_QUOTE 0xA2
+#define DOM_VK_HASH 0xA3
+#define DOM_VK_DOLLAR 0xA4
+#define DOM_VK_PERCENT 0xA5
+#define DOM_VK_AMPERSAND 0xA6
+#define DOM_VK_UNDERSCORE 0xA7
+#define DOM_VK_OPEN_PAREN 0xA8
+#define DOM_VK_CLOSE_PAREN 0xA9
+#define DOM_VK_ASTERISK 0xAA
+#define DOM_VK_PLUS 0xAB
+#define DOM_VK_PIPE 0xAC
+#define DOM_VK_HYPHEN_MINUS 0xAD
+#define DOM_VK_OPEN_CURLY_BRACKET 0xAE
+#define DOM_VK_CLOSE_CURLY_BRACKET 0xAF
+#define DOM_VK_TILDE 0xB0
+#define DOM_VK_VOLUME_MUTE 0xB5
+#define DOM_VK_VOLUME_DOWN 0xB6
+#define DOM_VK_VOLUME_UP 0xB7
+#define DOM_VK_COMMA 0xBC
+#define DOM_VK_PERIOD 0xBE
+#define DOM_VK_SLASH 0xBF
+#define DOM_VK_BACK_QUOTE 0xC0
+#define DOM_VK_OPEN_BRACKET 0xDB
+#define DOM_VK_BACK_SLASH 0xDC
+#define DOM_VK_CLOSE_BRACKET 0xDD
+#define DOM_VK_QUOTE 0xDE
+#define DOM_VK_META 0xE0
+#define DOM_VK_ALTGR 0xE1
+#define DOM_VK_WIN_ICO_HELP 0xE3
+#define DOM_VK_WIN_ICO_00 0xE4
+#define DOM_VK_WIN_ICO_CLEAR 0xE6
+#define DOM_VK_WIN_OEM_RESET 0xE9
+#define DOM_VK_WIN_OEM_JUMP 0xEA
+#define DOM_VK_WIN_OEM_PA1 0xEB
+#define DOM_VK_WIN_OEM_PA2 0xEC
+#define DOM_VK_WIN_OEM_PA3 0xED
+#define DOM_VK_WIN_OEM_WSCTRL 0xEE
+#define DOM_VK_WIN_OEM_CUSEL 0xEF
+#define DOM_VK_WIN_OEM_ATTN 0xF0
+#define DOM_VK_WIN_OEM_FINISH 0xF1
+#define DOM_VK_WIN_OEM_COPY 0xF2
+#define DOM_VK_WIN_OEM_AUTO 0xF3
+#define DOM_VK_WIN_OEM_ENLW 0xF4
+#define DOM_VK_WIN_OEM_BACKTAB 0xF5
+#define DOM_VK_ATTN 0xF6
+#define DOM_VK_CRSEL 0xF7
+#define DOM_VK_EXSEL 0xF8
+#define DOM_VK_EREOF 0xF9
+#define DOM_VK_PLAY 0xFA
+#define DOM_VK_ZOOM 0xFB
+#define DOM_VK_PA1 0xFD
+#define DOM_VK_WIN_OEM_CLEAR 0xFE
+
+int dom2godot_scancode(int dom_keycode) {
+
+ if (DOM_VK_0 <= dom_keycode && dom_keycode <= DOM_VK_Z) {
+ // ASCII intersection
+ return dom_keycode;
+ }
+
+ if (DOM_VK_NUMPAD0 <= dom_keycode && dom_keycode <= DOM_VK_NUMPAD9) {
+ // Numpad numbers
+ return KEY_KP_0 + (dom_keycode - DOM_VK_NUMPAD0);
+ }
+
+ if (DOM_VK_F1 <= dom_keycode && dom_keycode <= DOM_VK_F16) {
+ // F1-F16
+ return KEY_F1 + (dom_keycode - DOM_VK_F1);
+ }
+
+ switch(dom_keycode) {
+ //case DOM_VK_CANCEL: return KEY_UNKNOWN;
+ case DOM_VK_HELP: return KEY_HELP;
+ case DOM_VK_BACK_SPACE: return KEY_BACKSPACE;
+ case DOM_VK_TAB: return KEY_TAB;
+
+ case DOM_VK_CLEAR:
+ case DOM_VK_WIN_OEM_CLEAR: // OEM duplicate
+ return KEY_CLEAR;
+
+ case DOM_VK_RETURN:
+ case DOM_VK_ENTER: // unused according to MDN
+ return KEY_RETURN;
+
+ case DOM_VK_SHIFT: return KEY_SHIFT;
+ case DOM_VK_CONTROL: return KEY_CONTROL;
+
+ case DOM_VK_ALT:
+ case DOM_VK_ALTGR:
+ return KEY_ALT;
+
+ case DOM_VK_PAUSE: return KEY_PAUSE;
+ case DOM_VK_CAPS_LOCK: return KEY_CAPSLOCK;
+
+ /*
+ case DOM_VK_KANA: return KEY_UNKNOWN;
+ case DOM_VK_HANGUL: return KEY_UNKNOWN;
+ case DOM_VK_EISU: return KEY_UNKNOWN;
+ case DOM_VK_JUNJA: return KEY_UNKNOWN;
+ case DOM_VK_FINAL: return KEY_UNKNOWN;
+ case DOM_VK_HANJA: return KEY_UNKNOWN;
+ case DOM_VK_KANJI: return KEY_UNKNOWN;
+ */
+
+ case DOM_VK_ESCAPE: return KEY_ESCAPE;
+ /*
+ case DOM_VK_CONVERT: return KEY_UNKNOWN;
+ case DOM_VK_NONCONVERT: return KEY_UNKNOWN;
+ case DOM_VK_ACCEPT: return KEY_UNKNOWN;
+ case DOM_VK_MODECHANGE: return KEY_UNKNOWN;
+ */
+
+ case DOM_VK_SPACE: return KEY_SPACE;
+ case DOM_VK_PAGE_UP: return KEY_PAGEUP;
+ case DOM_VK_PAGE_DOWN: return KEY_PAGEDOWN;
+ case DOM_VK_END: return KEY_END;
+ case DOM_VK_HOME: return KEY_HOME;
+ case DOM_VK_LEFT: return KEY_LEFT;
+ case DOM_VK_UP: return KEY_UP;
+ case DOM_VK_RIGHT: return KEY_RIGHT;
+ case DOM_VK_DOWN: return KEY_DOWN;
+
+ //case DOM_VK_SELECT: return KEY_UNKNOWN;
+
+ case DOM_VK_PRINTSCREEN: // this is the usual printScreen key
+ case DOM_VK_PRINT: // maybe for alt+printScreen or physical printers?
+ return KEY_PRINT;
+
+ //case DOM_VK_EXECUTE: return KEY_UNKNOWN;
+ case DOM_VK_INSERT: return KEY_INSERT;
+ case DOM_VK_DELETE: return KEY_DELETE;
+
+ case DOM_VK_META:
+ case DOM_VK_WIN:
+ return KEY_META;
+
+ case DOM_VK_CONTEXT_MENU: return KEY_MENU;
+ case DOM_VK_SLEEP: return KEY_STANDBY;
+
+ // these are numpad keys according to MDN
+ case DOM_VK_MULTIPLY: return KEY_KP_MULTIPLY;
+ case DOM_VK_ADD: return KEY_KP_ADD;
+ case DOM_VK_SEPARATOR: return KEY_KP_PERIOD; // good enough?
+ case DOM_VK_SUBTRACT: return KEY_KP_SUBTRACT;
+ case DOM_VK_DECIMAL: return KEY_KP_PERIOD;
+ case DOM_VK_DIVIDE: return KEY_KP_DIVIDE;
+
+ /*
+ case DOM_VK_F17: return KEY_UNKNOWN;
+ case DOM_VK_F18: return KEY_UNKNOWN;
+ case DOM_VK_F19: return KEY_UNKNOWN;
+ case DOM_VK_F20: return KEY_UNKNOWN;
+ case DOM_VK_F21: return KEY_UNKNOWN;
+ case DOM_VK_F22: return KEY_UNKNOWN;
+ case DOM_VK_F23: return KEY_UNKNOWN;
+ case DOM_VK_F24: return KEY_UNKNOWN;
+ */
+
+ case DOM_VK_NUM_LOCK: return KEY_NUMLOCK;
+ case DOM_VK_SCROLL_LOCK: return KEY_SCROLLLOCK;
+
+ /*
+ case DOM_VK_WIN_OEM_FJ_JISHO: return KEY_UNKNOWN;
+ case DOM_VK_WIN_OEM_FJ_MASSHOU: return KEY_UNKNOWN;
+ case DOM_VK_WIN_OEM_FJ_TOUROKU: return KEY_UNKNOWN;
+ case DOM_VK_WIN_OEM_FJ_LOYA: return KEY_UNKNOWN;
+ case DOM_VK_WIN_OEM_FJ_ROYA: return KEY_UNKNOWN;
+ */
+
+ case DOM_VK_CIRCUMFLEX: return KEY_ASCIICIRCUM;
+ case DOM_VK_EXCLAMATION: return KEY_EXCLAM;
+ case DOM_VK_DOUBLE_QUOTE: return KEY_QUOTEDBL;
+ case DOM_VK_HASH: return KEY_NUMBERSIGN;
+ case DOM_VK_DOLLAR: return KEY_DOLLAR;
+ case DOM_VK_PERCENT: return KEY_PERCENT;
+ case DOM_VK_AMPERSAND: return KEY_AMPERSAND;
+ case DOM_VK_UNDERSCORE: return KEY_UNDERSCORE;
+ case DOM_VK_OPEN_PAREN: return KEY_PARENLEFT;
+ case DOM_VK_CLOSE_PAREN: return KEY_PARENRIGHT;
+ case DOM_VK_ASTERISK: return KEY_ASTERISK;
+ case DOM_VK_PLUS: return KEY_PLUS;
+ case DOM_VK_PIPE: return KEY_BAR;
+ case DOM_VK_HYPHEN_MINUS: return KEY_MINUS;
+ case DOM_VK_OPEN_CURLY_BRACKET: return KEY_BRACELEFT;
+ case DOM_VK_CLOSE_CURLY_BRACKET: return KEY_BRACERIGHT;
+ case DOM_VK_TILDE: return KEY_ASCIITILDE;
+
+ case DOM_VK_VOLUME_MUTE: return KEY_VOLUMEMUTE;
+ case DOM_VK_VOLUME_DOWN: return KEY_VOLUMEDOWN;
+ case DOM_VK_VOLUME_UP: return KEY_VOLUMEUP;
+
+ case DOM_VK_COMMA: return KEY_COMMA;
+ case DOM_VK_PERIOD: return KEY_PERIOD;
+ case DOM_VK_SLASH: return KEY_SLASH;
+ case DOM_VK_BACK_QUOTE: return KEY_QUOTELEFT;
+ case DOM_VK_OPEN_BRACKET: return KEY_BRACKETLEFT;
+ case DOM_VK_BACK_SLASH: return KEY_BACKSLASH;
+ case DOM_VK_CLOSE_BRACKET: return KEY_BRACKETRIGHT;
+ case DOM_VK_QUOTE: return KEY_APOSTROPHE;
+
+ // rest is OEM/unusual
+
+ default: return KEY_UNKNOWN;
+ };
+}
+
+#endif
diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp
index 632ef2b6b2..d9342cfe10 100644
--- a/platform/javascript/javascript_main.cpp
+++ b/platform/javascript/javascript_main.cpp
@@ -30,7 +30,6 @@
#include "os_javascript.h"
#include "main/main.h"
#include "io/resource_loader.h"
-#include "os/keyboard.h"
#include "emscripten.h"
#include <string.h>
@@ -44,110 +43,6 @@ static void _gfx_init(void *ud,bool gl2,int w, int h,bool fs) {
}
-
-static void _glut_skey(bool pressed,int key) {
-
- InputEvent ev;
- ev.type=InputEvent::KEY;
- ev.key.pressed=pressed;
- switch(key) {
- case GLUT_KEY_F1: ev.key.scancode=KEY_F1; break;
- case GLUT_KEY_F2: ev.key.scancode=KEY_F2; break;
- case GLUT_KEY_F3: ev.key.scancode=KEY_F3; break;
- case GLUT_KEY_F4: ev.key.scancode=KEY_F4; break;
- case GLUT_KEY_F5: ev.key.scancode=KEY_F5; break;
- case GLUT_KEY_F6: ev.key.scancode=KEY_F6; break;
- case GLUT_KEY_F7: ev.key.scancode=KEY_F7; break;
- case GLUT_KEY_F8: ev.key.scancode=KEY_F8; break;
- case GLUT_KEY_F9: ev.key.scancode=KEY_F9; break;
- case GLUT_KEY_F10: ev.key.scancode=KEY_F10; break;
- case GLUT_KEY_F11: ev.key.scancode=KEY_F11; break;
- case GLUT_KEY_F12: ev.key.scancode=KEY_F12; break;
- case GLUT_KEY_LEFT: ev.key.scancode=KEY_LEFT; break;
- case GLUT_KEY_UP: ev.key.scancode=KEY_UP; break;
- case GLUT_KEY_RIGHT: ev.key.scancode=KEY_RIGHT; break;
- case GLUT_KEY_DOWN: ev.key.scancode=KEY_DOWN; break;
- case GLUT_KEY_PAGE_UP: ev.key.scancode=KEY_PAGEUP; break;
- case GLUT_KEY_PAGE_DOWN: ev.key.scancode=KEY_PAGEDOWN; break;
- case GLUT_KEY_HOME: ev.key.scancode=KEY_HOME; break;
- case GLUT_KEY_END: ev.key.scancode=KEY_END; break;
- case GLUT_KEY_INSERT: ev.key.scancode=KEY_INSERT; break;
- }
-
- if (pressed) {
- if (os->skey_pressed[key])
- ev.key.echo = true;
- else
- os->skey_pressed[key] = true;
- }
- else {
- os->skey_pressed[key] = false;
- }
-
- uint32_t m = glutGetModifiers();
- ev.key.mod.alt=(m&GLUT_ACTIVE_ALT)!=0;
- ev.key.mod.shift=(m&GLUT_ACTIVE_SHIFT)!=0;
- ev.key.mod.control=(m&GLUT_ACTIVE_CTRL)!=0;
-
- os->push_input(ev);
-}
-
-static void _glut_skey_up(int key, int x, int y) {
-
- _glut_skey(false,key);
-}
-
-static void _glut_skey_down(int key, int x, int y) {
-
- _glut_skey(true,key);
-}
-
-static void _glut_key(bool pressed,unsigned char key) {
-
- InputEvent ev;
- ev.type=InputEvent::KEY;
- ev.key.pressed=pressed;
- switch(key) {
- case '\n': ev.key.scancode=KEY_RETURN; break;
- case 0x1b: ev.key.scancode=KEY_ESCAPE; break;
- case 8: ev.key.scancode=KEY_BACKSPACE; break;
- case 0x7f: ev.key.scancode=KEY_DELETE; break;
- case 0x20: ev.key.scancode=KEY_SPACE; ev.key.unicode=key; break;
- default: {
- ev.key.unicode=key;
- }
-
- if (pressed) {
- if (os->key_pressed[key])
- ev.key.echo = true;
- else
- os->key_pressed[key] = true;
- }
- else {
- os->key_pressed[key] = false;
- }
- }
-
-
- uint32_t m = glutGetModifiers();
- ev.key.mod.alt=(m&GLUT_ACTIVE_ALT)!=0;
- ev.key.mod.shift=(m&GLUT_ACTIVE_SHIFT)!=0;
- ev.key.mod.control=(m&GLUT_ACTIVE_CTRL)!=0;
-
- os->push_input(ev);
-
-}
-
-static void _glut_key_up(unsigned char key, int x, int y) {
-
- _glut_key(false,key);
-}
-
-static void _glut_key_down(unsigned char key, int x, int y) {
-
- _glut_key(true,key);
-}
-
static uint32_t _mouse_button_mask=0;
static void _glut_mouse_button(int button, int state, int x, int y) {
@@ -265,11 +160,6 @@ int main(int argc, char *argv[]) {
#endif
ResourceLoader::set_abort_on_missing_resources(false); //ease up compatibility
-
- glutSpecialUpFunc(_glut_skey_up);
- glutSpecialFunc(_glut_skey_down);
- glutKeyboardUpFunc(_glut_key_up);
- glutKeyboardFunc(_glut_key_down);
glutMouseFunc(_glut_mouse_button);
glutMotionFunc(_glut_mouse_motion);
glutMotionFunc(_glut_mouse_motion);
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index 413d88ee23..2e42e79996 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -38,6 +38,7 @@
#include "core/globals.h"
#include "emscripten.h"
+#include "dom_keys.h"
int OS_JavaScript::get_video_driver_count() const {
@@ -76,6 +77,65 @@ void OS_JavaScript::set_opengl_extensions(const char* p_gl_extensions) {
gl_extensions=p_gl_extensions;
}
+static InputEvent _setup_key_event(const EmscriptenKeyboardEvent *emscripten_event) {
+
+ InputEvent ev;
+ ev.type = InputEvent::KEY;
+ ev.key.echo = emscripten_event->repeat;
+ ev.key.mod.alt = emscripten_event->altKey;
+ ev.key.mod.shift = emscripten_event->shiftKey;
+ ev.key.mod.control = emscripten_event->ctrlKey;
+ ev.key.mod.meta = emscripten_event->metaKey;
+ ev.key.scancode = dom2godot_scancode(emscripten_event->keyCode);
+
+ String unicode = String::utf8(emscripten_event->key);
+ if (unicode.length()!=1) {
+ unicode = String::utf8(emscripten_event->charValue);
+ }
+ if (unicode.length()==1) {
+ ev.key.unicode=unicode[0];
+ }
+
+ return ev;
+}
+
+static InputEvent deferred_key_event;
+
+static EM_BOOL _keydown_callback(int event_type, const EmscriptenKeyboardEvent *key_event, void *user_data) {
+
+ ERR_FAIL_COND_V(event_type!=EMSCRIPTEN_EVENT_KEYDOWN, false);
+
+ InputEvent ev = _setup_key_event(key_event);
+ ev.key.pressed = true;
+ if (ev.key.unicode==0 && keycode_has_unicode(ev.key.scancode)) {
+ // defer to keypress event for legacy unicode retrieval
+ deferred_key_event = ev;
+ return false; // do not suppress keypress event
+ }
+ static_cast<OS_JavaScript*>(user_data)->push_input(ev);
+ return true;
+}
+
+static EM_BOOL _keypress_callback(int event_type, const EmscriptenKeyboardEvent *key_event, void *user_data) {
+
+ ERR_FAIL_COND_V(event_type!=EMSCRIPTEN_EVENT_KEYPRESS, false);
+
+ deferred_key_event.key.unicode = key_event->charCode;
+ static_cast<OS_JavaScript*>(user_data)->push_input(deferred_key_event);
+ return true;
+}
+
+static EM_BOOL _keyup_callback(int event_type, const EmscriptenKeyboardEvent *key_event, void *user_data) {
+
+ ERR_FAIL_COND_V(event_type!=EMSCRIPTEN_EVENT_KEYUP, false);
+
+ InputEvent ev = _setup_key_event(key_event);
+ ev.key.pressed = false;
+ static_cast<OS_JavaScript*>(user_data)->push_input(ev);
+ return ev.key.scancode!=KEY_UNKNOWN && ev.key.scancode!=0;
+
+}
+
static EM_BOOL joy_callback_func(int p_type, const EmscriptenGamepadEvent *p_event, void *p_user) {
OS_JavaScript *os = (OS_JavaScript*) OS::get_singleton();
if (os) {
@@ -150,8 +210,26 @@ void OS_JavaScript::initialize(const VideoMode& p_desired,int p_video_driver,int
input = memnew( InputDefault );
- emscripten_set_gamepadconnected_callback(NULL, true, &joy_callback_func);
- emscripten_set_gamepaddisconnected_callback(NULL, true, &joy_callback_func);
+ EMSCRIPTEN_RESULT result = emscripten_set_keydown_callback(NULL, this , true, &_keydown_callback);
+ if (result!=EMSCRIPTEN_RESULT_SUCCESS) {
+ ERR_PRINTS( "Error while setting Emscripten keydown callback: Code " + itos(result) );
+ }
+ result = emscripten_set_keypress_callback(NULL, this, true, &_keypress_callback);
+ if (result!=EMSCRIPTEN_RESULT_SUCCESS) {
+ ERR_PRINTS( "Error while setting Emscripten keypress callback: Code " + itos(result) );
+ }
+ result = emscripten_set_keyup_callback(NULL, this, true, &_keyup_callback);
+ if (result!=EMSCRIPTEN_RESULT_SUCCESS) {
+ ERR_PRINTS( "Error while setting Emscripten keyup callback: Code " + itos(result) );
+ }
+ result = emscripten_set_gamepadconnected_callback(NULL, true, &joy_callback_func);
+ if (result!=EMSCRIPTEN_RESULT_SUCCESS) {
+ ERR_PRINTS( "Error while setting Emscripten gamepadconnected callback: Code " + itos(result) );
+ }
+ result = emscripten_set_gamepaddisconnected_callback(NULL, true, &joy_callback_func);
+ if (result!=EMSCRIPTEN_RESULT_SUCCESS) {
+ ERR_PRINTS( "Error while setting Emscripten gamepaddisconnected callback: Code " + itos(result) );
+ }
}
void OS_JavaScript::set_main_loop( MainLoop * p_main_loop ) {
@@ -692,12 +770,6 @@ OS_JavaScript::OS_JavaScript(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, Ope
FileAccessUnix::close_notification_func=_close_notification_funcs;
time_to_save_sync=-1;
-
- for (int i = 0; i < 256; i++) {
- key_pressed[i] = false;
- if (i < 121)
- skey_pressed[i] = false;
- }
}
OS_JavaScript::~OS_JavaScript() {
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index 4a8265b9d9..16e4781d15 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -56,9 +56,6 @@ public:
Point2 pos;
};
- bool skey_pressed[121];
- bool key_pressed[256];
-
private:
Vector<TouchPos> touch;
diff --git a/platform/nacl/detect.py b/platform/nacl/detect.py
index f8849cfd25..eedb29746a 100644
--- a/platform/nacl/detect.py
+++ b/platform/nacl/detect.py
@@ -3,7 +3,7 @@ import sys
def is_active():
return True
-
+
def get_name():
return "NaCl"
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index f7cf5111f5..1f176dc22a 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -5,7 +5,7 @@ import sys
def is_active():
return True
-
+
def get_name():
return "OSX"
diff --git a/platform/osx/dir_access_osx.mm b/platform/osx/dir_access_osx.mm
index 29f8fda663..20dc1df8f4 100644
--- a/platform/osx/dir_access_osx.mm
+++ b/platform/osx/dir_access_osx.mm
@@ -47,9 +47,9 @@ DirAccess *DirAccessOSX::create_fs() {
}
bool DirAccessOSX::list_dir_begin() {
-
+
list_dir_end(); //close any previous dir opening!
-
+
// char real_current_dir_name[2048]; //is this enough?!
//getcwd(real_current_dir_name,2048);
@@ -63,7 +63,7 @@ bool DirAccessOSX::list_dir_begin() {
}
bool DirAccessOSX::file_exists(String p_file) {
-
+
GLOBAL_LOCK_FUNCTION
@@ -207,7 +207,7 @@ Error DirAccessOSX::make_dir(String p_dir) {
GLOBAL_LOCK_FUNCTION
p_dir=fix_path(p_dir);
-
+
char real_current_dir_name[2048];
getcwd(real_current_dir_name,2048);
chdir(current_dir.utf8().get_data()); //ascii since this may be unicode or wathever the host os wants
@@ -326,7 +326,7 @@ size_t DirAccessOSX::get_space_left() {
#else
#warning THIS IS BROKEN
return 0;
-#endif
+#endif
};
diff --git a/platform/osx/godot_osx.mm b/platform/osx/godot_osx.mm
index 0c32016216..02a1382b1a 100644
--- a/platform/osx/godot_osx.mm
+++ b/platform/osx/godot_osx.mm
@@ -50,7 +50,7 @@ static NSString *getApplicationName(void)
dict = (const NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle());
if (dict)
appName = [dict objectForKey: @"CFBundleName"];
-
+
if (![appName length])
appName = [[NSProcessInfo processInfo] processName];
@@ -67,10 +67,10 @@ static void setApplicationMenu(void)
NSMenuItem *menuItem;
NSString *title;
NSString *appName;
-
+
appName = getApplicationName();
appleMenu = [[NSMenu alloc] initWithTitle:@""];
-
+
/* Add menu items */
title = [@"About " stringByAppendingString:appName];
[appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
@@ -90,7 +90,7 @@ static void setApplicationMenu(void)
title = [@"Quit " stringByAppendingString:appName];
[appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
-
+
/* Put menu into the menubar */
menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
[menuItem setSubmenu:appleMenu];
@@ -112,17 +112,17 @@ static void setupWindowMenu(void)
NSMenuItem *menuItem;
windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
-
+
/* "Minimize" item */
menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
[windowMenu addItem:menuItem];
[menuItem release];
-
+
/* Put menu into the menubar */
windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
[windowMenuItem setSubmenu:windowMenu];
[[NSApp mainMenu] addItem:windowMenuItem];
-
+
/* Tell the application object that this is now the window menu */
[NSApp setWindowsMenu:windowMenu];
@@ -139,7 +139,7 @@ static void CustomApplicationMain (int argc, char **argv)
/* Ensure the application object is initialised */
[NSApplication sharedApplication];
-
+
/* Set up the menubar */
[NSApp setMainMenu:[[NSMenu alloc] init]];
setApplicationMenu();
@@ -147,10 +147,10 @@ static void CustomApplicationMain (int argc, char **argv)
main = [[main alloc] init];
[NSApp setDelegate:main];
-
+
/* Start the main event loop */
[NSApp run];
-
+
[main release];
[pool release];
}
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 4b339af6d4..6af2f347aa 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -892,7 +892,7 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
NULL, keyboardLayoutChanged,
kTISNotifySelectedKeyboardInputSourceChanged, NULL,
CFNotificationSuspensionBehaviorDeliverImmediately);
-
+
window_delegate = [[GodotWindowDelegate alloc] init];
// Don't use accumulation buffer support; it's not accelerated
@@ -1170,7 +1170,7 @@ void OS_OSX::warp_mouse_pos(const Point2& p_to) {
mouse_y = p_to.y;
}
else{ //set OS position
-
+
/* this code has not been tested, please be a kind soul and fix it if it fails! */
//local point in window coords
diff --git a/platform/server/detect.py b/platform/server/detect.py
index 15c5982b14..e6fab2043b 100644
--- a/platform/server/detect.py
+++ b/platform/server/detect.py
@@ -1,11 +1,11 @@
import os
-import sys
+import sys
def is_active():
return True
-
+
def get_name():
return "Server"
@@ -16,20 +16,20 @@ def can_build():
return False
return True # enabled
-
+
def get_opts():
return [
('use_llvm','Use llvm compiler','no'),
('force_32_bits','Force 32 bits binary','no')
]
-
+
def get_flags():
return [
('builtin_zlib', 'no'),
]
-
+
def configure(env):
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 1ad0f164d2..689cad8343 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -1,4 +1,4 @@
-#
+#
# tested on | Windows native | Linux cross-compilation
# ------------------------+-------------------+---------------------------
# MSVS C++ 2010 Express | WORKS | n/a
@@ -24,11 +24,11 @@
# ( example : "C:/Mingw-w32", "C:/Mingw-w64" )
#
# - if you want to compile faster using the "-j" option, don't forget
-# to install the appropriate version of the Pywin32 python extension
+# to install the appropriate version of the Pywin32 python extension
# available from : http://sourceforge.net/projects/pywin32/files/
#
-# - before running scons, you must add into the environment path
-# the path to the "/bin" directory of the Mingw version you want
+# - before running scons, you must add into the environment path
+# the path to the "/bin" directory of the Mingw version you want
# to use :
#
# set PATH=C:/Mingw-w32/bin;%PATH%
@@ -37,9 +37,9 @@
# - Mingw-w32 only compiles 32bits.
# - Mingw-w64 only compiles 64bits.
#
-# - it is possible to add them both at the same time into the PATH env,
-# if you also define the MINGW32_PREFIX and MINGW64_PREFIX environment
-# variables.
+# - it is possible to add them both at the same time into the PATH env,
+# if you also define the MINGW32_PREFIX and MINGW64_PREFIX environment
+# variables.
# For instance, you could store that set of commands into a .bat script
# that you would run just before scons :
#
@@ -61,14 +61,14 @@
#
# - it is possible to manually override prefixes by defining
# the MINGW32_PREFIX and MINGW64_PREFIX environment variables.
-#
+#
#####
# Notes about Mingw under Windows :
#
-# - this is the MinGW version from http://mingw.org/
+# - this is the MinGW version from http://mingw.org/
# - install it into a path that does not contain spaces
# ( example : "C:/MinGW" )
-# - several DirectX headers might be missing. You can copy them into
+# - several DirectX headers might be missing. You can copy them into
# the C:/MinGW/include" directory from this page :
# https://code.google.com/p/mingw-lib/source/browse/trunk/working/avcodec_to_widget_5/directx_include/
# - before running scons, add the path to the "/bin" directory :
@@ -84,7 +84,7 @@
# - confirm it works well with other Visual Studio versions.
# - update the wiki about the pywin32 extension required for the "-j" option under Windows.
# - update the wiki to document MINGW32_PREFIX and MINGW64_PREFIX
-#
+#
import os
@@ -93,16 +93,16 @@ import sys
def is_active():
return True
-
+
def get_name():
return "Windows"
def can_build():
-
+
if (os.name=="nt"):
#building natively on windows!
if (os.getenv("VSINSTALLDIR")):
- return True
+ return True
else:
print("\nMSVC not detected, attempting Mingw.")
mingw32 = ""
@@ -111,7 +111,7 @@ def can_build():
mingw32 = os.getenv("MINGW32_PREFIX")
if ( os.getenv("MINGW64_PREFIX") ) :
mingw64 = os.getenv("MINGW64_PREFIX")
-
+
test = "gcc --version > NUL 2>&1"
if os.system(test)!= 0 and os.system(mingw32+test)!=0 and os.system(mingw64+test)!=0 :
print("- could not detect gcc.")
@@ -119,27 +119,27 @@ def can_build():
return False
else:
print("- gcc detected.")
-
+
return True
-
+
if (os.name=="posix"):
mingw = "i586-mingw32msvc-"
mingw64 = "x86_64-w64-mingw32-"
mingw32 = "i686-w64-mingw32-"
-
+
if (os.getenv("MINGW32_PREFIX")):
mingw32=os.getenv("MINGW32_PREFIX")
mingw = mingw32
if (os.getenv("MINGW64_PREFIX")):
mingw64=os.getenv("MINGW64_PREFIX")
-
+
test = "gcc --version &>/dev/null"
if (os.system(mingw+test) == 0 or os.system(mingw64+test) == 0 or os.system(mingw32+test) == 0):
return True
-
+
return False
-
+
def get_opts():
mingw=""
@@ -149,10 +149,10 @@ def get_opts():
mingw = "i586-mingw32msvc-"
mingw32 = "i686-w64-mingw32-"
mingw64 = "x86_64-w64-mingw32-"
-
+
if os.system(mingw32+"gcc --version &>/dev/null") != 0 :
mingw32 = mingw
-
+
if (os.getenv("MINGW32_PREFIX")):
mingw32=os.getenv("MINGW32_PREFIX")
mingw = mingw32
@@ -164,14 +164,14 @@ def get_opts():
('mingw_prefix','Mingw Prefix',mingw32),
('mingw_prefix_64','Mingw Prefix 64 bits',mingw64),
]
-
+
def get_flags():
return [
('freetype','builtin'), #use builtin freetype
('openssl','builtin'), #use builtin openssl
]
-
+
def build_res_file( target, source, env ):
cmdbase = ""
@@ -245,7 +245,7 @@ def configure(env):
env.Append(CCFLAGS=['/DGLEW_ENABLED'])
LIBS=['winmm','opengl32','dsound','kernel32','ole32','oleaut32','user32','gdi32', 'IPHLPAPI','Shlwapi', 'wsock32', 'shell32','advapi32','dinput8','dxguid']
env.Append(LINKFLAGS=[p+env["LIBSUFFIX"] for p in LIBS])
-
+
env.Append(LIBPATH=[os.getenv("WindowsSdkDir")+"/Lib"])
if (os.getenv("DXSDK_DIR")):
DIRECTX_PATH=os.getenv("DXSDK_DIR")
@@ -304,7 +304,7 @@ def configure(env):
# sys.exit(255)
if (env["target"]=="release"):
-
+
env.Append(CCFLAGS=['-msse2'])
if (env["bits"]=="64"):
@@ -319,7 +319,7 @@ def configure(env):
env.Append(CCFLAGS=['-O2','-DDEBUG_ENABLED'])
elif (env["target"]=="debug"):
-
+
env.Append(CCFLAGS=['-g', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
if (env["freetype"]!="no"):
@@ -366,4 +366,4 @@ def configure(env):
env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )
env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
-
+
diff --git a/platform/winrt/detect.py b/platform/winrt/detect.py
index 7439f0cd55..86028d3af8 100644
--- a/platform/winrt/detect.py
+++ b/platform/winrt/detect.py
@@ -2,13 +2,13 @@
import os
-import sys
+import sys
import string
def is_active():
return True
-
+
def get_name():
return "WinRT"
@@ -16,12 +16,12 @@ def can_build():
if (os.name=="nt"):
#building natively on windows!
if (os.getenv("VSINSTALLDIR")):
- return True
+ return True
return False
-
+
def get_opts():
return []
-
+
def get_flags():
return []
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index 6b147db130..6b3f7147ef 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -1,12 +1,12 @@
import os
-import sys
+import sys
import platform
def is_active():
return True
-
+
def get_name():
return "X11"
@@ -20,11 +20,11 @@ def can_build():
return False # no x11 on mac for now
errorval=os.system("pkg-config --version > /dev/null")
-
+
if (errorval):
print("pkg-config not found.. x11 disabled.")
return False
-
+
x11_error=os.system("pkg-config x11 --modversion > /dev/null ")
if (x11_error):
print("X11 not found.. x11 disabled.")
@@ -39,7 +39,7 @@ def can_build():
if (x11_error):
print("xcursor not found.. x11 disabled.")
return False
-
+
x11_error=os.system("pkg-config xinerama --modversion > /dev/null ")
if (x11_error):
print("xinerama not found.. x11 disabled.")
@@ -47,7 +47,7 @@ def can_build():
return True # X11 enabled
-
+
def get_opts():
return [
@@ -60,7 +60,7 @@ def get_opts():
('new_wm_api', 'Use experimental window management API','no'),
('debug_release', 'Add debug symbols to release version','no'),
]
-
+
def get_flags():
return [
@@ -68,7 +68,7 @@ def get_flags():
("openssl", "yes"),
#("theora","no"),
]
-
+
def configure(env):
diff --git a/platform/x11/joystick_linux.cpp b/platform/x11/joystick_linux.cpp
index 0615f33f96..2793cc5734 100644
--- a/platform/x11/joystick_linux.cpp
+++ b/platform/x11/joystick_linux.cpp
@@ -89,6 +89,8 @@ joystick_linux::joystick_linux(InputDefault *in)
joystick_linux::~joystick_linux() {
exit_udev = true;
Thread::wait_to_finish(joy_thread);
+ memdelete(joy_thread);
+ memdelete(joy_mutex);
close_joystick();
}
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index f60610693f..4d7532d637 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -541,6 +541,8 @@ void OS_X11::set_mouse_mode(MouseMode p_mode) {
} else {
do_mouse_warp=false;
}
+
+ XFlush(x11_display);
}
void OS_X11::warp_mouse_pos(const Point2& p_to) {