summaryrefslogtreecommitdiff
path: root/core/os
diff options
context:
space:
mode:
Diffstat (limited to 'core/os')
-rw-r--r--core/os/file_access.cpp4
-rw-r--r--core/os/input.cpp1
-rw-r--r--core/os/input.h1
-rw-r--r--core/os/main_loop.cpp10
-rw-r--r--core/os/main_loop.h2
-rw-r--r--core/os/memory.h9
-rw-r--r--core/os/os.cpp18
-rw-r--r--core/os/os.h7
8 files changed, 46 insertions, 6 deletions
diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp
index 0846ef3eb0..a3ee9395de 100644
--- a/core/os/file_access.cpp
+++ b/core/os/file_access.cpp
@@ -284,7 +284,7 @@ Vector<String> FileAccess::get_csv_line(String delim) const {
String l;
int qc=0;
do {
- l+=get_line();
+ l+=get_line()+"\n";
qc=0;
for(int i=0;i<l.length();i++) {
@@ -295,6 +295,8 @@ Vector<String> FileAccess::get_csv_line(String delim) const {
} while (qc%2);
+ l=l.substr(0, l.length()-1);
+
Vector<String> strings;
bool in_quote=false;
diff --git a/core/os/input.cpp b/core/os/input.cpp
index 6e1e618d9a..a766ef87fc 100644
--- a/core/os/input.cpp
+++ b/core/os/input.cpp
@@ -60,6 +60,7 @@ void Input::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_joy_name","device"),&Input::get_joy_name);
ObjectTypeDB::bind_method(_MD("get_joy_guid","device"),&Input::get_joy_guid);
ObjectTypeDB::bind_method(_MD("get_accelerometer"),&Input::get_accelerometer);
+ ObjectTypeDB::bind_method(_MD("get_magnetometer"),&Input::get_magnetometer);
//ObjectTypeDB::bind_method(_MD("get_mouse_pos"),&Input::get_mouse_pos); - this is not the function you want
ObjectTypeDB::bind_method(_MD("get_mouse_speed"),&Input::get_mouse_speed);
ObjectTypeDB::bind_method(_MD("get_mouse_button_mask"),&Input::get_mouse_button_mask);
diff --git a/core/os/input.h b/core/os/input.h
index 535776f39c..46edb30aa1 100644
--- a/core/os/input.h
+++ b/core/os/input.h
@@ -75,6 +75,7 @@ public:
virtual void warp_mouse_pos(const Vector2& p_to)=0;
virtual Vector3 get_accelerometer()=0;
+ virtual Vector3 get_magnetometer()=0;
virtual void action_press(const StringName& p_action)=0;
virtual void action_release(const StringName& p_action)=0;
diff --git a/core/os/main_loop.cpp b/core/os/main_loop.cpp
index 310bbaa3b8..e5feebfbfc 100644
--- a/core/os/main_loop.cpp
+++ b/core/os/main_loop.cpp
@@ -43,6 +43,7 @@ void MainLoop::_bind_methods() {
BIND_VMETHOD( MethodInfo("_initialize") );
BIND_VMETHOD( MethodInfo("_iteration",PropertyInfo(Variant::REAL,"delta")) );
BIND_VMETHOD( MethodInfo("_idle",PropertyInfo(Variant::REAL,"delta")) );
+ BIND_VMETHOD( MethodInfo("_drop_files",PropertyInfo(Variant::STRING_ARRAY,"files"),PropertyInfo(Variant::INT,"screen")) );
BIND_VMETHOD( MethodInfo("_finalize") );
BIND_CONSTANT(NOTIFICATION_WM_MOUSE_ENTER);
@@ -108,6 +109,15 @@ bool MainLoop::idle(float p_time) {
return false;
}
+
+void MainLoop::drop_files(const Vector<String>& p_files,int p_from_screen) {
+
+
+ if (get_script_instance())
+ get_script_instance()->call("_drop_files",p_files,p_from_screen);
+
+}
+
void MainLoop::finish() {
if (get_script_instance()) {
diff --git a/core/os/main_loop.h b/core/os/main_loop.h
index a34014983e..57185d9d3d 100644
--- a/core/os/main_loop.h
+++ b/core/os/main_loop.h
@@ -64,6 +64,8 @@ public:
virtual bool idle(float p_time);
virtual void finish();
+ virtual void drop_files(const Vector<String>& p_files,int p_from_screen=0);
+
void set_init_script(const Ref<Script>& p_init_script);
MainLoop();
diff --git a/core/os/memory.h b/core/os/memory.h
index 8257e66851..5f4c6f929c 100644
--- a/core/os/memory.h
+++ b/core/os/memory.h
@@ -211,7 +211,7 @@ void * operator new(size_t p_size,void *p_pointer,size_t check, const char *p_de
#ifdef DEBUG_MEMORY_ENABLED
-#define memalloc(m_size) Memory::alloc_static(m_size, __FILE__":"__STR(__LINE__)", memalloc.")
+#define memalloc(m_size) Memory::alloc_static(m_size, __FILE__ ":" __STR(__LINE__) ", memalloc.")
#define memrealloc(m_mem,m_size) Memory::realloc_static(m_mem,m_size)
#define memfree(m_size) Memory::free_static(m_size)
@@ -224,8 +224,7 @@ void * operator new(size_t p_size,void *p_pointer,size_t check, const char *p_de
#endif
#ifdef DEBUG_MEMORY_ENABLED
-
-#define dynalloc(m_size) Memory::alloc_dynamic(m_size, __FILE__":"__STR(__LINE__)", type: DYNAMIC")
+#define dynalloc(m_size) Memory::alloc_dynamic(m_size, __FILE__ ":" __STR(__LINE__) ", type: DYNAMIC")
#define dynrealloc(m_mem,m_size) m_mem.resize(m_size)
#else
@@ -248,7 +247,7 @@ _ALWAYS_INLINE_ T *_post_initialize(T *p_obj) {
#ifdef DEBUG_MEMORY_ENABLED
-#define memnew(m_class) _post_initialize(new(__FILE__":"__STR(__LINE__)", memnew type: "__STR(m_class)) m_class)
+#define memnew(m_class) _post_initialize(new(__FILE__ ":" __STR(__LINE__) ", memnew type: " __STR(m_class)) m_class)
#else
@@ -291,7 +290,7 @@ void memdelete_allocator(T *p_class) {
#define memdelete_notnull(m_v) { if (m_v) memdelete(m_v); }
#ifdef DEBUG_MEMORY_ENABLED
-#define memnew_arr( m_class, m_count ) memnew_arr_template<m_class>(m_count,__FILE__":"__STR(__LINE__)", memnew_arr type: "_STR(m_class))
+#define memnew_arr( m_class, m_count ) memnew_arr_template<m_class>(m_count,__FILE__ ":" __STR(__LINE__) ", memnew_arr type: " _STR(m_class))
#else
diff --git a/core/os/os.cpp b/core/os/os.cpp
index 1aee6d9aa2..e501bc2eb5 100644
--- a/core/os/os.cpp
+++ b/core/os/os.cpp
@@ -306,6 +306,15 @@ String OS::get_system_dir(SystemDir p_dir) const {
return ".";
}
+String OS::get_safe_application_name() const {
+ String an = Globals::get_singleton()->get("application/name");
+ Vector<String> invalid_char = String("\\ / : * ? \" < > |").split(" ");
+ for (int i=0;i<invalid_char.size();i++) {
+ an = an.replace(invalid_char[i],"-");
+ }
+ return an;
+}
+
String OS::get_data_dir() const {
return ".";
@@ -530,6 +539,14 @@ String OS::get_joy_guid(int p_device) const {
void OS::set_context(int p_context) {
}
+void OS::set_use_vsync(bool p_enable) {
+
+}
+
+bool OS::is_vsnc_enabled() const{
+
+ return true;
+}
OS::OS() {
last_error=NULL;
@@ -548,6 +565,7 @@ OS::OS() {
_render_thread_mode=RENDER_THREAD_SAFE;
_time_scale=1.0;
_pixel_snap=false;
+ _allow_hidpi=true;
Math::seed(1234567);
}
diff --git a/core/os/os.h b/core/os/os.h
index 160c0495bb..c291d09250 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -60,6 +60,7 @@ class OS {
int _target_fps;
float _time_scale;
bool _pixel_snap;
+ bool _allow_hidpi;
char *last_error;
@@ -160,6 +161,7 @@ public:
virtual void set_current_screen(int p_screen) { }
virtual Point2 get_screen_position(int p_screen=0) const { return Point2(); }
virtual Size2 get_screen_size(int p_screen=0) const { return get_window_size(); }
+ virtual int get_screen_dpi(int p_screen=0) const { return 72; }
virtual Point2 get_window_position() const { return Vector2(); }
virtual void set_window_position(const Point2& p_position) {}
virtual Size2 get_window_size() const=0;
@@ -324,6 +326,7 @@ public:
virtual String get_locale() const;
+ String get_safe_application_name() const;
virtual String get_data_dir() const;
virtual String get_resource_dir() const;
@@ -417,6 +420,10 @@ public:
virtual void set_context(int p_context);
+ virtual void set_use_vsync(bool p_enable);
+ virtual bool is_vsnc_enabled() const;
+
+ bool is_hidpi_allowed() const { return _allow_hidpi; }
OS();
virtual ~OS();