Page 1 of 1

Understanding SpiderBasic

Posted: Wed Dec 24, 2014 9:28 pm
by J. Baker
I'm not fully understanding SpiderBasic's coding method. I've opened the "Screen.sb" example. I see after the OpenScreen(), the Procedures are written but never called upon as in PureBasic. Then sprites are either loaded or created. How can a sprite be loaded at the bottom of the code but it's already being used in a procedure above? This only concerns me as I'm use to writing events as they happen in order.

Re: Understanding SpiderBasic

Posted: Wed Dec 24, 2014 10:20 pm
by the.weavster
The procedures are bound to events as callbacks (line 111).

Code: Select all

; Register the loading event before calling any resource load command
BindEvent(#PB_Event_Loading, @Loading())
BindEvent(#PB_Event_LoadingError, @LoadingError())
BindEvent(#PB_Event_RenderFrame, @RenderFrame())
So if, for example, LoadSprite() failed LoadingError() would be called.

Re: Understanding SpiderBasic

Posted: Thu Dec 25, 2014 3:15 am
by J. Baker
Sorry but maybe I didn't explain topic very well. I see the loading event but even this event is called before the actual loaded or created sprite? I guess I would have preferred for SpiderBasic's syntax to be a little more like PureBasic. Then again, I guess Fred possibly had to write it this way in order for it to be converted for the web.

Re: Understanding SpiderBasic

Posted: Thu Dec 25, 2014 8:48 am
by the.weavster
J. Baker wrote:Sorry but maybe I didn't explain topic very well. I see the loading event but even this event is called before the actual loaded or created sprite?
No, it's bound before LoadSprite() but it's not called unless/until the specified event actually occurs. If you didn't bind the callback to the event until after calling LoadSprite() you'd miss the event being fired.

J. Baker wrote:I guess I would have preferred for SpiderBasic's syntax to be a little more like PureBasic.
This methodology is available in PureBasic.

Re: Understanding SpiderBasic

Posted: Thu Dec 25, 2014 12:43 pm
by the.weavster
Ive just updated my "Hello World" to take into account some new events that have appeared in SpiderBasic.

You should be able to run this code with SpiderBasic and PureBasic without needing any changes.

Re: Understanding SpiderBasic

Posted: Mon Dec 29, 2014 3:51 pm
by IdeasVacuum
I don't understand the purpose of Spider Basic. The intro in the help basically describes Spider Basic as a rival to Pure Basic.......

So, it would be nice if Fred could take the time to say exactly what Spider Basic is for, what it is intended to do etc.

Re: Understanding SpiderBasic

Posted: Mon Dec 29, 2014 8:39 pm
by the.weavster
IdeasVacuum wrote:I don't understand the purpose of Spider Basic. The intro in the help basically describes Spider Basic as a rival to Pure Basic.......
PureBasic can be compiled for Linux, Windows and OSX running on an x86 processor. SpiderBasic runs in a browser which will take it to many more platforms.

But even if you're only interested in x86 desktops there are still scenarios where SpiderBasic has advantages, let's say you've written a program that's going to be used by twenty employees in the company you work for and that program connects to an ODBC database, with PureBasic you've got twenty installs to do and twenty DSNs to set up, when you update your program you've again got twenty workstations to update. Now consider SpiderBasic in this scenario, you've only got one install to do, one DSN to set up and only one computer to apply updates to, the twenty workstations just need a bookmark.

I also guess the time will come when SpiderBasic can be used with Apache Cordova to create apps for Android, iOS, Tizen, BB10 and Windows Phone.

Re: Understanding SpiderBasic

Posted: Tue Dec 30, 2014 10:13 am
by Fred
Yes, it's not a rival to PB, but more a complement to it. Depending of what your app needs, using SB could be the right choice to have it working on any device having a (modern) browser

Re: Understanding SpiderBasic

Posted: Sun Feb 01, 2015 5:56 pm
by fsw
the.weavster wrote:But even if you're only interested in x86 desktops there are still scenarios where SpiderBasic has advantages, let's say you've written a program that's going to be used by twenty employees in the company you work for and that program connects to an ODBC database, with PureBasic you've got twenty installs to do and twenty DSNs to set up, when you update your program you've again got twenty workstations to update. Now consider SpiderBasic in this scenario, you've only got one install to do, one DSN to set up and only one computer to apply updates to, the twenty workstations just need a bookmark.
Normally a company with 20 employees has a server.
The database program resides on the server and is accessed by 20 employees through a shortcut on their desktop.
No need to install it on each employee's workstation.

The DNS setup still needs to be done though...