@@ -28,43 +28,43 @@ ofxAppEmscriptenWindow::~ofxAppEmscriptenWindow() {
28
28
29
29
// ------------------------------------------------------------
30
30
void ofxAppEmscriptenWindow::setup (const ofGLESWindowSettings & settings){
31
- setWindowShape (settings.getWidth (),settings.getHeight ());
31
+ setWindowShape (settings.getWidth (),settings.getHeight ());
32
32
33
- EmscriptenWebGLContextAttributes attrs;
34
- emscripten_webgl_init_context_attributes (&attrs);
33
+ EmscriptenWebGLContextAttributes attrs;
34
+ emscripten_webgl_init_context_attributes (&attrs);
35
35
36
36
// / when setting explicitSwapControl to 0 it is emscripten that is in charge of swapping on each render call.
37
- attrs.explicitSwapControl = 0 ;
38
- attrs.depth = 1 ;
39
- attrs.stencil = 1 ;
40
- attrs.antialias = 1 ;
41
- attrs.majorVersion = 2 ;
42
- attrs.minorVersion = 0 ;
43
- attrs.alpha = 0 ;
44
-
45
- context = emscripten_webgl_create_context (" #canvas" , &attrs);
46
- assert (context);
37
+ attrs.explicitSwapControl = 0 ;
38
+ attrs.depth = 1 ;
39
+ attrs.stencil = 1 ;
40
+ attrs.antialias = 1 ;
41
+ attrs.majorVersion = 2 ;
42
+ attrs.minorVersion = 0 ;
43
+ attrs.alpha = 0 ;
44
+
45
+ context = emscripten_webgl_create_context (" #canvas" , &attrs);
46
+ assert (context);
47
47
48
- makeCurrent ();
48
+ makeCurrent ();
49
49
50
- _renderer = std::make_shared<ofGLProgrammableRenderer>(this );
51
- ((ofGLProgrammableRenderer*)_renderer.get ())->setup (2 ,0 );
50
+ _renderer = std::make_shared<ofGLProgrammableRenderer>(this );
51
+ ((ofGLProgrammableRenderer*)_renderer.get ())->setup (2 ,0 );
52
52
53
- emscripten_set_keydown_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW, this , true , &keydown_cb);
54
- emscripten_set_keyup_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW, this , true , &keyup_cb);
53
+ emscripten_set_keydown_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW,this ,1 , &keydown_cb);
54
+ emscripten_set_keyup_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW,this ,1 , &keyup_cb);
55
55
56
- emscripten_set_mousedown_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW, this , true , &mousedown_cb);
57
- emscripten_set_mouseup_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW, this , true , &mouseup_cb);
58
- emscripten_set_mousemove_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW, this , true , &mousemoved_cb);
59
- emscripten_set_mouseenter_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW, this , true , &mouseenter_cb);
60
- emscripten_set_mouseleave_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW, this , true , &mouseleave_cb);
61
-
62
- emscripten_set_touchstart_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW, this , true , &touch_cb);
63
- emscripten_set_touchend_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW, this , true , &touch_cb);
64
- emscripten_set_touchmove_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW, this , true , &touch_cb);
65
- emscripten_set_touchcancel_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW, this , true , &touch_cb);
56
+ emscripten_set_mousedown_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW,this ,1 , &mousedown_cb);
57
+ emscripten_set_mouseup_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW,this ,1 , &mouseup_cb);
58
+ emscripten_set_mousemove_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW,this ,1 , &mousemoved_cb);
59
+ emscripten_set_mouseenter_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW,this ,1 , &mouseenter_cb);
60
+ emscripten_set_mouseleave_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW,this ,1 , &mouseleave_cb);
61
+
62
+ emscripten_set_touchstart_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW,this ,1 , &touch_cb);
63
+ emscripten_set_touchend_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW,this ,1 , &touch_cb);
64
+ emscripten_set_touchmove_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW,this ,1 , &touch_cb);
65
+ emscripten_set_touchcancel_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW,this ,1 , &touch_cb);
66
66
67
- emscripten_set_wheel_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW, this , true , &mousescrolled_cb);
67
+ emscripten_set_wheel_callback (EMSCRIPTEN_EVENT_TARGET_WINDOW,this ,1 , &mousescrolled_cb);
68
68
69
69
// the following locks up the window for some reason.....
70
70
// emscripten_set_resize_callback(const char *target, void *userData, EM_BOOL useCapture, em_ui_callback_func callback)
@@ -163,7 +163,7 @@ void ofxAppEmscriptenWindow::display_cb(){
163
163
}
164
164
165
165
// ------------------------------------------------------------
166
- EM_BOOL ofxAppEmscriptenWindow::keydown_cb (int eventType, const EmscriptenKeyboardEvent * keyEvent, void * userData) {
166
+ int ofxAppEmscriptenWindow::keydown_cb (int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData){
167
167
int key = keyEvent->key [0 ];
168
168
std::string id = keyEvent->key ;
169
169
if (key == 0 ){
@@ -254,7 +254,7 @@ EM_BOOL ofxAppEmscriptenWindow::keydown_cb(int eventType, const EmscriptenKeyboa
254
254
}
255
255
256
256
// ------------------------------------------------------------
257
- EM_BOOL ofxAppEmscriptenWindow::keyup_cb (int eventType, const EmscriptenKeyboardEvent * keyEvent, void * userData) {
257
+ int ofxAppEmscriptenWindow::keyup_cb (int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData){
258
258
int key = keyEvent->key [0 ];
259
259
std::string id = keyEvent->key ;
260
260
if (key == 0 ){
@@ -345,7 +345,7 @@ EM_BOOL ofxAppEmscriptenWindow::keyup_cb(int eventType, const EmscriptenKeyboard
345
345
}
346
346
347
347
// ------------------------------------------------------------
348
- EM_BOOL ofxAppEmscriptenWindow::mousedown_cb (int eventType, const EmscriptenMouseEvent * mouseEvent, void * userData) {
348
+ int ofxAppEmscriptenWindow::mousedown_cb (int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData){
349
349
float mouseX = mouseEvent->targetX - EM_ASM_INT (return canvas.getBoundingClientRect ().left );
350
350
float mouseY = mouseEvent->targetY - EM_ASM_INT (return canvas.getBoundingClientRect ().top );
351
351
int canvasWidth, canvasHeight;
@@ -359,7 +359,7 @@ EM_BOOL ofxAppEmscriptenWindow::mousedown_cb(int eventType, const EmscriptenMous
359
359
}
360
360
361
361
// ------------------------------------------------------------
362
- EM_BOOL ofxAppEmscriptenWindow::mouseup_cb (int eventType, const EmscriptenMouseEvent * mouseEvent, void * userData) {
362
+ int ofxAppEmscriptenWindow::mouseup_cb (int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData){
363
363
float mouseX = mouseEvent->targetX - EM_ASM_INT (return canvas.getBoundingClientRect ().left );
364
364
float mouseY = mouseEvent->targetY - EM_ASM_INT (return canvas.getBoundingClientRect ().top );
365
365
int canvasWidth, canvasHeight;
@@ -373,7 +373,7 @@ EM_BOOL ofxAppEmscriptenWindow::mouseup_cb(int eventType, const EmscriptenMouseE
373
373
}
374
374
375
375
// ------------------------------------------------------------
376
- EM_BOOL ofxAppEmscriptenWindow::mousemoved_cb (int eventType, const EmscriptenMouseEvent * mouseEvent, void * userData) {
376
+ int ofxAppEmscriptenWindow::mousemoved_cb (int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData){
377
377
float mouseX = mouseEvent->targetX - EM_ASM_INT (return canvas.getBoundingClientRect ().left );
378
378
float mouseY = mouseEvent->targetY - EM_ASM_INT (return canvas.getBoundingClientRect ().top );
379
379
int canvasWidth, canvasHeight;
@@ -393,13 +393,13 @@ EM_BOOL ofxAppEmscriptenWindow::mousemoved_cb(int eventType, const EmscriptenMou
393
393
}
394
394
395
395
// ------------------------------------------------------------
396
- EM_BOOL ofxAppEmscriptenWindow::mousescrolled_cb (int eventType, const EmscriptenWheelEvent * wheelEvent, void * userData) {
396
+ int ofxAppEmscriptenWindow::mousescrolled_cb (int eventType, const EmscriptenWheelEvent *wheelEvent, void *userData){
397
397
instance->events ().notifyMouseScrolled (ofGetMouseX (), ofGetMouseY (), wheelEvent->deltaX / 100 , wheelEvent->deltaY / 100 );
398
398
return 0 ;
399
399
}
400
400
401
401
// ------------------------------------------------------------
402
- EM_BOOL ofxAppEmscriptenWindow::mouseenter_cb (int eventType, const EmscriptenMouseEvent * mouseEvent, void * userData) {
402
+ int ofxAppEmscriptenWindow::mouseenter_cb (int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData){
403
403
float mouseX = mouseEvent->targetX - EM_ASM_INT (return canvas.getBoundingClientRect ().left );
404
404
float mouseY = mouseEvent->targetY - EM_ASM_INT (return canvas.getBoundingClientRect ().top );
405
405
int canvasWidth, canvasHeight;
@@ -411,7 +411,7 @@ EM_BOOL ofxAppEmscriptenWindow::mouseenter_cb(int eventType, const EmscriptenMou
411
411
}
412
412
413
413
// ------------------------------------------------------------
414
- EM_BOOL ofxAppEmscriptenWindow::mouseleave_cb (int eventType, const EmscriptenMouseEvent * mouseEvent, void * userData) {
414
+ int ofxAppEmscriptenWindow::mouseleave_cb (int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData){
415
415
float mouseX = mouseEvent->targetX - EM_ASM_INT (return canvas.getBoundingClientRect ().left );
416
416
float mouseY = mouseEvent->targetY - EM_ASM_INT (return canvas.getBoundingClientRect ().top );
417
417
int canvasWidth, canvasHeight;
@@ -423,7 +423,7 @@ EM_BOOL ofxAppEmscriptenWindow::mouseleave_cb(int eventType, const EmscriptenMou
423
423
}
424
424
425
425
// ------------------------------------------------------------
426
- EM_BOOL ofxAppEmscriptenWindow::touch_cb (int eventType, const EmscriptenTouchEvent * e, void * userData) {
426
+ int ofxAppEmscriptenWindow::touch_cb (int eventType, const EmscriptenTouchEvent* e, void * userData) {
427
427
float boundingX = EM_ASM_INT (return canvas.getBoundingClientRect ().left );
428
428
float boundingY = EM_ASM_INT (return canvas.getBoundingClientRect ().top );
429
429
int canvasWidth, canvasHeight;
0 commit comments