summaryrefslogtreecommitdiff
path: root/platform/javascript/javascript_main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/javascript/javascript_main.cpp')
-rw-r--r--platform/javascript/javascript_main.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp
index d9342cfe10..6ec7f1ec3d 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 */
@@ -66,11 +66,12 @@ static void _glut_mouse_button(int button, int state, int x, int y) {
if (ev.mouse_button.button_index<4) {
if (ev.mouse_button.pressed) {
- _mouse_button_mask|=1<<ev.mouse_button.button_index;
+ _mouse_button_mask |= 1 << (ev.mouse_button.button_index-1);
} else {
- _mouse_button_mask&=~(1<<ev.mouse_button.button_index);
+ _mouse_button_mask &= ~(1 << (ev.mouse_button.button_index-1));
}
}
+ ev.mouse_button.button_mask=_mouse_button_mask;
uint32_t m = glutGetModifiers();
ev.mouse_button.mod.alt=(m&GLUT_ACTIVE_ALT)!=0;
@@ -79,6 +80,11 @@ static void _glut_mouse_button(int button, int state, int x, int y) {
os->push_input(ev);
+ if (ev.mouse_button.button_index==BUTTON_WHEEL_UP || ev.mouse_button.button_index==BUTTON_WHEEL_DOWN) {
+ // GLUT doesn't send release events for mouse wheel, so send manually
+ ev.mouse_button.pressed=false;
+ os->push_input(ev);
+ }
}
@@ -148,13 +154,13 @@ int main(int argc, char *argv[]) {
/* Initialize the window */
printf("let it go!\n");
glutInit(&argc, argv);
- os = new OS_JavaScript(_gfx_init,NULL,NULL,NULL,NULL);
+ os = new OS_JavaScript(_gfx_init,NULL,NULL);
#if 0
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
@@ -162,7 +168,6 @@ int main(int argc, char *argv[]) {
glutMouseFunc(_glut_mouse_button);
glutMotionFunc(_glut_mouse_motion);
- glutMotionFunc(_glut_mouse_motion);
glutPassiveMotionFunc(_glut_mouse_motion);