Using Javascript from SpiderBasic
HPW
 
Posts: 34
Joined: Thu May 04, 2017 4:25 pm

Re: Babylon.js : Problem with the latest release

by HPW Fri Aug 10, 2018 6:26 am

Hello falsam,

Good News! Your test-code works for me.

Will you change your Demos to the new call-syntax?

For understanding: Does spiderbasic supprts 'require' itself? I does not find it in the docs.
Does requre supports an Event when the engine-loading is finished (for large extensions like Babylon.js)

Regards
poshu
 
Posts: 73
Joined: Mon Feb 24, 2014 11:46 pm

Re: Babylon.js : Problem with the latest release

by poshu Fri Aug 10, 2018 9:42 am

Anything starting with ! is inline javascript in SpiderBasic, so require is a js command, not a SB command.
HPW
 
Posts: 34
Joined: Thu May 04, 2017 4:25 pm

Re: Babylon.js : Problem with the latest release

by HPW Fri Aug 10, 2018 6:48 pm

Hello,
Thanks for the info.
....so require is a js command

But where does it come from. One of the used JavaScript Frameworks/extensions? Where can I find a doku about it?

Regards
User avatar
Peter
 
Posts: 553
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1

Re: Babylon.js : Problem with the latest release

by Peter Fri Aug 10, 2018 7:22 pm

HPW wrote:But where does it come from. One of the used JavaScript Frameworks/extensions? Where can I find a doku about it?

SpiderBasic is based on Dojo / Dojit (don't know which version), which has its own require implementation.

Greetings ... Peter
falsam
 
Posts: 269
Joined: Mon May 05, 2014 9:49 pm
Location: France

Re: Babylon.js : Problem with the latest release

by falsam Sat Aug 11, 2018 12:07 am

HPW wrote:Good News! Your test-code works for me.
That's what I thought! Look at your browser console :!:
HPW wrote:Will you change your Demos to the new call-syntax?
Unfortunately no

➽ Windows 10 - JDK 1.8 - SB 2.20 - Android 5.5
http://falsam.com

Sorry for my poor english
HPW
 
Posts: 34
Joined: Thu May 04, 2017 4:25 pm

Re: Babylon.js : Problem with the latest release

by HPW Sat Aug 11, 2018 6:37 am

Hlelo falsam,

Unfortunately no


But will you further work/support on it ?

Regards
HPW
 
Posts: 34
Joined: Thu May 04, 2017 4:25 pm

Re: Babylon.js : Problem with the latest release

by HPW Sat Aug 11, 2018 6:39 am

Hello Peter,

SpiderBasic is based on Dojo / Dojit (don't know which version), which has its own require implementation.


Thanks for the info. I will look there for the doku.

Regards
User avatar
Peter
 
Posts: 553
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1

Re: Babylon.js : Problem with the latest release

by Peter Thu Aug 23, 2018 9:50 pm

same version, but no more need for $&#§$ require :D

Code: Select all
;!  <HtmlPreprocessor>
;!    [
;!      {
;!        "search": "</title>",
;!        "replace": "</title>\n\n<script src='https://cdnjs.cloudflare.com/ajax/libs/babylonjs/3.2.0/babylon.js'></script>"
;!      }
;!    ]
;!  </HtmlPreprocessor>

Enumeration
  #mf
  #mfRender
EndEnumeration

Global BJSEngine, BJSCanvas, Scene

Declare InitEngine(Callback, CanvasGadget = #PB_Ignore)
Declare Start()
Declare InitGame()
Declare CreateScene()

Procedure InitEngine(Callback, CanvasGadget = #PB_Ignore)   
 
  ! if (BABYLON.Engine.isSupported()) {
     
      If CanvasGadget = #PB_Ignore   
        !$('<canvas>').attr('id', 'renderCanvas')
        ! .css({ width : '100%', height : '100%' })
        ! .appendTo('body');
      Else
        !var selector = $(spider_GadgetID(v_canvasgadget))[0].gadget
        !selector.id = "renderCanvas"
        !selector.style.width = '100%'
        !selector.style.height = '100%'
      EndIf
 
  !   v_bjscanvas = document.getElementById('renderCanvas');
  !   v_bjsengine = new BABYLON.Engine(v_bjscanvas, true, { preserveDrawingBuffer: true, stencil: true });
  !   window.addEventListener('resize', function(){v_bjsengine.resize(); }); 
  !   v_callback()
  ! } else {return false}
 
EndProcedure 

Start()

Procedure Start()
  OpenWindow(#mf, 0, 0, 800, 600, "Test", #PB_Window_ScreenCentered)
  CanvasGadget(#mfRender, 0, 0, 800, 600, #PB_Canvas_Transparent)
  InitEngine(@InitGame(), #mfRender)
EndProcedure

Procedure InitGame()
  Scene = CreateScene()
  !v_bjsengine.runRenderLoop(f_renderscene)
EndProcedure

Procedure CreateScene()
  !var scene = new BABYLON.Scene(v_bjsengine);
 
  !var camera = new BABYLON.ArcRotateCamera("Camera", 3 * Math.PI / 4, Math.PI / 4, 4, BABYLON.Vector3.Zero(), scene);
  !camera.attachControl(v_bjscanvas, true);
 
  !var light = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(1, 1, 0), scene);
 
  !var box = BABYLON.MeshBuilder.CreateBox("box", {}, scene);
  !return scene
EndProcedure

Procedure RenderScene()
    !v_scene.render();
EndProcedure


(yes, i want to promote my tool ;-))

Greetings ... Peter
HPW
 
Posts: 34
Joined: Thu May 04, 2017 4:25 pm

Re: Babylon.js : Problem with the latest release

by HPW Fri Aug 24, 2018 2:24 pm

Hello Peter,

I do not get it. Do I Need a tool from you to get it work?
This snippet only open an empty page.
And falsam was right, with his snippet the consoe show Errors.
Still interested how to load big js-frameworks correctly into sb.

Regards
User avatar
Peter
 
Posts: 553
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1

Re: Babylon.js : Problem with the latest release

by Peter Fri Aug 24, 2018 2:39 pm

HPW wrote:Do I Need a tool from you to get it work?

yes. This one: viewtopic.php?f=9&t=1543

Greetings ... Peter
Return to Javascript

Who is online

Users browsing this forum: No registered users and 0 guests