summaryrefslogtreecommitdiff
path: root/platform/javascript/os_javascript.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/javascript/os_javascript.cpp')
-rw-r--r--platform/javascript/os_javascript.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index 665280df96..b10ef821dd 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -27,6 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+
#include "os_javascript.h"
#include "core/engine.h"
@@ -429,7 +430,7 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver,
attributes.antialias = false;
attributes.majorVersion = 2;
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx = emscripten_webgl_create_context(NULL, &attributes);
- ERR_FAIL_COND(emscripten_webgl_make_context_current(ctx) != EMSCRIPTEN_RESULT_SUCCESS, ERR_UNAVAILABLE);
+ ERR_FAIL_COND_V(emscripten_webgl_make_context_current(ctx) != EMSCRIPTEN_RESULT_SUCCESS, ERR_UNAVAILABLE);
video_mode = p_desired;
// can't fulfil fullscreen request due to browser security
@@ -565,7 +566,7 @@ void OS_JavaScript::set_css_cursor(const char *p_cursor) {
/* clang-format off */
EM_ASM_({
- Module.canvas.style.cursor = Module.UTF8ToString($0);
+ Module.canvas.style.cursor = UTF8ToString($0);
}, p_cursor);
/* clang-format on */
}
@@ -575,7 +576,7 @@ const char *OS_JavaScript::get_css_cursor() const {
char cursor[16];
/* clang-format off */
EM_ASM_INT({
- Module.stringToUTF8(Module.canvas.style.cursor ? Module.canvas.style.cursor : 'auto', $0, 16);
+ stringToUTF8(Module.canvas.style.cursor ? Module.canvas.style.cursor : 'auto', $0, 16);
}, cursor);
/* clang-format on */
return cursor;
@@ -781,6 +782,9 @@ void OS_JavaScript::set_cursor_shape(CursorShape p_shape) {
set_css_cursor(godot2dom_cursor(cursor_shape));
}
+void OS_JavaScript::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
+}
+
void OS_JavaScript::main_loop_begin() {
if (main_loop)
@@ -788,7 +792,7 @@ void OS_JavaScript::main_loop_begin() {
/* clang-format off */
EM_ASM_ARGS({
- const send_notification = Module.cwrap('send_notification', null, ['number']);
+ const send_notification = cwrap('send_notification', null, ['number']);
const notifs = arguments;
(['mouseover', 'mouseleave', 'focus', 'blur']).forEach(function(event, i) {
Module.canvas.addEventListener(event, send_notification.bind(null, notifs[i]));
@@ -985,6 +989,7 @@ bool OS_JavaScript::is_userfs_persistent() const {
}
OS_JavaScript::OS_JavaScript(const char *p_execpath, GetUserDataDirFunc p_get_user_data_dir_func) {
+
set_cmdline(p_execpath, get_cmdline_args());
main_loop = NULL;
gl_extensions = NULL;
@@ -997,6 +1002,10 @@ OS_JavaScript::OS_JavaScript(const char *p_execpath, GetUserDataDirFunc p_get_us
idbfs_available = false;
time_to_save_sync = -1;
+
+ Vector<Logger *> loggers;
+ loggers.push_back(memnew(StdLogger));
+ _set_logger(memnew(CompositeLogger(loggers)));
}
OS_JavaScript::~OS_JavaScript() {