summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/android/export/export.cpp62
-rw-r--r--platform/android/globals/global_defaults.cpp5
-rw-r--r--platform/android/godot_android.cpp30
-rw-r--r--platform/android/java_glue.cpp62
-rw-r--r--platform/android/os_android.cpp4
-rw-r--r--platform/android/os_android.h4
-rw-r--r--platform/bb10/export/export.cpp52
-rw-r--r--platform/haiku/platform_config.h2
-rw-r--r--platform/iphone/app_delegate.mm10
-rwxr-xr-xplatform/iphone/gl_view.mm2
-rwxr-xr-xplatform/iphone/globals/global_defaults.cpp5
-rw-r--r--platform/iphone/os_iphone.cpp6
-rw-r--r--platform/iphone/rasterizer_iphone.cpp26
-rw-r--r--platform/javascript/audio_server_javascript.cpp8
-rw-r--r--platform/javascript/audio_server_javascript.h4
-rw-r--r--platform/javascript/export/export.cpp6
-rw-r--r--platform/javascript/os_javascript.cpp8
-rw-r--r--platform/javascript/os_javascript.h2
-rw-r--r--platform/osx/SCsub2
-rw-r--r--platform/osx/export/export.cpp6
-rw-r--r--platform/osx/joypad_osx.cpp (renamed from platform/osx/joystick_osx.cpp)93
-rw-r--r--platform/osx/joypad_osx.h (renamed from platform/osx/joystick_osx.h)36
-rw-r--r--platform/osx/os_osx.h9
-rw-r--r--platform/osx/os_osx.mm45
-rw-r--r--platform/osx/platform_config.h3
-rw-r--r--platform/uwp/SCsub2
-rw-r--r--platform/uwp/export/export.cpp2
-rw-r--r--platform/uwp/joypad_uwp.cpp (renamed from platform/uwp/joystick_uwp.cpp)24
-rw-r--r--platform/uwp/joypad_uwp.h (renamed from platform/uwp/joystick_uwp.h)12
-rw-r--r--platform/uwp/os_uwp.cpp8
-rw-r--r--platform/uwp/os_uwp.h6
-rw-r--r--platform/windows/SCsub2
-rw-r--r--platform/windows/context_gl_win.cpp1
-rw-r--r--platform/windows/detect.py6
-rw-r--r--platform/windows/joypad.cpp (renamed from platform/windows/joystick.cpp)157
-rw-r--r--platform/windows/joypad.h (renamed from platform/windows/joystick.h)39
-rw-r--r--platform/windows/key_mapping_win.cpp2
-rw-r--r--platform/windows/os_windows.cpp48
-rw-r--r--platform/windows/os_windows.h6
-rw-r--r--platform/windows/platform_config.h3
-rw-r--r--platform/x11/SCsub2
-rw-r--r--platform/x11/detect.py18
-rw-r--r--platform/x11/joypad_linux.cpp (renamed from platform/x11/joystick_linux.cpp)107
-rw-r--r--platform/x11/joypad_linux.h (renamed from platform/x11/joystick_linux.h)45
-rw-r--r--platform/x11/os_x11.cpp8
-rw-r--r--platform/x11/os_x11.h4
-rw-r--r--platform/x11/platform_config.h4
47 files changed, 496 insertions, 502 deletions
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 0bbb45b8f5..e836258e04 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -553,8 +553,8 @@ void EditorExportPlatformAndroid::_fix_resources(Vector<uint8_t>& p_manifest) {
String lang = str.substr(str.find_last("-")+1,str.length()).replace("-","_");
String prop = "application/name_"+lang;
- if (Globals::get_singleton()->has(prop)) {
- str = Globals::get_singleton()->get(prop);
+ if (GlobalConfig::get_singleton()->has(prop)) {
+ str = GlobalConfig::get_singleton()->get(prop);
} else {
str = get_project_name();
}
@@ -626,7 +626,7 @@ String EditorExportPlatformAndroid::get_project_name() const {
if (this->name!="") {
aname=this->name;
} else {
- aname = Globals::get_singleton()->get("application/name");
+ aname = GlobalConfig::get_singleton()->get("application/name");
}
@@ -1148,7 +1148,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
if (!found) {
- String appicon = Globals::get_singleton()->get("application/icon");
+ String appicon = GlobalConfig::get_singleton()->get("application/icon");
if (appicon!="" && appicon.ends_with(".png")) {
FileAccess*f = FileAccess::open(appicon,FileAccess::READ);
if (f) {
@@ -1212,9 +1212,9 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
if (p_flags&EXPORT_DUMB_CLIENT) {
- /*String host = EditorSettings::get_singleton()->get("file_server/host");
- int port = EditorSettings::get_singleton()->get("file_server/post");
- String passwd = EditorSettings::get_singleton()->get("file_server/password");
+ /*String host = EditorSettings::get_singleton()->get("filesystem/file_server/host");
+ int port = EditorSettings::get_singleton()->get("filesystem/file_server/post");
+ String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password");
cl.push_back("-rfs");
cl.push_back(host+":"+itos(port));
if (passwd!="") {
@@ -1305,7 +1305,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
if (_signed) {
- String jarsigner=EditorSettings::get_singleton()->get("android/jarsigner");
+ String jarsigner=EditorSettings::get_singleton()->get("export/android/jarsigner");
if (!FileAccess::exists(jarsigner)) {
EditorNode::add_io_error("'jarsigner' could not be found.\nPlease supply a path in the editor settings.\nResulting apk is unsigned.");
return OK;
@@ -1315,9 +1315,9 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
String password;
String user;
if (p_debug) {
- keystore=EditorSettings::get_singleton()->get("android/debug_keystore");
- password=EditorSettings::get_singleton()->get("android/debug_keystore_pass");
- user=EditorSettings::get_singleton()->get("android/debug_keystore_user");
+ keystore=EditorSettings::get_singleton()->get("export/android/debug_keystore");
+ password=EditorSettings::get_singleton()->get("export/android/debug_keystore_pass");
+ user=EditorSettings::get_singleton()->get("export/android/debug_keystore_user");
ep.step("Signing Debug APK..",103);
@@ -1340,7 +1340,7 @@ Error EditorExportPlatformAndroid::export_project(const String& p_path, bool p_d
args.push_back("SHA1");
args.push_back("-sigalg");
args.push_back("MD5withRSA");
- String tsa_url=EditorSettings::get_singleton()->get("android/timestamping_authority_url");
+ String tsa_url=EditorSettings::get_singleton()->get("export/android/timestamping_authority_url");
if (tsa_url != "") {
args.push_back("-tsa");
args.push_back(tsa_url);
@@ -1506,7 +1506,7 @@ void EditorExportPlatformAndroid::_device_poll_thread(void *ud) {
while(!ea->quit_request) {
- String adb=EditorSettings::get_singleton()->get("android/adb");
+ String adb=EditorSettings::get_singleton()->get("export/android/adb");
if (FileAccess::exists(adb)) {
String devices;
@@ -1628,8 +1628,8 @@ void EditorExportPlatformAndroid::_device_poll_thread(void *ud) {
}
- if (EditorSettings::get_singleton()->get("android/shutdown_adb_on_exit")) {
- String adb=EditorSettings::get_singleton()->get("android/adb");
+ if (EditorSettings::get_singleton()->get("export/android/shutdown_adb_on_exit")) {
+ String adb=EditorSettings::get_singleton()->get("export/android/adb");
if (!FileAccess::exists(adb)) {
return; //adb not configured
}
@@ -1647,7 +1647,7 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) {
EditorProgress ep("run","Running on "+devices[p_device].name,3);
- String adb=EditorSettings::get_singleton()->get("android/adb");
+ String adb=EditorSettings::get_singleton()->get("export/android/adb");
if (adb=="") {
EditorNode::add_io_error("ADB executable not configured in settings, can't run.");
@@ -1659,7 +1659,7 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) {
ep.step("Exporting APK",0);
- bool use_adb_over_usb = bool(EDITOR_DEF("android/use_remote_debug_over_adb",true));
+ bool use_adb_over_usb = bool(EDITOR_DEF("export/android/use_remote_debug_over_adb",true));
if (use_adb_over_usb) {
p_flags|=EXPORT_REMOTE_DEBUG_LOCALHOST;
@@ -1719,7 +1719,7 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) {
args.push_back("--remove-all");
err = OS::get_singleton()->execute(adb,args,true,NULL,NULL,&rv);
- int port = Globals::get_singleton()->get("debug/debug_port");
+ int port = GlobalConfig::get_singleton()->get("network/debug/remote_port");
args.clear();
args.push_back("reverse");
args.push_back("tcp:"+itos(port));
@@ -1728,7 +1728,7 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) {
err = OS::get_singleton()->execute(adb,args,true,NULL,NULL,&rv);
print_line("Reverse result: "+itos(rv));
- int fs_port = EditorSettings::get_singleton()->get("file_server/port");
+ int fs_port = EditorSettings::get_singleton()->get("filesystem/file_server/port");
args.clear();
args.push_back("reverse");
@@ -1766,7 +1766,7 @@ Error EditorExportPlatformAndroid::run(int p_device, int p_flags) {
String EditorExportPlatformAndroid::get_package_name() {
String pname = package;
- String basename = Globals::get_singleton()->get("application/name");
+ String basename = GlobalConfig::get_singleton()->get("application/name");
basename=basename.to_lower();
String name;
@@ -1822,7 +1822,7 @@ EditorExportPlatformAndroid::EditorExportPlatformAndroid() {
bool EditorExportPlatformAndroid::can_export(String *r_error) const {
bool valid=true;
- String adb=EditorSettings::get_singleton()->get("android/adb");
+ String adb=EditorSettings::get_singleton()->get("export/android/adb");
String err;
if (!FileAccess::exists(adb)) {
@@ -1831,7 +1831,7 @@ bool EditorExportPlatformAndroid::can_export(String *r_error) const {
err+="ADB executable not configured in editor settings.\n";
}
- String js = EditorSettings::get_singleton()->get("android/jarsigner");
+ String js = EditorSettings::get_singleton()->get("export/android/jarsigner");
if (!FileAccess::exists(js)) {
@@ -1839,7 +1839,7 @@ bool EditorExportPlatformAndroid::can_export(String *r_error) const {
err+="OpenJDK 6 jarsigner not configured in editor settings.\n";
}
- String dk = EditorSettings::get_singleton()->get("android/debug_keystore");
+ String dk = EditorSettings::get_singleton()->get("export/android/debug_keystore");
if (!FileAccess::exists(dk)) {
@@ -1893,20 +1893,20 @@ EditorExportPlatformAndroid::~EditorExportPlatformAndroid() {
void register_android_exporter() {
String exe_ext=OS::get_singleton()->get_name()=="Windows"?"exe":"";
- EDITOR_DEF("android/adb","");
+ EDITOR_DEF("export/android/adb","");
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"android/adb",PROPERTY_HINT_GLOBAL_FILE,exe_ext));
- EDITOR_DEF("android/jarsigner","");
+ EDITOR_DEF("export/android/jarsigner","");
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"android/jarsigner",PROPERTY_HINT_GLOBAL_FILE,exe_ext));
- EDITOR_DEF("android/debug_keystore","");
+ EDITOR_DEF("export/android/debug_keystore","");
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"android/debug_keystore",PROPERTY_HINT_GLOBAL_FILE,"keystore"));
- EDITOR_DEF("android/debug_keystore_user","androiddebugkey");
- EDITOR_DEF("android/debug_keystore_pass","android");
+ EDITOR_DEF("export/android/debug_keystore_user","androiddebugkey");
+ EDITOR_DEF("export/android/debug_keystore_pass","android");
//EDITOR_DEF("android/release_keystore","");
//EDITOR_DEF("android/release_username","");
//EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"android/release_keystore",PROPERTY_HINT_GLOBAL_FILE,"*.keystore"));
- EDITOR_DEF("android/timestamping_authority_url","");
- EDITOR_DEF("android/use_remote_debug_over_adb",false);
- EDITOR_DEF("android/shutdown_adb_on_exit",true);
+ EDITOR_DEF("export/android/timestamping_authority_url","");
+ EDITOR_DEF("export/android/use_remote_debug_over_adb",false);
+ EDITOR_DEF("export/android/shutdown_adb_on_exit",true);
Ref<EditorExportPlatformAndroid> exporter = Ref<EditorExportPlatformAndroid>( memnew(EditorExportPlatformAndroid) );
EditorImportExport::get_singleton()->add_export_platform(exporter);
diff --git a/platform/android/globals/global_defaults.cpp b/platform/android/globals/global_defaults.cpp
index 3ec1094ee1..52b59b2dc1 100644
--- a/platform/android/globals/global_defaults.cpp
+++ b/platform/android/globals/global_defaults.cpp
@@ -32,10 +32,11 @@
void register_android_global_defaults() {
- GLOBAL_DEF("rasterizer.Android/use_fragment_lighting",false);
+/* GLOBAL_DEF("rasterizer.Android/use_fragment_lighting",false);
GLOBAL_DEF("rasterizer.Android/fp16_framebuffer",false);
GLOBAL_DEF("display.Android/driver","GLES2");
// GLOBAL_DEF("rasterizer.Android/trilinear_mipmap_filter",false);
- Globals::get_singleton()->set_custom_property_info("display.Android/driver",PropertyInfo(Variant::STRING,"display.Android/driver",PROPERTY_HINT_ENUM,"GLES2"));
+ GlobalConfig::get_singleton()->set_custom_property_info("display.Android/driver",PropertyInfo(Variant::STRING,"display.Android/driver",PROPERTY_HINT_ENUM,"GLES2"));
+ */
}
diff --git a/platform/android/godot_android.cpp b/platform/android/godot_android.cpp
index 4ef6619146..c4d1a85c5f 100644
--- a/platform/android/godot_android.cpp
+++ b/platform/android/godot_android.cpp
@@ -153,7 +153,7 @@ public:
} break;
case Variant::STRING_ARRAY: {
- DVector<String> sarray = *p_args[i];
+ PoolVector<String> sarray = *p_args[i];
jobjectArray arr = env->NewObjectArray(sarray.size(),env->FindClass("java/lang/String"),env->NewStringUTF(""));
for(int j=0;j<sarray.size();j++) {
@@ -165,18 +165,18 @@ public:
} break;
case Variant::INT_ARRAY: {
- DVector<int> array = *p_args[i];
+ PoolVector<int> array = *p_args[i];
jintArray arr = env->NewIntArray(array.size());
- DVector<int>::Read r = array.read();
+ PoolVector<int>::Read r = array.read();
env->SetIntArrayRegion(arr,0,array.size(),r.ptr());
v[i].l=arr;
} break;
case Variant::REAL_ARRAY: {
- DVector<float> array = *p_args[i];
+ PoolVector<float> array = *p_args[i];
jfloatArray arr = env->NewFloatArray(array.size());
- DVector<float>::Read r = array.read();
+ PoolVector<float>::Read r = array.read();
env->SetFloatArrayRegion(arr,0,array.size(),r.ptr());
v[i].l=arr;
@@ -225,7 +225,7 @@ public:
jobjectArray arr = (jobjectArray)env->CallObjectMethodA(instance,E->get().method,v);
int stringCount = env->GetArrayLength(arr);
- DVector<String> sarr;
+ PoolVector<String> sarr;
for (int i=0; i<stringCount; i++) {
jstring string = (jstring) env->GetObjectArrayElement(arr, i);
@@ -241,12 +241,12 @@ public:
jintArray arr = (jintArray)env->CallObjectMethodA(instance,E->get().method,v);
int fCount = env->GetArrayLength(arr);
- DVector<int> sarr;
+ PoolVector<int> sarr;
sarr.resize(fCount);
- DVector<int>::Write w = sarr.write();
+ PoolVector<int>::Write w = sarr.write();
env->GetIntArrayRegion(arr,0,fCount,w.ptr());
- w = DVector<int>::Write();
+ w = PoolVector<int>::Write();
ret=sarr;
} break;
case Variant::REAL_ARRAY: {
@@ -254,12 +254,12 @@ public:
jfloatArray arr = (jfloatArray)env->CallObjectMethodA(instance,E->get().method,v);
int fCount = env->GetArrayLength(arr);
- DVector<float> sarr;
+ PoolVector<float> sarr;
sarr.resize(fCount);
- DVector<float>::Write w = sarr.write();
+ PoolVector<float>::Write w = sarr.write();
env->GetFloatArrayRegion(arr,0,fCount,w.ptr());
- w = DVector<float>::Write();
+ w = PoolVector<float>::Write();
ret=sarr;
} break;
default: {
@@ -654,7 +654,7 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd) {
#else
Error err = Main::setup("apk",0,NULL);
- String modules = Globals::get_singleton()->get("android/modules");
+ String modules = GlobalConfig::get_singleton()->get("android/modules");
Vector<String> mods = modules.split(",",false);
mods.push_back("GodotOS");
__android_log_print(ANDROID_LOG_INFO,"godot","mod count: %i",mods.size());
@@ -912,7 +912,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_Godot_registerSingleton(JNIEnv
s->set_instance(env->NewGlobalRef(p_object));
jni_singletons[singname]=s;
- Globals::get_singleton()->add_singleton(Globals::Singleton(singname,s));
+ GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton(singname,s));
}
@@ -983,7 +983,7 @@ JNIEXPORT jstring JNICALL Java_org_godotengine_godot_Godot_getGlobal(JNIEnv * en
String js = env->GetStringUTFChars( path, NULL );
- return env->NewStringUTF(Globals::get_singleton()->get(js).operator String().utf8().get_data());
+ return env->NewStringUTF(GlobalConfig::get_singleton()->get(js).operator String().utf8().get_data());
}
diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp
index c8dc3ce3c3..3e8ce35910 100644
--- a/platform/android/java_glue.cpp
+++ b/platform/android/java_glue.cpp
@@ -122,7 +122,7 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_a
} break;
case Variant::STRING_ARRAY: {
- DVector<String> sarray = *p_arg;
+ PoolVector<String> sarray = *p_arg;
jobjectArray arr = env->NewObjectArray(sarray.size(),env->FindClass("java/lang/String"),env->NewStringUTF(""));
for(int j=0;j<sarray.size();j++) {
@@ -181,18 +181,18 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_a
case Variant::INT_ARRAY: {
- DVector<int> array = *p_arg;
+ PoolVector<int> array = *p_arg;
jintArray arr = env->NewIntArray(array.size());
- DVector<int>::Read r = array.read();
+ PoolVector<int>::Read r = array.read();
env->SetIntArrayRegion(arr,0,array.size(),r.ptr());
v.val.l=arr;
v.obj=arr;
} break;
case Variant::RAW_ARRAY: {
- DVector<uint8_t> array = *p_arg;
+ PoolVector<uint8_t> array = *p_arg;
jbyteArray arr = env->NewByteArray(array.size());
- DVector<uint8_t>::Read r = array.read();
+ PoolVector<uint8_t>::Read r = array.read();
env->SetByteArrayRegion(arr,0,array.size(),reinterpret_cast<const signed char*>(r.ptr()));
v.val.l=arr;
v.obj=arr;
@@ -200,9 +200,9 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_a
} break;
case Variant::REAL_ARRAY: {
- DVector<float> array = *p_arg;
+ PoolVector<float> array = *p_arg;
jfloatArray arr = env->NewFloatArray(array.size());
- DVector<float>::Read r = array.read();
+ PoolVector<float>::Read r = array.read();
env->SetFloatArrayRegion(arr,0,array.size(),r.ptr());
v.val.l=arr;
v.obj=arr;
@@ -259,7 +259,7 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) {
jobjectArray arr = (jobjectArray)obj;
int stringCount = env->GetArrayLength(arr);
//print_line("String array! " + String::num(stringCount));
- DVector<String> sarr;
+ PoolVector<String> sarr;
for (int i=0; i<stringCount; i++) {
jstring string = (jstring) env->GetObjectArrayElement(arr, i);
@@ -290,12 +290,12 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) {
jintArray arr = (jintArray)obj;
int fCount = env->GetArrayLength(arr);
- DVector<int> sarr;
+ PoolVector<int> sarr;
sarr.resize(fCount);
- DVector<int>::Write w = sarr.write();
+ PoolVector<int>::Write w = sarr.write();
env->GetIntArrayRegion(arr,0,fCount,w.ptr());
- w = DVector<int>::Write();
+ w = PoolVector<int>::Write();
return sarr;
};
@@ -303,12 +303,12 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) {
jbyteArray arr = (jbyteArray)obj;
int fCount = env->GetArrayLength(arr);
- DVector<uint8_t> sarr;
+ PoolVector<uint8_t> sarr;
sarr.resize(fCount);
- DVector<uint8_t>::Write w = sarr.write();
+ PoolVector<uint8_t>::Write w = sarr.write();
env->GetByteArrayRegion(arr,0,fCount,reinterpret_cast<signed char*>(w.ptr()));
- w = DVector<uint8_t>::Write();
+ w = PoolVector<uint8_t>::Write();
return sarr;
};
@@ -540,12 +540,12 @@ public:
jintArray arr = (jintArray)env->CallObjectMethodA(instance,E->get().method,v);
int fCount = env->GetArrayLength(arr);
- DVector<int> sarr;
+ PoolVector<int> sarr;
sarr.resize(fCount);
- DVector<int>::Write w = sarr.write();
+ PoolVector<int>::Write w = sarr.write();
env->GetIntArrayRegion(arr,0,fCount,w.ptr());
- w = DVector<int>::Write();
+ w = PoolVector<int>::Write();
ret=sarr;
env->DeleteLocalRef(arr);
} break;
@@ -554,12 +554,12 @@ public:
jfloatArray arr = (jfloatArray)env->CallObjectMethodA(instance,E->get().method,v);
int fCount = env->GetArrayLength(arr);
- DVector<float> sarr;
+ PoolVector<float> sarr;
sarr.resize(fCount);
- DVector<float>::Write w = sarr.write();
+ PoolVector<float>::Write w = sarr.write();
env->GetFloatArrayRegion(arr,0,fCount,w.ptr());
- w = DVector<float>::Write();
+ w = PoolVector<float>::Write();
ret=sarr;
env->DeleteLocalRef(arr);
} break;
@@ -642,7 +642,7 @@ struct JAndroidPointerEvent {
static List<JAndroidPointerEvent> pointer_events;
static List<InputEvent> key_events;
-static List<OS_Android::JoystickEvent> joy_events;
+static List<OS_Android::JoypadEvent> joy_events;
static bool initialized=false;
static Mutex *input_mutex=NULL;
static Mutex *suspend_mutex=NULL;
@@ -921,7 +921,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_initialize(JNIEnv * e
__android_log_print(ANDROID_LOG_INFO,"godot","*****SETUP OK");
//video driver is determined here, because once initialized, it cant be changed
- String vd = Globals::get_singleton()->get("display/driver");
+ String vd = GlobalConfig::get_singleton()->get("display/driver");
env->CallVoidMethod(_godot_instance, _on_video_init, (jboolean)true);
@@ -976,7 +976,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_quit(JNIEnv * env, jo
static void _initialize_java_modules() {
- String modules = Globals::get_singleton()->get("android/modules");
+ String modules = GlobalConfig::get_singleton()->get("android/modules");
Vector<String> mods = modules.split(",",false);
print_line("ANDROID MODULES : " + modules);
__android_log_print(ANDROID_LOG_INFO,"godot","mod count: %i",mods.size());
@@ -1051,7 +1051,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv * env, jo
// because of the way android forces you to do everything with threads
java_class_wrapper = memnew( JavaClassWrapper(_godot_instance ));
- Globals::get_singleton()->add_singleton(Globals::Singleton("JavaClassWrapper",java_class_wrapper));
+ GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("JavaClassWrapper",java_class_wrapper));
_initialize_java_modules();
Main::setup2();
@@ -1090,7 +1090,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv * env, jo
while (joy_events.size()) {
- OS_Android::JoystickEvent event = joy_events.front()->get();
+ OS_Android::JoypadEvent event = joy_events.front()->get();
os_android->process_joy_event(event);
joy_events.pop_front();
@@ -1415,7 +1415,7 @@ static unsigned int android_get_keysym(unsigned int p_code) {
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joybutton(JNIEnv * env, jobject obj, jint p_device, jint p_button, jboolean p_pressed) {
- OS_Android::JoystickEvent jevent;
+ OS_Android::JoypadEvent jevent;
jevent.device = p_device;
jevent.type = OS_Android::JOY_EVENT_BUTTON;
jevent.index = p_button;
@@ -1428,7 +1428,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joybutton(JNIEnv * en
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyaxis(JNIEnv * env, jobject obj, jint p_device, jint p_axis, jfloat p_value) {
- OS_Android::JoystickEvent jevent;
+ OS_Android::JoypadEvent jevent;
jevent.device = p_device;
jevent.type = OS_Android::JOY_EVENT_AXIS;
jevent.index = p_axis;
@@ -1440,7 +1440,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyaxis(JNIEnv * env,
}
JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_joyhat(JNIEnv * env, jobject obj, jint p_device, jint p_hat_x, jint p_hat_y) {
- OS_Android::JoystickEvent jevent;
+ OS_Android::JoypadEvent jevent;
jevent.device = p_device;
jevent.type = OS_Android::JOY_EVENT_HAT;
int hat = 0;
@@ -1570,8 +1570,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_singleton(JNIEnv * en
s->set_instance(env->NewGlobalRef(p_object));
jni_singletons[singname]=s;
- Globals::get_singleton()->add_singleton(Globals::Singleton(singname,s));
- Globals::get_singleton()->set(singname,s);
+ GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton(singname,s));
+ GlobalConfig::get_singleton()->set(singname,s);
}
@@ -1649,7 +1649,7 @@ JNIEXPORT jstring JNICALL Java_org_godotengine_godot_GodotLib_getGlobal(JNIEnv *
String js = env->GetStringUTFChars( path, NULL );
- return env->NewStringUTF(Globals::get_singleton()->get(js).operator String().utf8().get_data());
+ return env->NewStringUTF(GlobalConfig::get_singleton()->get(js).operator String().utf8().get_data());
}
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 54af4cde13..e625c0d7ec 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -370,7 +370,7 @@ void OS_Android::main_loop_focusin(){
}
-void OS_Android::process_joy_event(OS_Android::JoystickEvent p_event) {
+void OS_Android::process_joy_event(OS_Android::JoypadEvent p_event) {
switch (p_event.type) {
case JOY_EVENT_BUTTON:
@@ -748,7 +748,7 @@ String OS_Android::get_data_dir() const {
return ".";
- //return Globals::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir");
+ //return GlobalConfig::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir");
}
diff --git a/platform/android/os_android.h b/platform/android/os_android.h
index 68b50b2087..5e1fc10fd6 100644
--- a/platform/android/os_android.h
+++ b/platform/android/os_android.h
@@ -91,7 +91,7 @@ public:
JOY_EVENT_HAT = 2
};
- struct JoystickEvent {
+ struct JoypadEvent {
int device;
int type;
@@ -249,7 +249,7 @@ public:
void process_magnetometer(const Vector3& p_magnetometer);
void process_gyroscope(const Vector3& p_gyroscope);
void process_touch(int p_what,int p_pointer, const Vector<TouchPos>& p_points);
- void process_joy_event(JoystickEvent p_event);
+ void process_joy_event(JoypadEvent p_event);
void process_event(InputEvent p_event);
void init_video_mode(int p_video_width,int p_video_height);
diff --git a/platform/bb10/export/export.cpp b/platform/bb10/export/export.cpp
index a79d0807aa..cc994c8f24 100644
--- a/platform/bb10/export/export.cpp
+++ b/platform/bb10/export/export.cpp
@@ -248,7 +248,7 @@ void EditorExportPlatformBB10::_fix_descriptor(Vector<uint8_t>& p_descriptor) {
if (this->name!="") {
aname=this->name;
} else {
- aname = Globals::get_singleton()->get("application/name");
+ aname = GlobalConfig::get_singleton()->get("application/name");
}
@@ -432,7 +432,7 @@ Error EditorExportPlatformBB10::export_project(const String& p_path, bool p_debu
if (!found) {
- String appicon = Globals::get_singleton()->get("application/icon");
+ String appicon = GlobalConfig::get_singleton()->get("application/icon");
if (appicon!="" && appicon.ends_with(".png")) {
FileAccess*f = FileAccess::open(appicon,FileAccess::READ);
if (f) {
@@ -469,7 +469,7 @@ Error EditorExportPlatformBB10::export_project(const String& p_path, bool p_debu
ep.step("Creating BAR Package..",104);
- String bb_packager=EditorSettings::get_singleton()->get("blackberry/host_tools");
+ String bb_packager=EditorSettings::get_singleton()->get("export/blackberry/host_tools");
bb_packager=bb_packager.plus_file("blackberry-nativepackager");
if (OS::get_singleton()->get_name()=="Windows")
bb_packager+=".bat";
@@ -485,7 +485,7 @@ Error EditorExportPlatformBB10::export_project(const String& p_path, bool p_debu
args.push_back(p_path);
if (p_debug) {
- String debug_token=EditorSettings::get_singleton()->get("blackberry/debug_token");
+ String debug_token=EditorSettings::get_singleton()->get("export/blackberry/debug_token");
if (!FileAccess::exists(debug_token)) {
EditorNode::add_io_error("Debug token not found!");
} else {
@@ -554,7 +554,7 @@ void EditorExportPlatformBB10::_device_poll_thread(void *ud) {
while(!ea->quit_request) {
- String bb_deploy=EditorSettings::get_singleton()->get("blackberry/host_tools");
+ String bb_deploy=EditorSettings::get_singleton()->get("export/blackberry/host_tools");
bb_deploy=bb_deploy.plus_file("blackberry-deploy");
bool windows = OS::get_singleton()->get_name()=="Windows";
if (windows)
@@ -567,10 +567,10 @@ void EditorExportPlatformBB10::_device_poll_thread(void *ud) {
for (int i=0;i<MAX_DEVICES;i++) {
- String host = EditorSettings::get_singleton()->get("blackberry/device_"+itos(i+1)+"/host");
+ String host = EditorSettings::get_singleton()->get("export/blackberry/device_"+itos(i+1)+"/host");
if (host==String())
continue;
- String pass = EditorSettings::get_singleton()->get("blackberry/device_"+itos(i+1)+"/password");
+ String pass = EditorSettings::get_singleton()->get("export/blackberry/device_"+itos(i+1)+"/password");
if (pass==String())
continue;
@@ -661,7 +661,7 @@ Error EditorExportPlatformBB10::run(int p_device, int p_flags) {
ERR_FAIL_INDEX_V(p_device,devices.size(),ERR_INVALID_PARAMETER);
- String bb_deploy=EditorSettings::get_singleton()->get("blackberry/host_tools");
+ String bb_deploy=EditorSettings::get_singleton()->get("export/blackberry/host_tools");
bb_deploy=bb_deploy.plus_file("blackberry-deploy");
if (OS::get_singleton()->get_name()=="Windows")
bb_deploy+=".bat";
@@ -714,8 +714,8 @@ Error EditorExportPlatformBB10::run(int p_device, int p_flags) {
args.push_back("-installApp");
args.push_back("-launchApp");
args.push_back("-device");
- String host = EditorSettings::get_singleton()->get("blackberry/device_"+itos(p_device+1)+"/host");
- String pass = EditorSettings::get_singleton()->get("blackberry/device_"+itos(p_device+1)+"/password");
+ String host = EditorSettings::get_singleton()->get("export/blackberry/device_"+itos(p_device+1)+"/host");
+ String pass = EditorSettings::get_singleton()->get("export/blackberry/device_"+itos(p_device+1)+"/password");
args.push_back(host);
args.push_back("-password");
args.push_back(pass);
@@ -761,7 +761,7 @@ EditorExportPlatformBB10::EditorExportPlatformBB10() {
bool EditorExportPlatformBB10::can_export(String *r_error) const {
bool valid=true;
- String bb_deploy=EditorSettings::get_singleton()->get("blackberry/host_tools");
+ String bb_deploy=EditorSettings::get_singleton()->get("export/blackberry/host_tools");
String err;
if (!FileAccess::exists(bb_deploy.plus_file("blackberry-deploy"))) {
@@ -775,7 +775,7 @@ bool EditorExportPlatformBB10::can_export(String *r_error) const {
err+="No export template found.\nDownload and install export templates.\n";
}
- String debug_token=EditorSettings::get_singleton()->get("blackberry/debug_token");
+ String debug_token=EditorSettings::get_singleton()->get("export/blackberry/debug_token");
if (!FileAccess::exists(debug_token)) {
valid=false;
@@ -806,20 +806,20 @@ EditorExportPlatformBB10::~EditorExportPlatformBB10() {
void register_bb10_exporter() {
- EDITOR_DEF("blackberry/host_tools","");
- EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"blackberry/host_tools",PROPERTY_HINT_GLOBAL_DIR));
- EDITOR_DEF("blackberry/debug_token","");
- EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"blackberry/debug_token",PROPERTY_HINT_GLOBAL_FILE,"bar"));
- EDITOR_DEF("blackberry/device_1/host","");
- EDITOR_DEF("blackberry/device_1/password","");
- EDITOR_DEF("blackberry/device_2/host","");
- EDITOR_DEF("blackberry/device_2/password","");
- EDITOR_DEF("blackberry/device_3/host","");
- EDITOR_DEF("blackberry/device_3/password","");
- EDITOR_DEF("blackberry/device_4/host","");
- EDITOR_DEF("blackberry/device_4/password","");
- EDITOR_DEF("blackberry/device_5/host","");
- EDITOR_DEF("blackberry/device_5/password","");
+ EDITOR_DEF("export/blackberry/host_tools","");
+ EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"export/blackberry/host_tools",PROPERTY_HINT_GLOBAL_DIR));
+ EDITOR_DEF("export/blackberry/debug_token","");
+ EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"export/blackberry/debug_token",PROPERTY_HINT_GLOBAL_FILE,"bar"));
+ EDITOR_DEF("export/blackberry/device_1/host","");
+ EDITOR_DEF("export/blackberry/device_1/password","");
+ EDITOR_DEF("export/blackberry/device_2/host","");
+ EDITOR_DEF("export/blackberry/device_2/password","");
+ EDITOR_DEF("export/blackberry/device_3/host","");
+ EDITOR_DEF("export/blackberry/device_3/password","");
+ EDITOR_DEF("export/blackberry/device_4/host","");
+ EDITOR_DEF("export/blackberry/device_4/password","");
+ EDITOR_DEF("export/blackberry/device_5/host","");
+ EDITOR_DEF("export/blackberry/device_5/password","");
Ref<EditorExportPlatformBB10> exporter = Ref<EditorExportPlatformBB10>( memnew(EditorExportPlatformBB10) );
EditorImportExport::get_singleton()->add_export_platform(exporter);
diff --git a/platform/haiku/platform_config.h b/platform/haiku/platform_config.h
index 527dc9de06..a3aa918ba8 100644
--- a/platform/haiku/platform_config.h
+++ b/platform/haiku/platform_config.h
@@ -31,4 +31,4 @@
// for ifaddrs.h needed in drivers/unix/ip_unix.cpp
#define _BSD_SOURCE 1
-#define GLES2_INCLUDE_H <GL/glew.h>
+#define GLES3_INCLUDE_H "glad/glad.h"
diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm
index 86c3eecd47..feb87e742f 100644
--- a/platform/iphone/app_delegate.mm
+++ b/platform/iphone/app_delegate.mm
@@ -162,14 +162,14 @@ static int frame_count = 0;
NSString* str = (NSString*)value;
String uval = String::utf8([str UTF8String]);
- Globals::get_singleton()->set("Info.plist/"+ukey, uval);
+ GlobalConfig::get_singleton()->set("Info.plist/"+ukey, uval);
} else if ([value isKindOfClass:[NSNumber class]]) {
NSNumber* n = (NSNumber*)value;
double dval = [n doubleValue];
- Globals::get_singleton()->set("Info.plist/"+ukey, dval);
+ GlobalConfig::get_singleton()->set("Info.plist/"+ukey, dval);
};
// do stuff
}
@@ -186,7 +186,7 @@ static int frame_count = 0;
++frame_count;
#ifdef APPIRATER_ENABLED
- int aid = Globals::get_singleton()->get("ios/app_id");
+ int aid = GlobalConfig::get_singleton()->get("ios/app_id");
[Appirater appLaunched:YES app_id:aid];
#endif
@@ -266,11 +266,11 @@ static int frame_count = 0;
#ifdef MODULE_GAME_ANALYTICS_ENABLED
printf("********************* didFinishLaunchingWithOptions\n");
- if(!Globals::get_singleton()->has("mobileapptracker/advertiser_id"))
+ if(!GlobalConfig::get_singleton()->has("mobileapptracker/advertiser_id"))
{
return;
}
- if(!Globals::get_singleton()->has("mobileapptracker/conversion_key"))
+ if(!GlobalConfig::get_singleton()->has("mobileapptracker/conversion_key"))
{
return;
}
diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm
index d8ed930157..3df29c5178 100755
--- a/platform/iphone/gl_view.mm
+++ b/platform/iphone/gl_view.mm
@@ -76,7 +76,7 @@ void _hide_keyboard() {
};
bool _play_video(String p_path, float p_volume, String p_audio_track, String p_subtitle_track) {
- p_path = Globals::get_singleton()->globalize_path(p_path);
+ p_path = GlobalConfig::get_singleton()->globalize_path(p_path);
NSString* file_path = [[[NSString alloc] initWithUTF8String:p_path.utf8().get_data()] autorelease];
diff --git a/platform/iphone/globals/global_defaults.cpp b/platform/iphone/globals/global_defaults.cpp
index 0a67566398..76b5c9aa01 100755
--- a/platform/iphone/globals/global_defaults.cpp
+++ b/platform/iphone/globals/global_defaults.cpp
@@ -32,9 +32,10 @@
void register_iphone_global_defaults() {
- GLOBAL_DEF("rasterizer.iOS/use_fragment_lighting",false);
+ /*GLOBAL_DEF("rasterizer.iOS/use_fragment_lighting",false);
GLOBAL_DEF("rasterizer.iOS/fp16_framebuffer",false);
GLOBAL_DEF("display.iOS/driver","GLES2");
- Globals::get_singleton()->set_custom_property_info("display.iOS/driver",PropertyInfo(Variant::STRING,"display.iOS/driver",PROPERTY_HINT_ENUM,"GLES1,GLES2"));
+ GlobalConfig::get_singleton()->set_custom_property_info("display.iOS/driver",PropertyInfo(Variant::STRING,"display.iOS/driver",PROPERTY_HINT_ENUM,"GLES1,GLES2"));
GLOBAL_DEF("display.iOS/use_cadisplaylink",true);
+ */
}
diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp
index e4d99cc502..1d12501aea 100644
--- a/platform/iphone/os_iphone.cpp
+++ b/platform/iphone/os_iphone.cpp
@@ -331,7 +331,7 @@ void OSIPhone::update_accelerometer(float p_x, float p_y, float p_z) {
if (p_x != last_accel.x) {
//printf("updating accel x %f\n", p_x);
InputEvent ev;
- ev.type = InputEvent::JOYSTICK_MOTION;
+ ev.type = InputEvent::JOYPAD_MOTION;
ev.device = 0;
ev.joy_motion.axis = JOY_ANALOG_0_X;
ev.joy_motion.axis_value = (p_x / (float)ACCEL_RANGE);
@@ -342,7 +342,7 @@ void OSIPhone::update_accelerometer(float p_x, float p_y, float p_z) {
if (p_y != last_accel.y) {
//printf("updating accel y %f\n", p_y);
InputEvent ev;
- ev.type = InputEvent::JOYSTICK_MOTION;
+ ev.type = InputEvent::JOYPAD_MOTION;
ev.device = 0;
ev.joy_motion.axis = JOY_ANALOG_0_Y;
ev.joy_motion.axis_value = (p_y / (float)ACCEL_RANGE);
@@ -353,7 +353,7 @@ void OSIPhone::update_accelerometer(float p_x, float p_y, float p_z) {
if (p_z != last_accel.z) {
//printf("updating accel z %f\n", p_z);
InputEvent ev;
- ev.type = InputEvent::JOYSTICK_MOTION;
+ ev.type = InputEvent::JOYPAD_MOTION;
ev.device = 0;
ev.joy_motion.axis = JOY_ANALOG_1_X;
ev.joy_motion.axis_value = ( (1.0 - p_z) / (float)ACCEL_RANGE);
diff --git a/platform/iphone/rasterizer_iphone.cpp b/platform/iphone/rasterizer_iphone.cpp
index 3654f6d2d6..ee0457cfb1 100644
--- a/platform/iphone/rasterizer_iphone.cpp
+++ b/platform/iphone/rasterizer_iphone.cpp
@@ -286,7 +286,7 @@ void RasterizerIPhone::texture_blit_rect(RID p_texture,int p_x,int p_y, const Im
GLenum blit_target = GL_TEXTURE_2D; //(texture->target == GL_TEXTURE_CUBE_MAP)?_cube_side_enum[p_cube_side]:GL_TEXTURE_2D;
- DVector<uint8_t>::Read read = img.get_data().read();
+ PoolVector<uint8_t>::Read read = img.get_data().read();
glBindTexture(texture->target, texture->tex_id);
glTexSubImage2D( blit_target, 0, p_x,p_y,img.get_width(),img.get_height(),format,GL_UNSIGNED_BYTE,read.ptr() );
@@ -770,7 +770,7 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr
ERR_FAIL_COND_V( surface->index_array_len<=0, ERR_INVALID_DATA );
ERR_FAIL_COND_V( p_array.get_type() != Variant::INT_ARRAY, ERR_INVALID_PARAMETER );
- DVector<int> indices = p_array;
+ PoolVector<int> indices = p_array;
ERR_FAIL_COND_V( indices.size() == 0, ERR_INVALID_PARAMETER );
ERR_FAIL_COND_V( indices.size() != surface->index_array_len, ERR_INVALID_PARAMETER );
@@ -780,7 +780,7 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,surface->index_id);
};
- DVector<int>::Read read = indices.read();
+ PoolVector<int>::Read read = indices.read();
const int *src=read.ptr();
for (int i=0;i<surface->index_array_len;i++) {
@@ -822,14 +822,14 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr
ERR_FAIL_COND_V( p_array.get_type() != Variant::VECTOR3_ARRAY, ERR_INVALID_PARAMETER );
- DVector<Vector3> array = p_array;
+ PoolVector<Vector3> array = p_array;
ERR_FAIL_COND_V( array.size() != surface->array_len, ERR_INVALID_PARAMETER );
if (surface->array_local == 0) {
glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id);
};
- DVector<Vector3>::Read read = array.read();
+ PoolVector<Vector3>::Read read = array.read();
const Vector3* src=read.ptr();
// setting vertices means regenerating the AABB
@@ -868,7 +868,7 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr
ERR_FAIL_COND_V( p_array.get_type() != Variant::REAL_ARRAY, ERR_INVALID_PARAMETER );
- DVector<real_t> array = p_array;
+ PoolVector<real_t> array = p_array;
ERR_FAIL_COND_V( array.size() != surface->array_len*4, ERR_INVALID_PARAMETER );
@@ -877,7 +877,7 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr
};
- DVector<real_t>::Read read = array.read();
+ PoolVector<real_t>::Read read = array.read();
const real_t* src = read.ptr();
for (int i=0;i<surface->array_len;i++) {
@@ -908,7 +908,7 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr
ERR_FAIL_COND_V( p_array.get_type() != Variant::COLOR_ARRAY, ERR_INVALID_PARAMETER );
- DVector<Color> array = p_array;
+ PoolVector<Color> array = p_array;
ERR_FAIL_COND_V( array.size() != surface->array_len, ERR_INVALID_PARAMETER );
@@ -916,7 +916,7 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr
glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id);
- DVector<Color>::Read read = array.read();
+ PoolVector<Color>::Read read = array.read();
const Color* src = read.ptr();
surface->has_alpha_cache=false;
@@ -943,14 +943,14 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr
ERR_FAIL_COND_V( p_array.get_type() != Variant::VECTOR3_ARRAY, ERR_INVALID_PARAMETER );
- DVector<Vector3> array = p_array;
+ PoolVector<Vector3> array = p_array;
ERR_FAIL_COND_V( array.size() != surface->array_len , ERR_INVALID_PARAMETER);
if (surface->array_local == 0)
glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id);
- DVector<Vector3>::Read read = array.read();
+ PoolVector<Vector3>::Read read = array.read();
const Vector3 * src=read.ptr();
@@ -975,14 +975,14 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr
ERR_FAIL_COND_V( p_array.get_type() != Variant::REAL_ARRAY, ERR_INVALID_PARAMETER );
- DVector<real_t> array = p_array;
+ PoolVector<real_t> array = p_array;
ERR_FAIL_COND_V( array.size() != surface->array_len*VS::ARRAY_WEIGHTS_SIZE, ERR_INVALID_PARAMETER );
if (surface->array_local == 0)
glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id);
- DVector<real_t>::Read read = array.read();
+ PoolVector<real_t>::Read read = array.read();
const real_t * src = read.ptr();
diff --git a/platform/javascript/audio_server_javascript.cpp b/platform/javascript/audio_server_javascript.cpp
index fec553df04..d1fba030a5 100644
--- a/platform/javascript/audio_server_javascript.cpp
+++ b/platform/javascript/audio_server_javascript.cpp
@@ -87,7 +87,7 @@ const void* AudioServerJavascript::sample_get_data_ptr(RID p_sample) const{
return NULL;
}
-void AudioServerJavascript::sample_set_data(RID p_sample, const DVector<uint8_t>& p_buffer){
+void AudioServerJavascript::sample_set_data(RID p_sample, const PoolVector<uint8_t>& p_buffer){
Sample *sample = sample_owner.get(p_sample);
ERR_FAIL_COND(!sample);
@@ -95,7 +95,7 @@ void AudioServerJavascript::sample_set_data(RID p_sample, const DVector<uint8_t>
Vector<float> buffer;
buffer.resize(sample->length*chans);
- DVector<uint8_t>::Read r=p_buffer.read();
+ PoolVector<uint8_t>::Read r=p_buffer.read();
if (sample->format==SAMPLE_FORMAT_PCM8) {
const int8_t*ptr = (const int8_t*)r.ptr();
for(int i=0;i<sample->length*chans;i++) {
@@ -116,10 +116,10 @@ void AudioServerJavascript::sample_set_data(RID p_sample, const DVector<uint8_t>
}
-DVector<uint8_t> AudioServerJavascript::sample_get_data(RID p_sample) const{
+PoolVector<uint8_t> AudioServerJavascript::sample_get_data(RID p_sample) const{
- return DVector<uint8_t>();
+ return PoolVector<uint8_t>();
}
void AudioServerJavascript::sample_set_mix_rate(RID p_sample,int p_rate){
diff --git a/platform/javascript/audio_server_javascript.h b/platform/javascript/audio_server_javascript.h
index 47aadf6bc6..8e61e94dfc 100644
--- a/platform/javascript/audio_server_javascript.h
+++ b/platform/javascript/audio_server_javascript.h
@@ -131,8 +131,8 @@ public:
virtual const void* sample_get_data_ptr(RID p_sample) const;
- virtual void sample_set_data(RID p_sample, const DVector<uint8_t>& p_buffer);
- virtual DVector<uint8_t> sample_get_data(RID p_sample) const;
+ virtual void sample_set_data(RID p_sample, const PoolVector<uint8_t>& p_buffer);
+ virtual PoolVector<uint8_t> sample_get_data(RID p_sample) const;
virtual void sample_set_mix_rate(RID p_sample,int p_rate);
virtual int sample_get_mix_rate(RID p_sample) const;
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index 77aab98e0c..c151bff45c 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -181,9 +181,9 @@ void EditorExportPlatformJavaScript::_fix_html(Vector<uint8_t>& p_html, const St
String current_line = lines[i];
current_line = current_line.replace("$GODOT_TMEM",itos((1<<(max_memory+5))*1024*1024));
current_line = current_line.replace("$GODOT_BASE",p_name);
- current_line = current_line.replace("$GODOT_CANVAS_WIDTH",Globals::get_singleton()->get("display/width"));
- current_line = current_line.replace("$GODOT_CANVAS_HEIGHT",Globals::get_singleton()->get("display/height"));
- current_line = current_line.replace("$GODOT_HEAD_TITLE",!html_title.empty()?html_title:(String) Globals::get_singleton()->get("application/name"));
+ current_line = current_line.replace("$GODOT_CANVAS_WIDTH",GlobalConfig::get_singleton()->get("display/width"));
+ current_line = current_line.replace("$GODOT_CANVAS_HEIGHT",GlobalConfig::get_singleton()->get("display/height"));
+ current_line = current_line.replace("$GODOT_HEAD_TITLE",!html_title.empty()?html_title:(String) GlobalConfig::get_singleton()->get("application/name"));
current_line = current_line.replace("$GODOT_HEAD_INCLUDE",html_head_include);
current_line = current_line.replace("$GODOT_STYLE_FONT_FAMILY",html_font_family);
current_line = current_line.replace("$GODOT_STYLE_INCLUDE",html_style_include);
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index f1b67021f0..47c8ea89d7 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -309,7 +309,7 @@ void OS_JavaScript::initialize(const VideoMode& p_desired,int p_video_driver,int
#ifdef JAVASCRIPT_EVAL_ENABLED
javascript_eval = memnew(JavaScript);
- Globals::get_singleton()->add_singleton(Globals::Singleton("JavaScript", javascript_eval));
+ GlobalConfig::get_singleton()->add_singleton(GlobalConfig::Singleton("JavaScript", javascript_eval));
#endif
}
@@ -519,7 +519,7 @@ bool OS_JavaScript::main_loop_iterate() {
}
- process_joysticks();
+ process_joypads();
return Main::iteration();
}
@@ -807,7 +807,7 @@ String OS_JavaScript::get_data_dir() const {
//if (get_data_dir_func)
// return get_data_dir_func();
return "/userfs";
- //return Globals::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir");
+ //return GlobalConfig::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir");
};
String OS_JavaScript::get_executable_path() const {
@@ -824,7 +824,7 @@ void OS_JavaScript::_close_notification_funcs(const String& p_file,int p_flags)
}
}
-void OS_JavaScript::process_joysticks() {
+void OS_JavaScript::process_joypads() {
int joy_count = emscripten_get_num_gamepads();
for (int i = 0; i < joy_count; i++) {
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index 4cdc88f4f9..370322e93d 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -93,7 +93,7 @@ private:
static void _close_notification_funcs(const String& p_file,int p_flags);
- void process_joysticks();
+ void process_joypads();
public:
diff --git a/platform/osx/SCsub b/platform/osx/SCsub
index c8e0e17612..00f23687cf 100644
--- a/platform/osx/SCsub
+++ b/platform/osx/SCsub
@@ -9,7 +9,7 @@ files = [
'sem_osx.cpp',
# 'context_gl_osx.cpp',
'dir_access_osx.mm',
- 'joystick_osx.cpp',
+ 'joypad_osx.cpp',
]
env.Program('#bin/godot', files)
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index d8298eee73..1cb41cede2 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -324,8 +324,8 @@ Error EditorExportPlatformOSX::export_project(const String& p_path, bool p_debug
String pkg_name;
if (app_name!="")
pkg_name=app_name;
- else if (String(Globals::get_singleton()->get("application/name"))!="")
- pkg_name=String(Globals::get_singleton()->get("application/name"));
+ else if (String(GlobalConfig::get_singleton()->get("application/name"))!="")
+ pkg_name=String(GlobalConfig::get_singleton()->get("application/name"));
else
pkg_name="Unnamed";
@@ -371,7 +371,7 @@ Error EditorExportPlatformOSX::export_project(const String& p_path, bool p_debug
if (file=="Contents/Resources/icon.icns") {
//see if there is an icon
- String iconpath = Globals::get_singleton()->get("application/icon");
+ String iconpath = GlobalConfig::get_singleton()->get("application/icon");
print_line("icon? "+iconpath);
if (iconpath!="") {
Image icon;
diff --git a/platform/osx/joystick_osx.cpp b/platform/osx/joypad_osx.cpp
index 740c349fe1..5d25017aa6 100644
--- a/platform/osx/joystick_osx.cpp
+++ b/platform/osx/joypad_osx.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* joystick_osx.cpp */
+/* joypad_osx.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -26,14 +26,15 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "joystick_osx.h"
+#include "joypad_osx.h"
+
#include <machine/endian.h>
-#define GODOT_JOY_LOOP_RUN_MODE CFSTR("GodotJoystick")
+#define GODOT_JOY_LOOP_RUN_MODE CFSTR("GodotJoypad")
-static JoystickOSX* self = NULL;
+static JoypadOSX* self = NULL;
-joystick::joystick() {
+joypad::joypad() {
device_ref = NULL;
ff_device = NULL;
ff_axes = NULL;
@@ -56,7 +57,7 @@ joystick::joystick() {
ff_effect.dwSize = sizeof(ff_effect);
}
-void joystick::free() {
+void joypad::free() {
if (device_ref) {
IOHIDDeviceUnscheduleFromRunLoop(device_ref, CFRunLoopGetCurrent(), GODOT_JOY_LOOP_RUN_MODE);
}
@@ -68,7 +69,7 @@ void joystick::free() {
}
}
-bool joystick::has_element(IOHIDElementCookie p_cookie, Vector<rec_element> *p_list) const {
+bool joypad::has_element(IOHIDElementCookie p_cookie, Vector<rec_element> *p_list) const {
for (int i = 0; i < p_list->size(); i++) {
if (p_cookie == p_list->get(i).cookie) {
return true;
@@ -77,7 +78,7 @@ bool joystick::has_element(IOHIDElementCookie p_cookie, Vector<rec_element> *p_l
return false;
}
-int joystick::get_hid_element_state(rec_element *p_element) const {
+int joypad::get_hid_element_state(rec_element *p_element) const {
int value = 0;
if (p_element && p_element->ref) {
IOHIDValueRef valueRef;
@@ -95,7 +96,7 @@ int joystick::get_hid_element_state(rec_element *p_element) const {
}
return value;
}
-void joystick::add_hid_element(IOHIDElementRef p_element) {
+void joypad::add_hid_element(IOHIDElementRef p_element) {
const CFTypeID elementTypeID = p_element ? CFGetTypeID(p_element) : 0;
if (p_element && (elementTypeID == IOHIDElementGetTypeID())) {
@@ -198,26 +199,26 @@ void joystick::add_hid_element(IOHIDElementRef p_element) {
}
static void hid_element_added(const void *p_value, void *p_parameter) {
- joystick *joy = (joystick*) p_parameter;
+ joypad *joy = (joypad*) p_parameter;
joy->add_hid_element((IOHIDElementRef) p_value);
}
-void joystick::add_hid_elements(CFArrayRef p_array) {
+void joypad::add_hid_elements(CFArrayRef p_array) {
CFRange range = { 0, CFArrayGetCount(p_array) };
CFArrayApplyFunction(p_array, range,hid_element_added,this);
}
-static void joystick_removed_callback(void *ctx, IOReturn result, void *sender) {
+static void joypad_removed_callback(void *ctx, IOReturn result, void *sender) {
int id = (intptr_t) ctx;
self->_device_removed(id);
}
-static void joystick_added_callback(void *ctx, IOReturn res, void *sender, IOHIDDeviceRef ioHIDDeviceObject) {
+static void joypad_added_callback(void *ctx, IOReturn res, void *sender, IOHIDDeviceRef ioHIDDeviceObject) {
self->_device_added(res, ioHIDDeviceObject);
}
-static bool is_joystick(IOHIDDeviceRef p_device_ref) {
+static bool is_joypad(IOHIDDeviceRef p_device_ref) {
CFTypeRef refCF = NULL;
int usage_page = 0;
int usage = 0;
@@ -241,32 +242,32 @@ static bool is_joystick(IOHIDDeviceRef p_device_ref) {
return true;
}
-void JoystickOSX::_device_added(IOReturn p_res, IOHIDDeviceRef p_device) {
+void JoypadOSX::_device_added(IOReturn p_res, IOHIDDeviceRef p_device) {
if (p_res != kIOReturnSuccess || have_device(p_device)) {
return;
}
- joystick new_joystick;
- if (is_joystick(p_device)) {
- configure_joystick(p_device, &new_joystick);
+ joypad new_joypad;
+ if (is_joypad(p_device)) {
+ configure_joypad(p_device, &new_joypad);
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
if (IOHIDDeviceGetService != NULL) {
#endif
const io_service_t ioservice = IOHIDDeviceGetService(p_device);
- if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK) && new_joystick.config_force_feedback(ioservice)) {
- new_joystick.ffservice = ioservice;
+ if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK) && new_joypad.config_force_feedback(ioservice)) {
+ new_joypad.ffservice = ioservice;
}
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
}
#endif
- device_list.push_back(new_joystick);
+ device_list.push_back(new_joypad);
}
- IOHIDDeviceRegisterRemovalCallback(p_device, joystick_removed_callback, (void*) (intptr_t) new_joystick.id);
+ IOHIDDeviceRegisterRemovalCallback(p_device, joypad_removed_callback, (void*) (intptr_t) new_joypad.id);
IOHIDDeviceScheduleWithRunLoop(p_device, CFRunLoopGetCurrent(), GODOT_JOY_LOOP_RUN_MODE);
}
-void JoystickOSX::_device_removed(int p_id) {
+void JoypadOSX::_device_removed(int p_id) {
int device = get_joy_index(p_id);
ERR_FAIL_COND(device == -1);
@@ -289,7 +290,7 @@ static String _hex_str(uint8_t p_byte) {
return ret;
}
-bool JoystickOSX::configure_joystick(IOHIDDeviceRef p_device_ref, joystick* p_joy) {
+bool JoypadOSX::configure_joypad(IOHIDDeviceRef p_device_ref, joypad* p_joy) {
CFTypeRef refCF = NULL;
@@ -302,7 +303,7 @@ bool JoystickOSX::configure_joystick(IOHIDDeviceRef p_device_ref, joystick* p_jo
refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDManufacturerKey));
}
if ((!refCF) || (!CFStringGetCString((CFStringRef) refCF, c_name, sizeof (c_name), kCFStringEncodingUTF8))) {
- name = "Unidentified Joystick";
+ name = "Unidentified Joypad";
}
name = c_name;
@@ -345,7 +346,7 @@ bool JoystickOSX::configure_joystick(IOHIDDeviceRef p_device_ref, joystick* p_jo
}
#define FF_ERR() { if (ret != FF_OK) { FFReleaseDevice(ff_device); return false; } }
-bool joystick::config_force_feedback(io_service_t p_service) {
+bool joypad::config_force_feedback(io_service_t p_service) {
HRESULT ret = FFCreateDevice(p_service, &ff_device);
ERR_FAIL_COND_V(ret != FF_OK, false);
@@ -367,7 +368,7 @@ bool joystick::config_force_feedback(io_service_t p_service) {
#undef FF_ERR
#define TEST_FF(ff) (features.supportedEffects & (ff))
-bool joystick::check_ff_features() {
+bool joypad::check_ff_features() {
FFCAPABILITIES features;
HRESULT ret = FFDeviceGetForceFeedbackCapabilities(ff_device, &features);
@@ -432,7 +433,7 @@ static int process_hat_value(int p_min, int p_max, int p_value) {
return hat_value;
}
-void JoystickOSX::poll_joysticks() const {
+void JoypadOSX::poll_joypads() const {
while (CFRunLoopRunInMode(GODOT_JOY_LOOP_RUN_MODE,0,TRUE) == kCFRunLoopRunHandledSource) {
/* no-op. Pending callbacks will fire. */
}
@@ -454,11 +455,11 @@ static const InputDefault::JoyAxis axis_correct(int p_value, int p_min, int p_ma
return jx;
}
-uint32_t JoystickOSX::process_joysticks(uint32_t p_last_id){
- poll_joysticks();
+uint32_t JoypadOSX::process_joypads(uint32_t p_last_id){
+ poll_joypads();
for (int i = 0; i < device_list.size(); i++) {
- joystick &joy = device_list[i];
+ joypad &joy = device_list[i];
for (int j = 0; j < joy.axis_elements.size(); j++) {
rec_element &elem = joy.axis_elements[j];
@@ -482,11 +483,11 @@ uint32_t JoystickOSX::process_joysticks(uint32_t p_last_id){
Vector2 strength = input->get_joy_vibration_strength(joy.id);
float duration = input->get_joy_vibration_duration(joy.id);
if (strength.x == 0 && strength.y == 0) {
- joystick_vibration_stop(joy.id, timestamp);
+ joypad_vibration_stop(joy.id, timestamp);
}
else {
float gain = MAX(strength.x, strength.y);
- joystick_vibration_start(joy.id, gain, duration, timestamp);
+ joypad_vibration_start(joy.id, gain, duration, timestamp);
}
}
}
@@ -494,8 +495,8 @@ uint32_t JoystickOSX::process_joysticks(uint32_t p_last_id){
return p_last_id;
}
-void JoystickOSX::joystick_vibration_start(int p_id, float p_magnitude, float p_duration, uint64_t p_timestamp) {
- joystick *joy = &device_list[get_joy_index(p_id)];
+void JoypadOSX::joypad_vibration_start(int p_id, float p_magnitude, float p_duration, uint64_t p_timestamp) {
+ joypad *joy = &device_list[get_joy_index(p_id)];
joy->ff_timestamp = p_timestamp;
joy->ff_effect.dwDuration = p_duration * FF_SECONDS;
joy->ff_effect.dwGain = p_magnitude * FF_FFNOMINALMAX;
@@ -503,14 +504,14 @@ void JoystickOSX::joystick_vibration_start(int p_id, float p_magnitude, float p_
FFEffectStart(joy->ff_object, 1, 0);
}
-void JoystickOSX::joystick_vibration_stop(int p_id, uint64_t p_timestamp) {
- joystick* joy = &device_list[get_joy_index(p_id)];
+void JoypadOSX::joypad_vibration_stop(int p_id, uint64_t p_timestamp) {
+ joypad* joy = &device_list[get_joy_index(p_id)];
joy->ff_timestamp = p_timestamp;
FFEffectStop(joy->ff_object);
}
-int JoystickOSX::get_free_joy_id() {
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+int JoypadOSX::get_free_joy_id() {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
if (!attached_devices[i]) {
attached_devices[i] = true;
return i;
@@ -519,14 +520,14 @@ int JoystickOSX::get_free_joy_id() {
return -1;
}
-int JoystickOSX::get_joy_index(int p_id) const {
+int JoypadOSX::get_joy_index(int p_id) const {
for (int i = 0; i < device_list.size(); i++) {
if (device_list[i].id == p_id) return i;
}
return -1;
}
-bool JoystickOSX::have_device(IOHIDDeviceRef p_device) const {
+bool JoypadOSX::have_device(IOHIDDeviceRef p_device) const {
for (int i = 0; i < device_list.size(); i++) {
if (device_list[i].device_ref == p_device) {
return true;
@@ -561,14 +562,14 @@ static CFDictionaryRef create_match_dictionary(const UInt32 page, const UInt32 u
return retval;
}
-void JoystickOSX::config_hid_manager(CFArrayRef p_matching_array) const {
+void JoypadOSX::config_hid_manager(CFArrayRef p_matching_array) const {
CFRunLoopRef runloop = CFRunLoopGetCurrent();
IOReturn ret = IOHIDManagerOpen(hid_manager, kIOHIDOptionsTypeNone);
ERR_FAIL_COND(ret != kIOReturnSuccess);
IOHIDManagerSetDeviceMatchingMultiple(hid_manager, p_matching_array);
- IOHIDManagerRegisterDeviceMatchingCallback(hid_manager, joystick_added_callback, NULL);
+ IOHIDManagerRegisterDeviceMatchingCallback(hid_manager, joypad_added_callback, NULL);
IOHIDManagerScheduleWithRunLoop(hid_manager, runloop, GODOT_JOY_LOOP_RUN_MODE);
while (CFRunLoopRunInMode(GODOT_JOY_LOOP_RUN_MODE,0,TRUE) == kCFRunLoopRunHandledSource) {
@@ -576,12 +577,12 @@ void JoystickOSX::config_hid_manager(CFArrayRef p_matching_array) const {
}
}
-JoystickOSX::JoystickOSX()
+JoypadOSX::JoypadOSX()
{
self = this;
input = (InputDefault*)Input::get_singleton();
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
attached_devices[i] = false;
}
@@ -609,7 +610,7 @@ JoystickOSX::JoystickOSX()
}
}
-JoystickOSX::~JoystickOSX() {
+JoypadOSX::~JoypadOSX() {
for (int i = 0; i < device_list.size(); i++) {
device_list[i].free();
diff --git a/platform/osx/joystick_osx.h b/platform/osx/joypad_osx.h
index ec745fe5d1..aafd82880d 100644
--- a/platform/osx/joystick_osx.h
+++ b/platform/osx/joypad_osx.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* joystick_osx.h */
+/* joypad_osx.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -26,8 +26,8 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef JOYSTICKOSX_H
-#define JOYSTICKOSX_H
+#ifndef JOYPADOSX_H
+#define JOYPADOSX_H
#ifdef MACOS_10_0_4
#include <IOKit/hidsystem/IOHIDUsageTables.h>
@@ -54,7 +54,7 @@ struct rec_element {
};
};
-struct joystick {
+struct joypad {
IOHIDDeviceRef device_ref;
Vector<rec_element> axis_elements;
@@ -82,44 +82,44 @@ struct joystick {
int get_hid_element_state(rec_element *p_element) const;
void free();
- joystick();
+ joypad();
};
-class JoystickOSX {
+class JoypadOSX {
enum {
- JOYSTICKS_MAX = 16,
+ JOYPADS_MAX = 16,
};
private:
InputDefault *input;
IOHIDManagerRef hid_manager;
- bool attached_devices[JOYSTICKS_MAX];
- Vector<joystick> device_list;
+ bool attached_devices[JOYPADS_MAX];
+ Vector<joypad> device_list;
bool have_device(IOHIDDeviceRef p_device) const;
- bool configure_joystick(IOHIDDeviceRef p_device_ref, joystick *p_joy);
+ bool configure_joypad(IOHIDDeviceRef p_device_ref, joypad *p_joy);
int get_free_joy_id();
int get_joy_index(int p_id) const;
- void poll_joysticks() const;
- void setup_joystick_objects();
+ void poll_joypads() const;
+ void setup_joypad_objects();
void config_hid_manager(CFArrayRef p_matching_array) const;
- void joystick_vibration_start(int p_id, float p_magnitude, float p_duration, uint64_t p_timestamp);
- void joystick_vibration_stop(int p_id, uint64_t p_timestamp);
+ void joypad_vibration_start(int p_id, float p_magnitude, float p_duration, uint64_t p_timestamp);
+ void joypad_vibration_stop(int p_id, uint64_t p_timestamp);
public:
- uint32_t process_joysticks(uint32_t p_last_id);
+ uint32_t process_joypads(uint32_t p_last_id);
void _device_added(IOReturn p_res, IOHIDDeviceRef p_device);
void _device_removed(int p_id);
- JoystickOSX();
- ~JoystickOSX();
+ JoypadOSX();
+ ~JoypadOSX();
};
-#endif // JOYSTICKOSX_H
+#endif // JOYPADOSX_H
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index 8c4eb28ff0..fc64c2b867 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -31,11 +31,11 @@
#include "os/input.h"
-#include "joystick_osx.h"
+#include "joypad_osx.h"
#include "drivers/unix/os_unix.h"
#include "main/input_default.h"
#include "servers/visual_server.h"
-#include "servers/visual/visual_server_wrap_mt.h"
+// #include "servers/visual/visual_server_wrap_mt.h"
#include "servers/visual/rasterizer.h"
#include "servers/physics_server.h"
#include "servers/audio/audio_server_sw.h"
@@ -58,7 +58,8 @@
class OS_OSX : public OS_Unix {
public:
bool force_quit;
- Rasterizer *rasterizer;
+// rasterizer seems to no longer be given to visual server, its using GLES3 directly?
+// Rasterizer *rasterizer;
VisualServer *visual_server;
List<String> args;
@@ -77,7 +78,7 @@ public:
SpatialSound2DServerSW *spatial_sound_2d_server;
InputDefault *input;
- JoystickOSX *joystick_osx;
+ JoypadOSX *joypad_osx;
/* objc */
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index d5b870bc7d..a66f6abba5 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -38,13 +38,14 @@
#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 <stdio.h>
#include <stdlib.h>
#include "print_string.h"
#include "servers/physics/physics_server_sw.h"
-#include "drivers/gles2/rasterizer_instance_gles2.h"
-#include "servers/visual/visual_server_wrap_mt.h"
+// #include "drivers/gles2/rasterizer_instance_gles2.h"
+// #include "servers/visual/visual_server_wrap_mt.h"
#include "main/main.h"
#include "os/keyboard.h"
#include "dir_access_osx.h"
@@ -986,13 +987,11 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
window_size.width = p_desired.width;
window_size.height = p_desired.height;
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6 && display_scale>1) {
[window_view setWantsBestResolutionOpenGLSurface:YES];
//if (current_videomode.resizable)
[window_object setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
}
-#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
// [window_object setTitle:[NSString stringWithUTF8String:"GodotEnginies"]];
[window_object setContentView:window_view];
@@ -1000,10 +999,8 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
[window_object setAcceptsMouseMovedEvents:YES];
[window_object center];
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
[window_object setRestorable:NO];
-#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
unsigned int attributeCount = 0;
@@ -1022,10 +1019,8 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
ADD_ATTR(NSOpenGLPFADoubleBuffer);
ADD_ATTR(NSOpenGLPFAClosestPolicy);
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
- if (false/* use gl3*/)
- ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core);
-#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
+// we now need OpenGL 3 or better, maybe even change this to 3_3Core ?
+ ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core);
ADD_ATTR2(NSOpenGLPFAColorSize, colorBits);
@@ -1084,15 +1079,19 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
AudioDriverManagerSW::add_driver(&audio_driver_osx);
+ // only opengl support here...
+ RasterizerGLES3::register_config();
+ RasterizerGLES3::make_current();
- rasterizer = instance_RasterizerGLES2();
-
- visual_server = memnew( VisualServerRaster(rasterizer) );
-
- if (get_render_thread_mode()!=RENDER_THREAD_UNSAFE) {
+// rasterizer = instance_RasterizerGLES2();
+// visual_server = memnew( VisualServerRaster(rasterizer) );
- visual_server =memnew(VisualServerWrapMT(visual_server,get_render_thread_mode()==RENDER_SEPARATE_THREAD));
- }
+ visual_server = memnew( VisualServerRaster );
+ // FIXME: Reimplement threaded rendering? Or remove?
+// if (get_render_thread_mode()!=RENDER_THREAD_UNSAFE) {
+//
+// visual_server =memnew(VisualServerWrapMT(visual_server,get_render_thread_mode()==RENDER_SEPARATE_THREAD));
+// }
visual_server->init();
visual_server->cursor_set_visible(false, 0);
@@ -1123,7 +1122,7 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
physics_2d_server->init();
input = memnew( InputDefault );
- joystick_osx = memnew( JoystickOSX );
+ joypad_osx = memnew( JoypadOSX );
_ensure_data_dir();
@@ -1166,7 +1165,7 @@ void OS_OSX::finalize() {
spatial_sound_2d_server->finish();
memdelete(spatial_sound_2d_server);
- memdelete(joystick_osx);
+ memdelete(joypad_osx);
memdelete(input);
memdelete(sample_manager);
@@ -1176,7 +1175,7 @@ void OS_OSX::finalize() {
visual_server->finish();
memdelete(visual_server);
- memdelete(rasterizer);
+// memdelete(rasterizer);
physics_server->finish();
memdelete(physics_server);
@@ -1328,8 +1327,8 @@ void OS_OSX::set_icon(const Image& p_icon) {
uint8_t *pixels = [imgrep bitmapData];
int len = img.get_width()*img.get_height();
- DVector<uint8_t> data = img.get_data();
- DVector<uint8_t>::Read r = data.read();
+ PoolVector<uint8_t> data = img.get_data();
+ PoolVector<uint8_t>::Read r = data.read();
/* Premultiply the alpha channel */
for (int i = 0; i<len ; i++) {
@@ -1739,7 +1738,7 @@ void OS_OSX::run() {
while (!force_quit) {
process_events(); // get rid of pending events
- last_id = joystick_osx->process_joysticks(last_id);
+ last_id = joypad_osx->process_joypads(last_id);
if (Main::iteration()==true)
break;
};
diff --git a/platform/osx/platform_config.h b/platform/osx/platform_config.h
index e3c1ee031c..834d0141a3 100644
--- a/platform/osx/platform_config.h
+++ b/platform/osx/platform_config.h
@@ -28,6 +28,5 @@
/*************************************************************************/
#include <alloca.h>
-#define GLES2_INCLUDE_H "GL/glew.h"
-#define GLES3_INCLUDE_H "GL/glew.h"
+#define GLES3_INCLUDE_H "glad/glad.h"
#define PTHREAD_RENAME_SELF
diff --git a/platform/uwp/SCsub b/platform/uwp/SCsub
index 430d4ef9e7..0167ea9e02 100644
--- a/platform/uwp/SCsub
+++ b/platform/uwp/SCsub
@@ -8,7 +8,7 @@ files = [
'#platform/windows/packet_peer_udp_winsock.cpp',
'#platform/windows/stream_peer_winsock.cpp',
'#platform/windows/key_mapping_win.cpp',
- 'joystick_uwp.cpp',
+ 'joypad_uwp.cpp',
'gl_context_egl.cpp',
'app.cpp',
'os_uwp.cpp',
diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp
index 186c509ca5..1844df5eef 100644
--- a/platform/uwp/export/export.cpp
+++ b/platform/uwp/export/export.cpp
@@ -1571,7 +1571,7 @@ Vector<uint8_t> EditorExportPlatformUWP::_fix_manifest(const Vector<uint8_t> &p_
String architecture = arch == ARM ? "ARM" : arch == X86 ? "x86" : "x64";
result = result.replace("$architecture$", architecture);
- result = result.replace("$display_name$", display_name.empty() ? (String)Globals::get_singleton()->get("application/name") : display_name);
+ result = result.replace("$display_name$", display_name.empty() ? (String)GlobalConfig::get_singleton()->get("application/name") : display_name);
result = result.replace("$publisher_display_name$", publisher_display_name);
result = result.replace("$app_description$", description);
result = result.replace("$bg_color$", background_color);
diff --git a/platform/uwp/joystick_uwp.cpp b/platform/uwp/joypad_uwp.cpp
index 8ed6473c37..7f0837d7be 100644
--- a/platform/uwp/joystick_uwp.cpp
+++ b/platform/uwp/joypad_uwp.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* joystick_uwp.cpp */
+/* joypad_uwp.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -27,20 +27,20 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "joystick_uwp.h"
+#include "joypad_uwp.h"
using namespace Windows::Gaming::Input;
using namespace Windows::Foundation;
-void JoystickUWP::register_events() {
+void JoypadUWP::register_events() {
Gamepad::GamepadAdded +=
- ref new EventHandler<Gamepad^>(this, &JoystickUWP::OnGamepadAdded);
+ ref new EventHandler<Gamepad^>(this, &JoypadUWP::OnGamepadAdded);
Gamepad::GamepadRemoved +=
- ref new EventHandler<Gamepad^>(this, &JoystickUWP::OnGamepadRemoved);
+ ref new EventHandler<Gamepad^>(this, &JoypadUWP::OnGamepadRemoved);
}
-uint32_t JoystickUWP::process_controllers(uint32_t p_last_id) {
+uint32_t JoypadUWP::process_controllers(uint32_t p_last_id) {
for (int i = 0; i < MAX_CONTROLLERS; i++) {
@@ -74,20 +74,20 @@ uint32_t JoystickUWP::process_controllers(uint32_t p_last_id) {
return p_last_id;
}
-JoystickUWP::JoystickUWP() {
+JoypadUWP::JoypadUWP() {
for (int i = 0; i < MAX_CONTROLLERS; i++)
controllers[i].id = i;
}
-JoystickUWP::JoystickUWP(InputDefault * p_input) {
+JoypadUWP::JoypadUWP(InputDefault * p_input) {
input = p_input;
- JoystickUWP();
+ JoypadUWP();
}
-void JoystickUWP::OnGamepadAdded(Platform::Object ^ sender, Windows::Gaming::Input::Gamepad ^ value) {
+void JoypadUWP::OnGamepadAdded(Platform::Object ^ sender, Windows::Gaming::Input::Gamepad ^ value) {
short idx = -1;
@@ -109,7 +109,7 @@ void JoystickUWP::OnGamepadAdded(Platform::Object ^ sender, Windows::Gaming::Inp
input->joy_connection_changed(controllers[idx].id, true, "Xbox Controller", "__UWP_GAMEPAD__");
}
-void JoystickUWP::OnGamepadRemoved(Platform::Object ^ sender, Windows::Gaming::Input::Gamepad ^ value) {
+void JoypadUWP::OnGamepadRemoved(Platform::Object ^ sender, Windows::Gaming::Input::Gamepad ^ value) {
short idx = -1;
@@ -136,7 +136,7 @@ void JoystickUWP::OnGamepadRemoved(Platform::Object ^ sender, Windows::Gaming::I
input->joy_connection_changed(idx, false, "Xbox Controller");
}
-InputDefault::JoyAxis JoystickUWP::axis_correct(double p_val, bool p_negate, bool p_trigger) const {
+InputDefault::JoyAxis JoypadUWP::axis_correct(double p_val, bool p_negate, bool p_trigger) const {
InputDefault::JoyAxis jx;
diff --git a/platform/uwp/joystick_uwp.h b/platform/uwp/joypad_uwp.h
index f854f0b471..90505b409a 100644
--- a/platform/uwp/joystick_uwp.h
+++ b/platform/uwp/joypad_uwp.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* joystick_uwp.h */
+/* joypad_uwp.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -26,20 +26,20 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef JOYSTICK_UWP_H
-#define JOYSTICK_UWP_H
+#ifndef JOYPAD_UWP_H
+#define JOYPAD_UWP_H
#include "main/input_default.h"
-ref class JoystickUWP sealed {
+ref class JoypadUWP sealed {
internal:
void register_events();
uint32_t process_controllers(uint32_t p_last_id);
- JoystickUWP();
- JoystickUWP(InputDefault* p_input);
+ JoypadUWP();
+ JoypadUWP(InputDefault* p_input);
private:
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index 387cfe579f..34977bc048 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -285,8 +285,8 @@ void OSUWP::initialize(const VideoMode& p_desired,int p_video_driver,int p_audio
input = memnew( InputDefault );
- joystick = ref new JoystickUWP(input);
- joystick->register_events();
+ joypad = ref new JoypadUWP(input);
+ joypad->register_events();
AudioDriverManagerSW::get_driver(p_audio_driver)->set_singleton();
@@ -429,7 +429,7 @@ void OSUWP::finalize() {
physics_2d_server->finish();
memdelete(physics_2d_server);
- joystick = nullptr;
+ joypad = nullptr;
}
void OSUWP::finalize_core() {
@@ -725,7 +725,7 @@ uint64_t OSUWP::get_ticks_usec() const {
void OSUWP::process_events() {
- last_id = joystick->process_controllers(last_id);
+ last_id = joypad->process_controllers(last_id);
process_key_events();
}
diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h
index c50d34aca2..82376dd2f6 100644
--- a/platform/uwp/os_uwp.h
+++ b/platform/uwp/os_uwp.h
@@ -55,7 +55,7 @@
#include <stdio.h>
#include "main/input_default.h"
-#include "joystick_uwp.h"
+#include "joypad_uwp.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
@@ -85,7 +85,7 @@ public:
private:
enum {
- JOYSTICKS_MAX = 8,
+ JOYPADS_MAX = 8,
JOY_AXIS_COUNT = 6,
MAX_JOY_AXIS = 32768, // I've no idea
KEY_EVENT_BUFFER_SIZE=512
@@ -137,7 +137,7 @@ private:
InputDefault *input;
- JoystickUWP^ joystick;
+ JoypadUWP^ joypad;
Windows::System::Display::DisplayRequest^ display_request;
diff --git a/platform/windows/SCsub b/platform/windows/SCsub
index 32c23b906a..ae8c07384f 100644
--- a/platform/windows/SCsub
+++ b/platform/windows/SCsub
@@ -11,7 +11,7 @@ common_win = [
"tcp_server_winsock.cpp",
"packet_peer_udp_winsock.cpp",
"stream_peer_winsock.cpp",
- "joystick.cpp",
+ "joypad.cpp",
]
restarget = "godot_res" + env["OBJSUFFIX"]
diff --git a/platform/windows/context_gl_win.cpp b/platform/windows/context_gl_win.cpp
index 136ac310f6..6b60ade5f0 100644
--- a/platform/windows/context_gl_win.cpp
+++ b/platform/windows/context_gl_win.cpp
@@ -40,7 +40,6 @@
//
//
-#define WINVER 0x0500
#include "context_gl_win.h"
//#include "drivers/opengl/glwrapper.h"
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 28030afa82..1f3c7a7654 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -207,6 +207,10 @@ def build_res_file(target, source, env):
def configure(env):
env.Append(CPPPATH=['#platform/windows'])
+
+ # Targeted Windows version: Vista (and later)
+ env.Append(CPPFLAGS=['-D_WIN32_WINNT=0x0600'])
+
env['is_mingw'] = False
if (os.name == "nt" and os.getenv("VCINSTALLDIR")):
# build using visual studio
@@ -315,7 +319,7 @@ def configure(env):
mingw_prefix = ""
if (env["bits"] == "default"):
- env["bits"] = "32"
+ env["bits"] = "64" if "PROGRAMFILES(X86)" in os.environ else "32"
if (env["bits"] == "32"):
env.Append(LINKFLAGS=['-static'])
diff --git a/platform/windows/joystick.cpp b/platform/windows/joypad.cpp
index 3fdf20a472..6ea23ebb28 100644
--- a/platform/windows/joystick.cpp
+++ b/platform/windows/joypad.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* joystick.cpp */
+/* joypad.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -26,8 +26,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-//author: Andreas Haas <hondres, liugam3@gmail.com>
-#include "joystick.h"
+#include "joypad.h"
#include <iostream>
#include <wbemidl.h>
#include <oleauto.h>
@@ -39,15 +38,15 @@
DWORD WINAPI _xinput_get_state(DWORD dwUserIndex, XINPUT_STATE* pState) { return ERROR_DEVICE_NOT_CONNECTED; }
DWORD WINAPI _xinput_set_state(DWORD dwUserIndex, XINPUT_VIBRATION* pVibration) { return ERROR_DEVICE_NOT_CONNECTED; }
-joystick_windows::joystick_windows() {
+JoypadWindows::JoypadWindows() {
}
-joystick_windows::joystick_windows(InputDefault* _input, HWND* hwnd) {
+JoypadWindows::JoypadWindows(InputDefault* _input, HWND* hwnd) {
input = _input;
hWnd = hwnd;
- joystick_count = 0;
+ joypad_count = 0;
dinput = NULL;
xinput_dll = NULL;
xinput_get_state = NULL;
@@ -55,8 +54,8 @@ joystick_windows::joystick_windows(InputDefault* _input, HWND* hwnd) {
load_xinput();
- for (int i = 0; i < JOYSTICKS_MAX; i++)
- attached_joysticks[i] = false;
+ for (int i = 0; i < JOYPADS_MAX; i++)
+ attached_joypads[i] = false;
HRESULT result;
@@ -64,35 +63,35 @@ joystick_windows::joystick_windows(InputDefault* _input, HWND* hwnd) {
if (FAILED(result)) {
printf("failed init DINPUT: %ld\n", result);
}
- probe_joysticks();
+ probe_joypads();
}
-joystick_windows::~joystick_windows() {
+JoypadWindows::~JoypadWindows() {
- close_joystick();
+ close_joypad();
dinput->Release();
unload_xinput();
}
-bool joystick_windows::have_device(const GUID &p_guid) {
+bool JoypadWindows::have_device(const GUID &p_guid) {
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
- if (d_joysticks[i].guid == p_guid) {
+ if (d_joypads[i].guid == p_guid) {
- d_joysticks[i].confirmed = true;
+ d_joypads[i].confirmed = true;
return true;
}
}
return false;
}
-int joystick_windows::check_free_joy_slot() const {
+int JoypadWindows::check_free_joy_slot() const {
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
- if (!attached_joysticks[i])
+ if (!attached_joypads[i])
return i;
}
return -1;
@@ -100,7 +99,7 @@ int joystick_windows::check_free_joy_slot() const {
// adapted from SDL2, works a lot better than the MSDN version
-bool joystick_windows::is_xinput_device(const GUID *p_guid) {
+bool JoypadWindows::is_xinput_device(const GUID *p_guid) {
static GUID IID_ValveStreamingGamepad = { MAKELONG(0x28DE, 0x11FF), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } };
static GUID IID_X360WiredGamepad = { MAKELONG(0x045E, 0x02A1), 0x0000, 0x0000, { 0x00, 0x00, 0x50, 0x49, 0x44, 0x56, 0x49, 0x44 } };
@@ -144,7 +143,7 @@ bool joystick_windows::is_xinput_device(const GUID *p_guid) {
return false;
}
-bool joystick_windows::setup_dinput_joystick(const DIDEVICEINSTANCE* instance) {
+bool JoypadWindows::setup_dinput_joypad(const DIDEVICEINSTANCE* instance) {
HRESULT hr;
int num = check_free_joy_slot();
@@ -152,8 +151,8 @@ bool joystick_windows::setup_dinput_joystick(const DIDEVICEINSTANCE* instance) {
if (have_device(instance->guidInstance) || num == -1)
return false;
- d_joysticks[joystick_count] = dinput_gamepad();
- dinput_gamepad* joy = &d_joysticks[joystick_count];
+ d_joypads[joypad_count] = dinput_gamepad();
+ dinput_gamepad* joy = &d_joypads[joypad_count];
const DWORD devtype = (instance->dwDevType & 0xFF);
@@ -177,7 +176,7 @@ bool joystick_windows::setup_dinput_joystick(const DIDEVICEINSTANCE* instance) {
guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
- id_to_change = joystick_count;
+ id_to_change = joypad_count;
joy->di_joy->SetDataFormat(&c_dfDIJoystick2);
joy->di_joy->SetCooperativeLevel(*hWnd, DISCL_FOREGROUND);
@@ -188,13 +187,13 @@ bool joystick_windows::setup_dinput_joystick(const DIDEVICEINSTANCE* instance) {
input->joy_connection_changed(num, true, instance->tszProductName, uid);
joy->attached = true;
joy->id = num;
- attached_joysticks[num] = true;
+ attached_joypads[num] = true;
joy->confirmed = true;
- joystick_count++;
+ joypad_count++;
return true;
}
-void joystick_windows::setup_joystick_object(const DIDEVICEOBJECTINSTANCE *ob, int p_joy_id) {
+void JoypadWindows::setup_joypad_object(const DIDEVICEOBJECTINSTANCE *ob, int p_joy_id) {
if (ob->dwType & DIDFT_AXIS) {
@@ -225,7 +224,7 @@ void joystick_windows::setup_joystick_object(const DIDEVICEOBJECTINSTANCE *ob, i
prop_range.lMin = -MAX_JOY_AXIS;
prop_range.lMax = +MAX_JOY_AXIS;
- dinput_gamepad &joy = d_joysticks[p_joy_id];
+ dinput_gamepad &joy = d_joypads[p_joy_id];
res = IDirectInputDevice8_SetProperty(joy.di_joy, DIPROP_RANGE, &prop_range.diph);
@@ -246,100 +245,100 @@ void joystick_windows::setup_joystick_object(const DIDEVICEOBJECTINSTANCE *ob, i
}
}
-BOOL CALLBACK joystick_windows::enumCallback(const DIDEVICEINSTANCE* instance, void* pContext) {
+BOOL CALLBACK JoypadWindows::enumCallback(const DIDEVICEINSTANCE* instance, void* pContext) {
- joystick_windows* self = (joystick_windows*)pContext;
+ JoypadWindows* self = (JoypadWindows*)pContext;
if (self->is_xinput_device(&instance->guidProduct)) {;
return DIENUM_CONTINUE;
}
- self->setup_dinput_joystick(instance);
+ self->setup_dinput_joypad(instance);
return DIENUM_CONTINUE;
}
-BOOL CALLBACK joystick_windows::objectsCallback(const DIDEVICEOBJECTINSTANCE *instance, void *context) {
+BOOL CALLBACK JoypadWindows::objectsCallback(const DIDEVICEOBJECTINSTANCE *instance, void *context) {
- joystick_windows* self = (joystick_windows*)context;
- self->setup_joystick_object(instance, self->id_to_change);
+ JoypadWindows* self = (JoypadWindows*)context;
+ self->setup_joypad_object(instance, self->id_to_change);
return DIENUM_CONTINUE;
}
-void joystick_windows::close_joystick(int id) {
+void JoypadWindows::close_joypad(int id) {
if (id == -1) {
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
- close_joystick(i);
+ close_joypad(i);
}
return;
}
- if (!d_joysticks[id].attached) return;
+ if (!d_joypads[id].attached) return;
- d_joysticks[id].di_joy->Unacquire();
- d_joysticks[id].di_joy->Release();
- d_joysticks[id].attached = false;
- attached_joysticks[d_joysticks[id].id] = false;
- d_joysticks[id].guid.Data1 = d_joysticks[id].guid.Data2 = d_joysticks[id].guid.Data3 = 0;
- input->joy_connection_changed(d_joysticks[id].id, false, "");
- joystick_count--;
+ d_joypads[id].di_joy->Unacquire();
+ d_joypads[id].di_joy->Release();
+ d_joypads[id].attached = false;
+ attached_joypads[d_joypads[id].id] = false;
+ d_joypads[id].guid.Data1 = d_joypads[id].guid.Data2 = d_joypads[id].guid.Data3 = 0;
+ input->joy_connection_changed(d_joypads[id].id, false, "");
+ joypad_count--;
}
-void joystick_windows::probe_joysticks() {
+void JoypadWindows::probe_joypads() {
DWORD dwResult;
for (DWORD i = 0; i < XUSER_MAX_COUNT; i++) {
- ZeroMemory(&x_joysticks[i].state, sizeof(XINPUT_STATE));
+ ZeroMemory(&x_joypads[i].state, sizeof(XINPUT_STATE));
- dwResult = xinput_get_state(i, &x_joysticks[i].state);
+ dwResult = xinput_get_state(i, &x_joypads[i].state);
if ( dwResult == ERROR_SUCCESS) {
int id = check_free_joy_slot();
- if (id != -1 && !x_joysticks[i].attached) {
-
- x_joysticks[i].attached = true;
- x_joysticks[i].id = id;
- x_joysticks[i].ff_timestamp = 0;
- x_joysticks[i].ff_end_timestamp = 0;
- x_joysticks[i].vibrating = false;
- attached_joysticks[id] = true;
+ if (id != -1 && !x_joypads[i].attached) {
+
+ x_joypads[i].attached = true;
+ x_joypads[i].id = id;
+ x_joypads[i].ff_timestamp = 0;
+ x_joypads[i].ff_end_timestamp = 0;
+ x_joypads[i].vibrating = false;
+ attached_joypads[id] = true;
input->joy_connection_changed(id, true, "XInput Gamepad","__XINPUT_DEVICE__");
}
}
- else if (x_joysticks[i].attached) {
+ else if (x_joypads[i].attached) {
- x_joysticks[i].attached = false;
- attached_joysticks[x_joysticks[i].id] = false;
- input->joy_connection_changed(x_joysticks[i].id, false, "");
+ x_joypads[i].attached = false;
+ attached_joypads[x_joypads[i].id] = false;
+ input->joy_connection_changed(x_joypads[i].id, false, "");
}
}
- for (int i = 0; i < joystick_count; i++) {
+ for (int i = 0; i < joypad_count; i++) {
- d_joysticks[i].confirmed = false;
+ d_joypads[i].confirmed = false;
}
dinput->EnumDevices(DI8DEVCLASS_GAMECTRL, enumCallback, this, DIEDFL_ATTACHEDONLY);
- for (int i = 0; i < joystick_count; i++) {
+ for (int i = 0; i < joypad_count; i++) {
- if (!d_joysticks[i].confirmed) {
+ if (!d_joypads[i].confirmed) {
- close_joystick(i);
+ close_joypad(i);
}
}
}
-unsigned int joystick_windows::process_joysticks(unsigned int p_last_id) {
+unsigned int JoypadWindows::process_joypads(unsigned int p_last_id) {
HRESULT hr;
for (int i = 0; i < XUSER_MAX_COUNT; i++) {
- xinput_gamepad &joy = x_joysticks[i];
+ xinput_gamepad &joy = x_joypads[i];
if (!joy.attached) {
continue;
}
@@ -368,20 +367,20 @@ unsigned int joystick_windows::process_joysticks(unsigned int p_last_id) {
Vector2 strength = input->get_joy_vibration_strength(joy.id);
float duration = input->get_joy_vibration_duration(joy.id);
if (strength.x == 0 && strength.y == 0) {
- joystick_vibration_stop_xinput(i, timestamp);
+ joypad_vibration_stop_xinput(i, timestamp);
} else {
- joystick_vibration_start_xinput(i, strength.x, strength.y, duration, timestamp);
+ joypad_vibration_start_xinput(i, strength.x, strength.y, duration, timestamp);
}
} else if (joy.vibrating && joy.ff_end_timestamp != 0) {
uint64_t current_time = OS::get_singleton()->get_ticks_usec();
if (current_time >= joy.ff_end_timestamp)
- joystick_vibration_stop_xinput(i, current_time);
+ joypad_vibration_stop_xinput(i, current_time);
}
}
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
- dinput_gamepad* joy = &d_joysticks[i];
+ dinput_gamepad* joy = &d_joypads[i];
if (!joy->attached)
continue;
@@ -438,7 +437,7 @@ unsigned int joystick_windows::process_joysticks(unsigned int p_last_id) {
return p_last_id;
}
-unsigned int joystick_windows::post_hat(unsigned int p_last_id, int p_device, DWORD p_dpad) {
+unsigned int JoypadWindows::post_hat(unsigned int p_last_id, int p_device, DWORD p_dpad) {
int dpad_val = 0;
@@ -487,7 +486,7 @@ unsigned int joystick_windows::post_hat(unsigned int p_last_id, int p_device, DW
return input->joy_hat(p_last_id, p_device, dpad_val);
};
-InputDefault::JoyAxis joystick_windows::axis_correct(int p_val, bool p_xinput, bool p_trigger, bool p_negate) const {
+InputDefault::JoyAxis JoypadWindows::axis_correct(int p_val, bool p_xinput, bool p_trigger, bool p_negate) const {
InputDefault::JoyAxis jx;
if (Math::abs(p_val) < MIN_JOY_AXIS) {
@@ -519,8 +518,8 @@ InputDefault::JoyAxis joystick_windows::axis_correct(int p_val, bool p_xinput, b
return jx;
}
-void joystick_windows::joystick_vibration_start_xinput(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp) {
- xinput_gamepad &joy = x_joysticks[p_device];
+void JoypadWindows::joypad_vibration_start_xinput(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp) {
+ xinput_gamepad &joy = x_joypads[p_device];
if (joy.attached) {
XINPUT_VIBRATION effect;
effect.wLeftMotorSpeed = (65535 * p_strong_magnitude);
@@ -533,8 +532,8 @@ void joystick_windows::joystick_vibration_start_xinput(int p_device, float p_wea
}
}
-void joystick_windows::joystick_vibration_stop_xinput(int p_device, uint64_t p_timestamp) {
- xinput_gamepad &joy = x_joysticks[p_device];
+void JoypadWindows::joypad_vibration_stop_xinput(int p_device, uint64_t p_timestamp) {
+ xinput_gamepad &joy = x_joypads[p_device];
if (joy.attached) {
XINPUT_VIBRATION effect;
effect.wLeftMotorSpeed = 0;
@@ -547,7 +546,7 @@ void joystick_windows::joystick_vibration_stop_xinput(int p_device, uint64_t p_t
}
-void joystick_windows::load_xinput() {
+void JoypadWindows::load_xinput() {
xinput_get_state = &_xinput_get_state;
xinput_set_state = &_xinput_set_state;
@@ -576,7 +575,7 @@ void joystick_windows::load_xinput() {
xinput_set_state = set_func;
}
-void joystick_windows::unload_xinput() {
+void JoypadWindows::unload_xinput() {
if (xinput_dll) {
diff --git a/platform/windows/joystick.h b/platform/windows/joypad.h
index 6de05bf108..63eee8c015 100644
--- a/platform/windows/joystick.h
+++ b/platform/windows/joypad.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* joystick.h */
+/* joypad.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -26,9 +26,8 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-//author: Andreas Haas <hondres, liugam3@gmail.com>
-#ifndef JOYSTICK_H
-#define JOYSTICK_H
+#ifndef JOYPAD_H
+#define JOYPAD_H
#include "os_windows.h"
#define DIRECTINPUT_VERSION 0x0800
@@ -48,19 +47,19 @@ if(x != NULL) \
#define XUSER_MAX_COUNT 4
#endif
-class joystick_windows
+class JoypadWindows
{
public:
- joystick_windows();
- joystick_windows(InputDefault* _input, HWND* hwnd);
- ~joystick_windows();
+ JoypadWindows();
+ JoypadWindows(InputDefault* _input, HWND* hwnd);
+ ~JoypadWindows();
- void probe_joysticks();
- unsigned int process_joysticks(unsigned int p_last_id);
+ void probe_joypads();
+ unsigned int process_joypads(unsigned int p_last_id);
private:
enum {
- JOYSTICKS_MAX = 16,
+ JOYPADS_MAX = 16,
JOY_AXIS_COUNT = 6,
MIN_JOY_AXIS = 10,
MAX_JOY_AXIS = 32768,
@@ -120,16 +119,16 @@ private:
InputDefault* input;
int id_to_change;
- int joystick_count;
- bool attached_joysticks[JOYSTICKS_MAX];
- dinput_gamepad d_joysticks[JOYSTICKS_MAX];
- xinput_gamepad x_joysticks[XUSER_MAX_COUNT];
+ int joypad_count;
+ bool attached_joypads[JOYPADS_MAX];
+ dinput_gamepad d_joypads[JOYPADS_MAX];
+ xinput_gamepad x_joypads[XUSER_MAX_COUNT];
static BOOL CALLBACK enumCallback(const DIDEVICEINSTANCE* p_instance, void* p_context);
static BOOL CALLBACK objectsCallback(const DIDEVICEOBJECTINSTANCE* instance, void* context);
- void setup_joystick_object(const DIDEVICEOBJECTINSTANCE* ob, int p_joy_id);
- void close_joystick(int id = -1);
+ void setup_joypad_object(const DIDEVICEOBJECTINSTANCE* ob, int p_joy_id);
+ void close_joypad(int id = -1);
void load_xinput();
void unload_xinput();
@@ -138,9 +137,9 @@ private:
bool have_device(const GUID &p_guid);
bool is_xinput_device(const GUID* p_guid);
- bool setup_dinput_joystick(const DIDEVICEINSTANCE* instance);
- void joystick_vibration_start_xinput(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp);
- void joystick_vibration_stop_xinput(int p_device, uint64_t p_timestamp);
+ bool setup_dinput_joypad(const DIDEVICEINSTANCE* instance);
+ void joypad_vibration_start_xinput(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp);
+ void joypad_vibration_stop_xinput(int p_device, uint64_t p_timestamp);
InputDefault::JoyAxis axis_correct(int p_val, bool p_xinput = false, bool p_trigger = false, bool p_negate = false) const;
XInputGetState_t xinput_get_state;
diff --git a/platform/windows/key_mapping_win.cpp b/platform/windows/key_mapping_win.cpp
index 00a0ca79c7..9ab222e9ee 100644
--- a/platform/windows/key_mapping_win.cpp
+++ b/platform/windows/key_mapping_win.cpp
@@ -26,8 +26,8 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#define WINVER 0x0500
#include "key_mapping_win.h"
+
#include <stdio.h>
struct _WinTranslatePair {
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 445f4fc328..6256cb58e0 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -30,11 +30,11 @@
#include "os_windows.h"
#include "drivers/gles3/rasterizer_gles3.h"
-#include "drivers/unix/memory_pool_static_malloc.h"
-#include "os/memory_pool_dynamic_static.h"
+
#include "drivers/windows/thread_windows.h"
#include "drivers/windows/semaphore_windows.h"
#include "drivers/windows/mutex_windows.h"
+#include "drivers/windows/rw_lock_windows.h"
#include "main/main.h"
#include "drivers/windows/file_access_windows.h"
#include "drivers/windows/dir_access_windows.h"
@@ -48,10 +48,10 @@
#include "packet_peer_udp_winsock.h"
#include "stream_peer_winsock.h"
#include "lang_table.h"
-#include "os/memory_pool_dynamic_prealloc.h"
+
#include "globals.h"
#include "io/marshalls.h"
-#include "joystick.h"
+#include "joypad.h"
#include "shlobj.h"
#include <regstr.h>
@@ -167,8 +167,6 @@ const char * OS_Windows::get_audio_driver_name(int p_driver) const {
return AudioDriverManagerSW::get_driver(p_driver)->get_name();
}
-static MemoryPoolStatic *mempool_static=NULL;
-static MemoryPoolDynamic *mempool_dynamic=NULL;
void OS_Windows::initialize_core() {
@@ -183,6 +181,7 @@ void OS_Windows::initialize_core() {
ThreadWindows::make_default();
SemaphoreWindows::make_default();
MutexWindows::make_default();
+ RWLockWindows::make_default();
FileAccess::make_default<FileAccessWindows>(FileAccess::ACCESS_RESOURCES);
FileAccess::make_default<FileAccessWindows>(FileAccess::ACCESS_USERDATA);
@@ -196,15 +195,6 @@ void OS_Windows::initialize_core() {
StreamPeerWinsock::make_default();
PacketPeerUDPWinsock::make_default();
- mempool_static = new MemoryPoolStaticMalloc;
-#if 1
- mempool_dynamic = memnew( MemoryPoolDynamicStatic );
-#else
-#define DYNPOOL_SIZE 4*1024*1024
- void * buffer = malloc( DYNPOOL_SIZE );
- mempool_dynamic = memnew( MemoryPoolDynamicPrealloc(buffer,DYNPOOL_SIZE) );
-
-#endif
// We need to know how often the clock is updated
if( !QueryPerformanceFrequency((LARGE_INTEGER *)&ticks_per_second) )
@@ -687,7 +677,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
print_line("input lang change");
} break;
- #if WINVER >= 0x0700 // for windows 7
+ #if WINVER >= 0x0601 // for windows 7
case WM_TOUCH: {
BOOL bHandled = FALSE;
@@ -724,7 +714,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
#endif
case WM_DEVICECHANGE: {
- joystick->probe_joysticks();
+ joypad->probe_joypads();
} break;
case WM_SETCURSOR: {
@@ -1087,13 +1077,15 @@ void OS_Windows::initialize(const VideoMode& p_desired,int p_video_driver,int p_
RasterizerGLES3::make_current();
#else
- #ifdef DX9_ENABLED
+ // FIXME: Does DX support still work now that rasterizer is no longer used?
+#ifdef DX9_ENABLED
rasterizer = memnew( RasterizerDX9(hWnd) );
- #endif
+#endif
#endif
visual_server = memnew( VisualServerRaster );
- //if (get_render_thread_mode()!=RENDER_THREAD_UNSAFE) {
+ // FIXME: Reimplement threaded rendering? Or remove?
+// if (get_render_thread_mode()!=RENDER_THREAD_UNSAFE) {
//
// visual_server =memnew(VisualServerWrapMT(visual_server,get_render_thread_mode()==RENDER_SEPARATE_THREAD));
// }
@@ -1128,7 +1120,7 @@ void OS_Windows::initialize(const VideoMode& p_desired,int p_video_driver,int p_
visual_server->init();
input = memnew( InputDefault );
- joystick = memnew (joystick_windows(input, &hWnd));
+ joypad = memnew (JoypadWindows(input, &hWnd));
AudioDriverManagerSW::get_driver(p_audio_driver)->set_singleton();
@@ -1261,7 +1253,7 @@ void OS_Windows::finalize() {
main_loop=NULL;
- memdelete(joystick);
+ memdelete(joypad);
memdelete(input);
visual_server->finish();
@@ -1304,10 +1296,6 @@ void OS_Windows::finalize_core() {
memdelete(process_map);
- if (mempool_dynamic)
- memdelete( mempool_dynamic );
- delete mempool_static;
-
TCPServerWinsock::cleanup();
StreamPeerWinsock::cleanup();
@@ -1940,7 +1928,7 @@ void OS_Windows::process_events() {
MSG msg;
- last_id = joystick->process_joysticks(last_id);
+ last_id = joypad->process_joypads(last_id);
while(PeekMessageW(&msg,NULL,0,0,PM_REMOVE)) {
@@ -2128,7 +2116,7 @@ void OS_Windows::set_icon(const Image& p_icon) {
encode_uint32(0,&icon_bmp[36]);
uint8_t *wr=&icon_bmp[40];
- DVector<uint8_t>::Read r= icon.get_data().read();
+ PoolVector<uint8_t>::Read r= icon.get_data().read();
for(int i=0;i<h;i++) {
@@ -2382,7 +2370,7 @@ String OS_Windows::get_data_dir() const {
if (has_environment("APPDATA")) {
- bool use_godot = Globals::get_singleton()->get("application/use_shared_user_dir");
+ bool use_godot = GlobalConfig::get_singleton()->get("application/use_shared_user_dir");
if (!use_godot)
return (OS::get_singleton()->get_environment("APPDATA")+"/"+an).replace("\\","/");
else
@@ -2390,7 +2378,7 @@ String OS_Windows::get_data_dir() const {
}
}
- return Globals::get_singleton()->get_resource_path();
+ return GlobalConfig::get_singleton()->get_resource_path();
}
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 19367c758b..7ca89e6366 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -29,8 +29,6 @@
#ifndef OS_WINDOWS_H
#define OS_WINDOWS_H
-#define WINVER 0x0600
-
#include "os/input.h"
#include "os/os.h"
#include "context_gl_win.h"
@@ -63,7 +61,7 @@
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
-class joystick_windows;
+class JoypadWindows;
class OS_Windows : public OS {
enum {
@@ -135,7 +133,7 @@ class OS_Windows : public OS {
CursorShape cursor_shape;
InputDefault *input;
- joystick_windows *joystick;
+ JoypadWindows *joypad;
#ifdef RTAUDIO_ENABLED
AudioDriverRtAudio driver_rtaudio;
diff --git a/platform/windows/platform_config.h b/platform/windows/platform_config.h
index 19885c4afb..0e16753156 100644
--- a/platform/windows/platform_config.h
+++ b/platform/windows/platform_config.h
@@ -30,5 +30,4 @@
//#else
//#include <alloca.h>
//#endif
-//#define GLES2_INCLUDE_H "GL/glew.h"
-#define GLES3_INCLUDE_H "gl_context/glad/glad.h"
+#define GLES3_INCLUDE_H "glad/glad.h"
diff --git a/platform/x11/SCsub b/platform/x11/SCsub
index 0defd4f025..4ae8ac07f7 100644
--- a/platform/x11/SCsub
+++ b/platform/x11/SCsub
@@ -7,7 +7,7 @@ common_x11 = [\
"context_gl_x11.cpp",\
"os_x11.cpp",\
"key_mapping_x11.cpp",\
- "joystick_linux.cpp",\
+ "joypad_linux.cpp",\
]
env.Program('#bin/godot', ['godot_x11.cpp'] + common_x11)
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index 19884feaa8..b5f6359d21 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -139,6 +139,13 @@ def configure(env):
if (env['builtin_libwebp'] == 'no'):
env.ParseConfig('pkg-config libwebp --cflags --libs')
+ # freetype depends on libpng and zlib, so bundling one of them while keeping others
+ # as shared libraries leads to weird issues
+ if (env['builtin_freetype'] == 'yes' or env['builtin_libpng'] == 'yes' or env['builtin_zlib'] == 'yes'):
+ env['builtin_freetype'] = 'yes'
+ env['builtin_libpng'] = 'yes'
+ env['builtin_zlib'] = 'yes'
+
if (env['builtin_freetype'] == 'no'):
env.ParseConfig('pkg-config freetype2 --cflags --libs')
@@ -175,9 +182,6 @@ def configure(env):
env.Append(CPPFLAGS=['-DOPENGL_ENABLED'])
- if (env['builtin_glew'] == 'no'):
- env.ParseConfig('pkg-config glew --cflags --libs')
-
if os.system("pkg-config --exists alsa") == 0:
print("Enabling ALSA")
env.Append(CPPFLAGS=["-DALSA_ENABLED"])
@@ -206,10 +210,14 @@ def configure(env):
else:
print("PulseAudio development libraries not found, disabling driver")
+ if (env['builtin_zlib'] == 'no'):
+ env.ParseConfig('pkg-config zlib --cflags --libs')
+
env.Append(CPPFLAGS=['-DX11_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DGLES_OVER_GL'])
- env.Append(LIBS=['GL', 'pthread', 'z'])
+ env.Append(LIBS=['GL', 'pthread'])
+
if (platform.system() == "Linux"):
- env.Append(LIBS='dl')
+ env.Append(LIBS=['dl'])
# env.Append(CPPFLAGS=['-DMPC_FIXED_POINT'])
# host compiler is default..
diff --git a/platform/x11/joystick_linux.cpp b/platform/x11/joypad_linux.cpp
index d101a725ad..362999661e 100644
--- a/platform/x11/joystick_linux.cpp
+++ b/platform/x11/joypad_linux.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* joystick_linux.cpp */
+/* joypad_linux.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -27,10 +27,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-//author: Andreas Haas <hondres, liugam3@gmail.com>
#ifdef JOYDEV_ENABLED
-#include "joystick_linux.h"
+#include "joypad_linux.h"
#include <linux/input.h>
#include <unistd.h>
@@ -49,7 +48,7 @@
static const char* ignore_str = "/dev/input/js";
#endif
-joystick_linux::Joystick::Joystick() {
+JoypadLinux::Joypad::Joypad() {
fd = -1;
dpad = 0;
devpath = "";
@@ -58,7 +57,7 @@ joystick_linux::Joystick::Joystick() {
}
}
-joystick_linux::Joystick::~Joystick() {
+JoypadLinux::Joypad::~Joypad() {
for (int i = 0; i < MAX_ABS; i++) {
if (abs_info[i]) {
@@ -67,7 +66,7 @@ joystick_linux::Joystick::~Joystick() {
}
}
-void joystick_linux::Joystick::reset() {
+void JoypadLinux::Joypad::reset() {
dpad = 0;
fd = -1;
@@ -80,7 +79,7 @@ void joystick_linux::Joystick::reset() {
}
}
-joystick_linux::joystick_linux(InputDefault *in)
+JoypadLinux::JoypadLinux(InputDefault *in)
{
exit_udev = false;
input = in;
@@ -88,37 +87,37 @@ joystick_linux::joystick_linux(InputDefault *in)
joy_thread = Thread::create(joy_thread_func, this);
}
-joystick_linux::~joystick_linux() {
+JoypadLinux::~JoypadLinux() {
exit_udev = true;
Thread::wait_to_finish(joy_thread);
memdelete(joy_thread);
memdelete(joy_mutex);
- close_joystick();
+ close_joypad();
}
-void joystick_linux::joy_thread_func(void *p_user) {
+void JoypadLinux::joy_thread_func(void *p_user) {
if (p_user) {
- joystick_linux* joy = (joystick_linux*) p_user;
- joy->run_joystick_thread();
+ JoypadLinux* joy = (JoypadLinux*) p_user;
+ joy->run_joypad_thread();
}
return;
}
-void joystick_linux::run_joystick_thread() {
+void JoypadLinux::run_joypad_thread() {
#ifdef UDEV_ENABLED
udev *_udev = udev_new();
ERR_FAIL_COND(!_udev);
- enumerate_joysticks(_udev);
- monitor_joysticks(_udev);
+ enumerate_joypads(_udev);
+ monitor_joypads(_udev);
udev_unref(_udev);
#else
- monitor_joysticks();
+ monitor_joypads();
#endif
}
#ifdef UDEV_ENABLED
-void joystick_linux::enumerate_joysticks(udev *p_udev) {
+void JoypadLinux::enumerate_joypads(udev *p_udev) {
udev_enumerate *enumerate;
udev_list_entry *devices, *dev_list_entry;
@@ -126,7 +125,7 @@ void joystick_linux::enumerate_joysticks(udev *p_udev) {
enumerate = udev_enumerate_new(p_udev);
udev_enumerate_add_match_subsystem(enumerate,"input");
- udev_enumerate_add_match_property(enumerate, "ID_INPUT_JOYSTICK", "1");
+ udev_enumerate_add_match_property(enumerate, "ID_INPUT_JOYPAD", "1");
udev_enumerate_scan_devices(enumerate);
devices = udev_enumerate_get_list_entry(enumerate);
@@ -141,7 +140,7 @@ void joystick_linux::enumerate_joysticks(udev *p_udev) {
String devnode_str = devnode;
if (devnode_str.find(ignore_str) == -1) {
joy_mutex->lock();
- open_joystick(devnode);
+ open_joypad(devnode);
joy_mutex->unlock();
}
}
@@ -150,7 +149,7 @@ void joystick_linux::enumerate_joysticks(udev *p_udev) {
udev_enumerate_unref(enumerate);
}
-void joystick_linux::monitor_joysticks(udev *p_udev) {
+void JoypadLinux::monitor_joypads(udev *p_udev) {
udev_device *dev = NULL;
udev_monitor *mon = udev_monitor_new_from_netlink(p_udev, "udev");
@@ -188,9 +187,9 @@ void joystick_linux::monitor_joysticks(udev *p_udev) {
if (devnode_str.find(ignore_str) == -1) {
if (action == "add")
- open_joystick(devnode);
+ open_joypad(devnode);
else if (String(action) == "remove")
- close_joystick(get_joy_from_path(devnode));
+ close_joypad(get_joy_from_path(devnode));
}
}
@@ -204,7 +203,7 @@ void joystick_linux::monitor_joysticks(udev *p_udev) {
}
#endif
-void joystick_linux::monitor_joysticks() {
+void JoypadLinux::monitor_joypads() {
while (!exit_udev) {
joy_mutex->lock();
@@ -212,7 +211,7 @@ void joystick_linux::monitor_joysticks() {
char fname[64];
sprintf(fname, "/dev/input/event%d", i);
if (attached_devices.find(fname) == -1) {
- open_joystick(fname);
+ open_joypad(fname);
}
}
joy_mutex->unlock();
@@ -220,37 +219,37 @@ void joystick_linux::monitor_joysticks() {
}
}
-int joystick_linux::get_free_joy_slot() const {
+int JoypadLinux::get_free_joy_slot() const {
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
- if (joysticks[i].fd == -1) return i;
+ if (joypads[i].fd == -1) return i;
}
return -1;
}
-int joystick_linux::get_joy_from_path(String p_path) const {
+int JoypadLinux::get_joy_from_path(String p_path) const {
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
- if (joysticks[i].devpath == p_path) {
+ if (joypads[i].devpath == p_path) {
return i;
}
}
return -2;
}
-void joystick_linux::close_joystick(int p_id) {
+void JoypadLinux::close_joypad(int p_id) {
if (p_id == -1) {
- for (int i=0; i<JOYSTICKS_MAX; i++) {
+ for (int i=0; i<JOYPADS_MAX; i++) {
- close_joystick(i);
+ close_joypad(i);
};
return;
}
else if (p_id < 0) return;
- Joystick &joy = joysticks[p_id];
+ Joypad &joy = joypads[p_id];
if (joy.fd != -1) {
@@ -273,9 +272,9 @@ static String _hex_str(uint8_t p_byte) {
return ret;
}
-void joystick_linux::setup_joystick_properties(int p_id) {
+void JoypadLinux::setup_joypad_properties(int p_id) {
- Joystick* joy = &joysticks[p_id];
+ Joypad* joy = &joypads[p_id];
unsigned long keybit[NBITS(KEY_MAX)] = { 0 };
unsigned long absbit[NBITS(ABS_MAX)] = { 0 };
@@ -328,7 +327,7 @@ void joystick_linux::setup_joystick_properties(int p_id) {
}
}
-void joystick_linux::open_joystick(const char *p_path) {
+void JoypadLinux::open_joypad(const char *p_path) {
int joy_num = get_free_joy_slot();
int fd = open(p_path, O_RDWR | O_NONBLOCK);
@@ -349,7 +348,7 @@ void joystick_linux::open_joystick(const char *p_path) {
}
//check if the device supports basic gamepad events, prevents certain keyboards from
- //being detected as joysticks
+ //being detected as joypads
if (!(test_bit(EV_KEY, evbit) && test_bit(EV_ABS, evbit) &&
(test_bit(ABS_X, absbit) || test_bit(ABS_Y, absbit) || test_bit(ABS_HAT0X, absbit) ||
test_bit(ABS_GAS, absbit) || test_bit(ABS_RUDDER, absbit)) &&
@@ -372,12 +371,12 @@ void joystick_linux::open_joystick(const char *p_path) {
return;
}
- joysticks[joy_num].reset();
+ joypads[joy_num].reset();
- Joystick &joy = joysticks[joy_num];
+ Joypad &joy = joypads[joy_num];
joy.fd = fd;
joy.devpath = String(p_path);
- setup_joystick_properties(joy_num);
+ setup_joypad_properties(joy_num);
sprintf(uid, "%04x%04x", __bswap_16(inpid.bustype), 0);
if (inpid.vendor && inpid.product && inpid.version) {
@@ -401,14 +400,14 @@ void joystick_linux::open_joystick(const char *p_path) {
}
}
-void joystick_linux::joystick_vibration_start(int p_id, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp)
+void JoypadLinux::joypad_vibration_start(int p_id, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp)
{
- Joystick& joy = joysticks[p_id];
+ Joypad& joy = joypads[p_id];
if (!joy.force_feedback || joy.fd == -1 || p_weak_magnitude < 0.f || p_weak_magnitude > 1.f || p_strong_magnitude < 0.f || p_strong_magnitude > 1.f) {
return;
}
if (joy.ff_effect_id != -1) {
- joystick_vibration_stop(p_id, p_timestamp);
+ joypad_vibration_stop(p_id, p_timestamp);
}
struct ff_effect effect;
@@ -433,9 +432,9 @@ void joystick_linux::joystick_vibration_start(int p_id, float p_weak_magnitude,
joy.ff_effect_timestamp = p_timestamp;
}
-void joystick_linux::joystick_vibration_stop(int p_id, uint64_t p_timestamp)
+void JoypadLinux::joypad_vibration_stop(int p_id, uint64_t p_timestamp)
{
- Joystick& joy = joysticks[p_id];
+ Joypad& joy = joypads[p_id];
if (!joy.force_feedback || joy.fd == -1 || joy.ff_effect_id == -1) {
return;
}
@@ -448,7 +447,7 @@ void joystick_linux::joystick_vibration_stop(int p_id, uint64_t p_timestamp)
joy.ff_effect_timestamp = p_timestamp;
}
-InputDefault::JoyAxis joystick_linux::axis_correct(const input_absinfo *p_abs, int p_value) const {
+InputDefault::JoyAxis JoypadLinux::axis_correct(const input_absinfo *p_abs, int p_value) const {
int min = p_abs->minimum;
int max = p_abs->maximum;
@@ -468,17 +467,17 @@ InputDefault::JoyAxis joystick_linux::axis_correct(const input_absinfo *p_abs, i
return jx;
}
-uint32_t joystick_linux::process_joysticks(uint32_t p_event_id) {
+uint32_t JoypadLinux::process_joypads(uint32_t p_event_id) {
if (joy_mutex->try_lock() != OK) {
return p_event_id;
}
- for (int i=0; i<JOYSTICKS_MAX; i++) {
+ for (int i=0; i<JOYPADS_MAX; i++) {
- if (joysticks[i].fd == -1) continue;
+ if (joypads[i].fd == -1) continue;
input_event events[32];
- Joystick* joy = &joysticks[i];
+ Joypad* joy = &joypads[i];
int len;
@@ -539,7 +538,7 @@ uint32_t joystick_linux::process_joysticks(uint32_t p_event_id) {
}
}
if (len == 0 || (len < 0 && errno != EAGAIN)) {
- close_joystick(i);
+ close_joypad(i);
};
if (joy->force_feedback) {
@@ -548,9 +547,9 @@ uint32_t joystick_linux::process_joysticks(uint32_t p_event_id) {
Vector2 strength = input->get_joy_vibration_strength(i);
float duration = input->get_joy_vibration_duration(i);
if (strength.x == 0 && strength.y == 0) {
- joystick_vibration_stop(i, timestamp);
+ joypad_vibration_stop(i, timestamp);
} else {
- joystick_vibration_start(i, strength.x, strength.y, duration, timestamp);
+ joypad_vibration_start(i, strength.x, strength.y, duration, timestamp);
}
}
}
diff --git a/platform/x11/joystick_linux.h b/platform/x11/joypad_linux.h
index 34e7001ca9..18ad199f6b 100644
--- a/platform/x11/joystick_linux.h
+++ b/platform/x11/joypad_linux.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* joystick_linux.h */
+/* joypad_linux.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,8 +28,9 @@
/*************************************************************************/
//author: Andreas Haas <hondres, liugam3@gmail.com>
-#ifndef JOYSTICK_LINUX_H
-#define JOYSTICK_LINUX_H
+#ifndef JOYPAD_LINUX_H
+#define JOYPAD_LINUX_H
+
#ifdef JOYDEV_ENABLED
#include "main/input_default.h"
#include "os/thread.h"
@@ -37,21 +38,21 @@
struct input_absinfo;
-class joystick_linux
+class JoypadLinux
{
public:
- joystick_linux(InputDefault *in);
- ~joystick_linux();
- uint32_t process_joysticks(uint32_t p_event_id);
+ JoypadLinux(InputDefault *in);
+ ~JoypadLinux();
+ uint32_t process_joypads(uint32_t p_event_id);
private:
enum {
- JOYSTICKS_MAX = 16,
+ JOYPADS_MAX = 16,
MAX_ABS = 63,
MAX_KEY = 767, // Hack because <linux/input.h> can't be included here
};
- struct Joystick {
+ struct Joypad {
InputDefault::JoyAxis curr_axis[MAX_ABS];
int key_map[MAX_KEY];
int abs_map[MAX_ABS];
@@ -65,8 +66,8 @@ private:
int ff_effect_id;
uint64_t ff_effect_timestamp;
- Joystick();
- ~Joystick();
+ Joypad();
+ ~Joypad();
void reset();
};
@@ -74,7 +75,7 @@ private:
Mutex *joy_mutex;
Thread *joy_thread;
InputDefault *input;
- Joystick joysticks[JOYSTICKS_MAX];
+ Joypad joypads[JOYPADS_MAX];
Vector<String> attached_devices;
static void joy_thread_func(void *p_user);
@@ -82,21 +83,21 @@ private:
int get_joy_from_path(String path) const;
int get_free_joy_slot() const;
- void setup_joystick_properties(int p_id);
- void close_joystick(int p_id = -1);
+ void setup_joypad_properties(int p_id);
+ void close_joypad(int p_id = -1);
#ifdef UDEV_ENABLED
- void enumerate_joysticks(struct udev *_udev);
- void monitor_joysticks(struct udev *_udev);
+ void enumerate_joypads(struct udev *_udev);
+ void monitor_joypads(struct udev *_udev);
#endif
- void monitor_joysticks();
- void run_joystick_thread();
- void open_joystick(const char* path);
+ void monitor_joypads();
+ void run_joypad_thread();
+ void open_joypad(const char* path);
- void joystick_vibration_start(int p_id, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp);
- void joystick_vibration_stop(int p_id, uint64_t p_timestamp);
+ void joypad_vibration_start(int p_id, float p_weak_magnitude, float p_strong_magnitude, float p_duration, uint64_t p_timestamp);
+ void joypad_vibration_stop(int p_id, uint64_t p_timestamp);
InputDefault::JoyAxis axis_correct(const input_absinfo *abs, int value) const;
};
#endif
-#endif // JOYSTICK_LINUX_H
+#endif // JOYPAD_LINUX_H
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 74482a57e7..9a4b19f2db 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -458,7 +458,7 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
input = memnew( InputDefault );
#ifdef JOYDEV_ENABLED
- joystick = memnew( joystick_linux(input));
+ joypad = memnew( JoypadLinux(input));
#endif
_ensure_data_dir();
}
@@ -479,7 +479,7 @@ void OS_X11::finalize() {
//}
#ifdef JOYDEV_ENABLED
- memdelete(joystick);
+ memdelete(joypad);
#endif
memdelete(input);
@@ -1894,7 +1894,7 @@ void OS_X11::set_icon(const Image& p_icon) {
pd[0]=w;
pd[1]=h;
- DVector<uint8_t>::Read r = img.get_data().read();
+ PoolVector<uint8_t>::Read r = img.get_data().read();
long * wr = &pd[2];
uint8_t const * pr = r.ptr();
@@ -1932,7 +1932,7 @@ void OS_X11::run() {
process_xevents(); // get rid of pending events
#ifdef JOYDEV_ENABLED
- event_id = joystick->process_joysticks(event_id);
+ event_id = joypad->process_joypads(event_id);
#endif
if (Main::iteration()==true)
break;
diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h
index b89921fb3e..bf676b5edf 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -48,7 +48,7 @@
#include "servers/physics_2d/physics_2d_server_sw.h"
#include "servers/physics_2d/physics_2d_server_wrap_mt.h"
#include "main/input_default.h"
-#include "joystick_linux.h"
+#include "joypad_linux.h"
#include <X11/keysym.h>
#include <X11/Xlib.h>
@@ -155,7 +155,7 @@ class OS_X11 : public OS_Unix {
InputDefault *input;
#ifdef JOYDEV_ENABLED
- joystick_linux *joystick;
+ JoypadLinux *joypad;
#endif
#ifdef RTAUDIO_ENABLED
diff --git a/platform/x11/platform_config.h b/platform/x11/platform_config.h
index 74d507f5a2..342270b74a 100644
--- a/platform/x11/platform_config.h
+++ b/platform/x11/platform_config.h
@@ -34,6 +34,4 @@
#define PTHREAD_BSD_SET_NAME
#endif
-#define GLES2_INCLUDE_H "GL/glew.h"
-//#define GLES3_INCLUDE_H "GL/glew.h"
-#define GLES3_INCLUDE_H "gl_context/glad/glad.h"
+#define GLES3_INCLUDE_H "glad/glad.h"