diff options
Diffstat (limited to 'platform/javascript')
-rw-r--r-- | platform/javascript/audio_driver_javascript.cpp | 14 | ||||
-rw-r--r-- | platform/javascript/audio_driver_javascript.h | 2 | ||||
-rw-r--r-- | platform/javascript/audio_server_javascript.cpp | 18 | ||||
-rw-r--r-- | platform/javascript/audio_server_javascript.h | 8 | ||||
-rw-r--r-- | platform/javascript/dom_keys.h | 2 | ||||
-rw-r--r-- | platform/javascript/export/export.cpp | 24 | ||||
-rw-r--r-- | platform/javascript/export/export.h | 2 | ||||
-rw-r--r-- | platform/javascript/javascript_eval.cpp | 2 | ||||
-rw-r--r-- | platform/javascript/javascript_eval.h | 4 | ||||
-rw-r--r-- | platform/javascript/javascript_main.cpp | 6 | ||||
-rw-r--r-- | platform/javascript/os_javascript.cpp | 24 | ||||
-rw-r--r-- | platform/javascript/os_javascript.h | 4 | ||||
-rw-r--r-- | platform/javascript/platform_config.h | 2 |
13 files changed, 60 insertions, 52 deletions
diff --git a/platform/javascript/audio_driver_javascript.cpp b/platform/javascript/audio_driver_javascript.cpp index 1b949e64f9..af9f28169b 100644 --- a/platform/javascript/audio_driver_javascript.cpp +++ b/platform/javascript/audio_driver_javascript.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -68,14 +68,18 @@ AudioDriverSW::OutputFormat AudioDriverJavaScript::get_output_format() const{ } void AudioDriverJavaScript::lock(){ - //if (active && mutex) - // mutex->lock(); + /* + if (active && mutex) + mutex->lock(); + */ } void AudioDriverJavaScript::unlock() { - //if (active && mutex) - // mutex->unlock(); + /* + if (active && mutex) + mutex->unlock(); + */ } void AudioDriverJavaScript::finish(){ diff --git a/platform/javascript/audio_driver_javascript.h b/platform/javascript/audio_driver_javascript.h index c674a8566e..528b45569d 100644 --- a/platform/javascript/audio_driver_javascript.h +++ b/platform/javascript/audio_driver_javascript.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/javascript/audio_server_javascript.cpp b/platform/javascript/audio_server_javascript.cpp index 71a7e77266..5489f179eb 100644 --- a/platform/javascript/audio_server_javascript.cpp +++ b/platform/javascript/audio_server_javascript.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -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){ @@ -617,9 +617,11 @@ void AudioServerJavascript::mix_to_js(int p_frames) { void AudioServerJavascript::init(){ - //EM_ASM( -// console.log('server is '+audio_server); -// ); + /* + EM_ASM( + console.log('server is '+audio_server); + ); + */ //int latency = GLOBAL_DEF("javascript/audio_latency",16384); diff --git a/platform/javascript/audio_server_javascript.h b/platform/javascript/audio_server_javascript.h index e27192cd93..8e61e94dfc 100644 --- a/platform/javascript/audio_server_javascript.h +++ b/platform/javascript/audio_server_javascript.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -34,7 +34,7 @@ class AudioServerJavascript : public AudioServer { - OBJ_TYPE(AudioServerJavascript,AudioServer); + GDCLASS(AudioServerJavascript,AudioServer); enum { INTERNAL_BUFFER_SIZE=4096, @@ -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/dom_keys.h b/platform/javascript/dom_keys.h index 282b632e93..5ef212ce4a 100644 --- a/platform/javascript/dom_keys.h +++ b/platform/javascript/dom_keys.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index fa84a1e67c..e0ff9932cc 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -40,7 +40,7 @@ #include "string.h" class EditorExportPlatformJavaScript : public EditorExportPlatform { - OBJ_TYPE( EditorExportPlatformJavaScript,EditorExportPlatform ); + GDCLASS( EditorExportPlatformJavaScript,EditorExportPlatform ); String custom_release_package; String custom_debug_package; @@ -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); @@ -265,7 +265,7 @@ Error EditorExportPlatformJavaScript::export_project(const String& p_path, bool FileAccess *f=FileAccess::open(p_path.get_base_dir()+"/data.pck",FileAccess::WRITE); if (!f) { - EditorNode::add_io_error("Could not create file for writing:\n"+p_path.basename()+"_files.js"); + EditorNode::add_io_error("Could not create file for writing:\n"+p_path.get_basename()+"_files.js"); return ERR_FILE_CANT_WRITE; } Error err = save_pack(f); @@ -307,32 +307,32 @@ Error EditorExportPlatformJavaScript::export_project(const String& p_path, bool if (file=="godot.html") { - _fix_html(data,p_path.get_file().basename(), p_debug); + _fix_html(data,p_path.get_file().get_basename(), p_debug); file=p_path.get_file(); } if (file=="godotfs.js") { _fix_files(data,len); - file=p_path.get_file().basename()+"fs.js"; + file=p_path.get_file().get_basename()+"fs.js"; } if (file=="godot.js") { - file=p_path.get_file().basename()+".js"; + file=p_path.get_file().get_basename()+".js"; } if (file=="godot.asm.js") { - file=p_path.get_file().basename()+".asm.js"; + file=p_path.get_file().get_basename()+".asm.js"; } if (file=="godot.mem") { - file=p_path.get_file().basename()+".mem"; + file=p_path.get_file().get_basename()+".mem"; } if (file=="godot.wasm") { - file=p_path.get_file().basename()+".wasm"; + file=p_path.get_file().get_basename()+".wasm"; } String dst = p_path.get_base_dir().plus_file(file); diff --git a/platform/javascript/export/export.h b/platform/javascript/export/export.h index 2105141e58..59c0a67e6d 100644 --- a/platform/javascript/export/export.h +++ b/platform/javascript/export/export.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/javascript/javascript_eval.cpp b/platform/javascript/javascript_eval.cpp index e642300bda..7bbe0ae99b 100644 --- a/platform/javascript/javascript_eval.cpp +++ b/platform/javascript/javascript_eval.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/javascript/javascript_eval.h b/platform/javascript/javascript_eval.h index e5f6268076..679224d519 100644 --- a/platform/javascript/javascript_eval.h +++ b/platform/javascript/javascript_eval.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -35,7 +35,7 @@ class JavaScript : public Object { private: - OBJ_TYPE( JavaScript, Object ); + GDCLASS( JavaScript, Object ); static JavaScript *singleton; diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp index 99b16b2b9b..dc4d80df7b 100644 --- a/platform/javascript/javascript_main.cpp +++ b/platform/javascript/javascript_main.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -158,8 +158,8 @@ int main(int argc, char *argv[]) { char *args[]={"-test","gui","-v",NULL}; Error err = Main::setup("apk",3,args); #else -// char *args[]={"-v",NULL};// -// Error err = Main::setup("",1,args); + //char *args[]={"-v",NULL};// + //Error err = Main::setup("",1,args); Error err = Main::setup("",0,NULL); #endif diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index aa728c768a..fed9598096 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -243,7 +243,7 @@ void OS_JavaScript::initialize(const VideoMode& p_desired,int p_video_driver,int rasterizer_gles22->set_extensions(gl_extensions); rasterizer = rasterizer_gles22; } else { -// rasterizer = memnew( RasterizerGLES1(true, false) ); + //rasterizer = memnew( RasterizerGLES1(true, false) ); } print_line("Init VS"); @@ -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 } @@ -513,7 +513,7 @@ bool OS_JavaScript::main_loop_iterate() { } - process_joysticks(); + process_joypads(); return Main::iteration(); } @@ -555,7 +555,7 @@ void OS_JavaScript::push_input(const InputEvent& p_ev) { void OS_JavaScript::process_touch(int p_what,int p_pointer, const Vector<TouchPos>& p_points) { -// print_line("ev: "+itos(p_what)+" pnt: "+itos(p_pointer)+" pointc: "+itos(p_points.size())); + //print_line("ev: "+itos(p_what)+" pnt: "+itos(p_pointer)+" pointc: "+itos(p_points.size())); switch(p_what) { case 0: { //gesture begin @@ -638,8 +638,8 @@ void OS_JavaScript::process_touch(int p_what,int p_pointer, const Vector<TouchPo ev.mouse_motion.x=p_points[0].pos.x; ev.mouse_motion.y=p_points[0].pos.y; input->set_mouse_pos(Point2(ev.mouse_motion.x,ev.mouse_motion.y)); - ev.mouse_motion.speed_x=input->get_mouse_speed().x; - ev.mouse_motion.speed_y=input->get_mouse_speed().y; + ev.mouse_motion.speed_x=input->get_last_mouse_speed().x; + ev.mouse_motion.speed_y=input->get_last_mouse_speed().y; ev.mouse_motion.relative_x=p_points[0].pos.x-last_mouse.x; ev.mouse_motion.relative_y=p_points[0].pos.y-last_mouse.y; last_mouse=p_points[0].pos; @@ -798,10 +798,12 @@ String OS_JavaScript::get_resource_dir() const { String OS_JavaScript::get_data_dir() const { - //if (get_data_dir_func) - // return get_data_dir_func(); + /* + 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 { @@ -818,7 +820,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 95bd64dfe4..370322e93d 100644 --- a/platform/javascript/os_javascript.h +++ b/platform/javascript/os_javascript.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -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/javascript/platform_config.h b/platform/javascript/platform_config.h index 143f16c1fa..cdef185ff0 100644 --- a/platform/javascript/platform_config.h +++ b/platform/javascript/platform_config.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ |