MCPcopy Create free account
hub / github.com/crownengine/crown / run

Method run

src/device/main_html5.cpp:774–804  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

772 }
773
774 int run(DeviceOptions *opts)
775 {
776 emscripten_set_keypress_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, this, true, EmscriptenDevice::key_callback);
777 emscripten_set_keydown_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, this, true, EmscriptenDevice::key_callback);
778 emscripten_set_keyup_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, this, true, EmscriptenDevice::key_callback);
779
780 emscripten_set_mousedown_callback(CROWN_HTML5_CANVAS_NAME, this, true, EmscriptenDevice::mouse_callback);
781 emscripten_set_mouseup_callback(CROWN_HTML5_CANVAS_NAME, this, true, EmscriptenDevice::mouse_callback);
782 emscripten_set_mousemove_callback(CROWN_HTML5_CANVAS_NAME, this, true, EmscriptenDevice::mouse_callback);
783 emscripten_set_wheel_callback(CROWN_HTML5_CANVAS_NAME, this, true, EmscriptenDevice::wheel_callback);
784
785 emscripten_set_touchstart_callback(CROWN_HTML5_CANVAS_NAME, this, true, EmscriptenDevice::touch_callback);
786 emscripten_set_touchend_callback(CROWN_HTML5_CANVAS_NAME, this, true, EmscriptenDevice::touch_callback);
787 emscripten_set_touchmove_callback(CROWN_HTML5_CANVAS_NAME, this, true, EmscriptenDevice::touch_callback);
788 emscripten_set_touchcancel_callback(CROWN_HTML5_CANVAS_NAME, this, true, EmscriptenDevice::touch_callback);
789
790 emscripten_set_gamepadconnected_callback(&_joypad, true, Joypad::callback);
791 emscripten_set_gamepaddisconnected_callback(&_joypad, true, Joypad::callback);
792
793 emscripten_set_pointerlockchange_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, this, true, EmscriptenDevice::pointerlockchange_callback);
794 emscripten_set_pointerlockerror_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, this, true, EmscriptenDevice::pointerlockerror_callback);
795
796 emscripten_set_resize_callback(EMSCRIPTEN_EVENT_TARGET_WINDOW, this, true, EmscriptenDevice::resize_callback);
797
798 double width;
799 double height;
800 emscripten_get_element_css_size("#" CROWN_HTML5_CANVAS_NAME, &width, &height);
801 _queue.push_resolution_event(width, height);
802
803 return crown::main_runtime(*opts);
804 }
805};
806
807Joypad::Joypad(DeviceEventQueue &queue, EmscriptenDevice &device)

Callers 1

mainFunction · 0.45

Calls 1

main_runtimeFunction · 0.85

Tested by

no test coverage detected