summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConstruct3
-rw-r--r--core/os/input.cpp6
-rw-r--r--core/os/input.h5
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp4
-rw-r--r--main/input_default.cpp58
-rw-r--r--main/input_default.h5
-rw-r--r--platform/android/os_android.cpp13
-rw-r--r--platform/windows/os_windows.cpp7
8 files changed, 88 insertions, 13 deletions
diff --git a/SConstruct b/SConstruct
index d168820f66..e08c46c51e 100644
--- a/SConstruct
+++ b/SConstruct
@@ -138,7 +138,8 @@ opts.Add('etc1','etc1 Texture compression support (yes/no)','yes')
opts.Add('builtin_zlib','Use built-in zlib (yes/no)','yes')
opts.Add('openssl','Use OpenSSL (yes/no/builtin)','no')
opts.Add('musepack','Musepack Audio (yes/no)','yes')
-opts.Add("CXX", "Compiler");
+opts.Add("CXX", "C++ Compiler")
+opts.Add("CC", "C Compiler")
opts.Add("CCFLAGS", "Custom flags for the C++ compiler");
opts.Add("CFLAGS", "Custom flags for the C compiler");
opts.Add("LINKFLAGS", "Custom flags for the linker");
diff --git a/core/os/input.cpp b/core/os/input.cpp
index 401ab7ffe2..4ab57a84ea 100644
--- a/core/os/input.cpp
+++ b/core/os/input.cpp
@@ -64,6 +64,10 @@ void Input::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_connected_joysticks"),&Input::get_connected_joysticks);
ObjectTypeDB::bind_method(_MD("get_joy_vibration_strength", "device"), &Input::get_joy_vibration_strength);
ObjectTypeDB::bind_method(_MD("get_joy_vibration_duration", "device"), &Input::get_joy_vibration_duration);
+ ObjectTypeDB::bind_method(_MD("get_joy_button_string", "button_index"), &Input::get_joy_button_string);
+ ObjectTypeDB::bind_method(_MD("get_joy_button_index_from_string", "button"), &Input::get_joy_button_index_from_string);
+ ObjectTypeDB::bind_method(_MD("get_joy_axis_string", "axis_index"), &Input::get_joy_axis_string);
+ ObjectTypeDB::bind_method(_MD("get_joy_axis_index_from_string", "axis"), &Input::get_joy_axis_index_from_string);
ObjectTypeDB::bind_method(_MD("start_joy_vibration", "device", "weak_magnitude", "strong_magnitude", "duration"), &Input::start_joy_vibration, DEFVAL(0));
ObjectTypeDB::bind_method(_MD("stop_joy_vibration", "device"), &Input::stop_joy_vibration);
ObjectTypeDB::bind_method(_MD("get_accelerometer"),&Input::get_accelerometer);
@@ -90,7 +94,7 @@ void Input::get_argument_options(const StringName& p_function,int p_idx,List<Str
#ifdef TOOLS_ENABLED
String pf=p_function;
- if (p_idx==0 && (pf=="is_action_pressed" || pf=="action_press" || pf=="action_release")) {
+ if (p_idx==0 && (pf=="is_action_pressed" || pf=="action_press" || pf=="action_release" || pf=="is_action_just_pressed" || pf=="is_action_just_released")) {
List<PropertyInfo> pinfo;
Globals::get_singleton()->get_property_list(&pinfo);
diff --git a/core/os/input.h b/core/os/input.h
index 665fb4ad99..d8f3be09df 100644
--- a/core/os/input.h
+++ b/core/os/input.h
@@ -96,6 +96,11 @@ public:
virtual void set_custom_mouse_cursor(const RES& p_cursor,const Vector2& p_hotspot=Vector2())=0;
virtual void set_mouse_in_window(bool p_in_window)=0;
+ virtual String get_joy_button_string(int p_button)=0;
+ virtual String get_joy_axis_string(int p_axis)=0;
+ virtual int get_joy_button_index_from_string(String p_button)=0;
+ virtual int get_joy_axis_index_from_string(String p_axis)=0;
+
Input();
};
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index 56489cf4df..aeb3d9e039 100644
--- a/drivers/gles2/rasterizer_gles2.cpp
+++ b/drivers/gles2/rasterizer_gles2.cpp
@@ -7018,6 +7018,10 @@ void RasterizerGLES2::_process_glow_bloom() {
void RasterizerGLES2::_process_hdr() {
+ if (framebuffer.luminance.empty()) {
+ return;
+ }
+
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer.luminance[0].fbo);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, framebuffer.color );
diff --git a/main/input_default.cpp b/main/input_default.cpp
index 2020f7a5ad..92f4a6fb72 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -1159,3 +1159,61 @@ Array InputDefault::get_connected_joysticks() {
}
return ret;
}
+
+static const char* _buttons[] = {
+ "Face Button Bottom",
+ "Face Button Right",
+ "Face Button Left",
+ "Face Button Top",
+ "L",
+ "R",
+ "L2",
+ "R2",
+ "L3",
+ "R3",
+ "Select",
+ "Start",
+ "DPAD Up",
+ "DPAD Down",
+ "DPAD Left",
+ "DPAD Right"
+};
+
+static const char* _axes[] = {
+ "Left Stick X",
+ "Left Stick Y",
+ "Right Stick X",
+ "Right Stick Y",
+ "",
+ "",
+ "L2",
+ "R2"
+};
+
+String InputDefault::get_joy_button_string(int p_button) {
+ ERR_FAIL_INDEX_V(p_button, JOY_BUTTON_MAX, "");
+ return _buttons[p_button];
+}
+
+int InputDefault::get_joy_button_index_from_string(String p_button) {
+ for (int i = 0; i < JOY_BUTTON_MAX; i++) {
+ if (p_button == _buttons[i]) {
+ return i;
+ }
+ }
+ ERR_FAIL_V(-1);
+}
+
+String InputDefault::get_joy_axis_string(int p_axis) {
+ ERR_FAIL_INDEX_V(p_axis, JOY_AXIS_MAX, "");
+ return _axes[p_axis];
+}
+
+int InputDefault::get_joy_axis_index_from_string(String p_axis) {
+ for (int i = 0; i < JOY_AXIS_MAX; i++) {
+ if (p_axis == _axes[i]) {
+ return i;
+ }
+ }
+ ERR_FAIL_V(-1);
+}
diff --git a/main/input_default.h b/main/input_default.h
index fbf7837b3b..2db6d28abf 100644
--- a/main/input_default.h
+++ b/main/input_default.h
@@ -235,6 +235,11 @@ public:
virtual bool is_joy_known(int p_device);
virtual String get_joy_guid(int p_device) const;
+ virtual String get_joy_button_string(int p_button);
+ virtual String get_joy_axis_string(int p_axis);
+ virtual int get_joy_axis_index_from_string(String p_axis);
+ virtual int get_joy_button_index_from_string(String p_button);
+
bool is_joy_mapped(int p_device);
String get_joy_guid_remapped(int p_device) const;
void set_fallback_mapping(String p_guid);
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 4e395a6f9f..862709fc7d 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -132,15 +132,10 @@ void OS_Android::initialize(const VideoMode& p_desired,int p_video_driver,int p_
AudioDriverManagerSW::add_driver(&audio_driver_android);
- if (true) {
- RasterizerGLES2 *rasterizer_gles22=memnew( RasterizerGLES2(false,use_reload_hooks,false,use_reload_hooks ) );
- if (gl_extensions)
- rasterizer_gles22->set_extensions(gl_extensions);
- rasterizer = rasterizer_gles22;
- } else {
- //rasterizer = memnew( RasterizerGLES1(use_reload_hooks, use_reload_hooks) );
-
- }
+ RasterizerGLES2 *rasterizer_gles22=memnew( RasterizerGLES2(false,use_reload_hooks,false,use_reload_hooks ) );
+ if (gl_extensions)
+ rasterizer_gles22->set_extensions(gl_extensions);
+ rasterizer = rasterizer_gles22;
rasterizer->set_force_16_bits_fbo(use_16bits_fbo);
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index cebafdabce..f38bda5899 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -1312,10 +1312,13 @@ void OS_Windows::finalize_core() {
void OS_Windows::vprint(const char* p_format, va_list p_list, bool p_stderr) {
- char buf[16384+1];
- int len = vsnprintf(buf,16384,p_format,p_list);
+ const unsigned int BUFFER_SIZE = 16384;
+ char buf[BUFFER_SIZE+1]; // +1 for the terminating character
+ int len = vsnprintf(buf,BUFFER_SIZE,p_format,p_list);
if (len<=0)
return;
+ if(len >= BUFFER_SIZE)
+ len = BUFFER_SIZE; // Output is too big, will be truncated
buf[len]=0;