diff Platforms/WebAssembly/wasm-application.js @ 227:c8f11437a6fd am

getting ready for multiple viewports
author am@osimis.io
date Thu, 14 Jun 2018 13:28:40 +0200
parents 1fa4c65c7e1b
children 210c1ce8e1a6
line wrap: on
line diff
--- a/Platforms/WebAssembly/wasm-application.js	Thu Jun 14 12:32:08 2018 +0200
+++ b/Platforms/WebAssembly/wasm-application.js	Thu Jun 14 13:28:40 2018 +0200
@@ -47,26 +47,23 @@
 function InitializeWasmApplication(canvasId)
 {
   console.log("Initializing wasm-app");
-  viewport = new Stone.WasmViewport(StoneFrameworkModule, 'canvas');
-  viewport.Initialize();
 
-  /******************** */
+  console.log("Connecting C++ methods to JS methods");
   SetStartupParameter = StoneFrameworkModule.cwrap('SetStartupParameter', null, [ 'string', 'string' ]);
-  CreateWasmApplication = StoneFrameworkModule.cwrap('CreateWasmApplication', null, [ ], [ ]);
+  CreateWasmApplication = StoneFrameworkModule.cwrap('CreateWasmApplication', null, [ 'any' ], [ ]);
+  CreateCppViewport = StoneFrameworkModule.cwrap('CreateCppViewport', 'any', [ ], [ ]);
+  ReleaseCppViewport = StoneFrameworkModule.cwrap('ReleaseCppViewport', null, [ 'any' ], [ ]);
   StartWasmApplication = StoneFrameworkModule.cwrap('StartWasmApplication', null, [ ], [ ]);
-                                 
-  /******************** */
-
-  // NotifyGlobalParameter = StoneFrameworkModule.cwrap('NotifyGlobalParameter', null,
-  //                                      [ 'string', 'string' ]);
-  // ViewportUpdate = StoneFrameworkModule.cwrap('ViewportUpdate', null,
-  //                                      [ 'string' ]);
   WasmWebService_NotifySuccess = StoneFrameworkModule.cwrap('WasmWebService_NotifySuccess', null,
                                               [ 'number', 'string', 'array', 'number', 'number' ]);
   WasmWebService_NotifyError = StoneFrameworkModule.cwrap('WasmWebService_NotifyError', null,
                                             [ 'number', 'string', 'number' ]);
-  //NotifyRestApiGet = Module.cwrap('NotifyRestApiGet', null, [ 'number', 'array', 'number' ]);
   NotifyUpdateContent = StoneFrameworkModule.cwrap('NotifyUpdateContent', null, [  ]);
+                                 
+  console.log("Creating main viewport");
+
+  viewport = new Stone.WasmViewport(StoneFrameworkModule, 'canvas');
+  viewport.Initialize(CreateCppViewport());
 
   // Prevent scrolling
   document.body.addEventListener('touchmove', function(event) {