Understanding SpiderBasic
Understanding SpiderBasic
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.
www.posemotion.com
Mac: OS X 10.13.6 / 1.4GHz Intel Core 2 Duo / 2GB 1067MHz DDR3 / Nvidia 320M
PC: Win XP & Win 7 / AMD Athlon 64 4000+ / 3GB 333MHz DDR / Nvidia 720GT
Mac: OS X 10.13.6 / 1.4GHz Intel Core 2 Duo / 2GB 1067MHz DDR3 / Nvidia 320M
PC: Win XP & Win 7 / AMD Athlon 64 4000+ / 3GB 333MHz DDR / Nvidia 720GT
-
- Posts: 222
- Joined: Sat Mar 01, 2014 3:02 pm
Re: Understanding SpiderBasic
The procedures are bound to events as callbacks (line 111).
So if, for example, LoadSprite() failed LoadingError() would be called.
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())
Re: Understanding SpiderBasic
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.
www.posemotion.com
Mac: OS X 10.13.6 / 1.4GHz Intel Core 2 Duo / 2GB 1067MHz DDR3 / Nvidia 320M
PC: Win XP & Win 7 / AMD Athlon 64 4000+ / 3GB 333MHz DDR / Nvidia 720GT
Mac: OS X 10.13.6 / 1.4GHz Intel Core 2 Duo / 2GB 1067MHz DDR3 / Nvidia 320M
PC: Win XP & Win 7 / AMD Athlon 64 4000+ / 3GB 333MHz DDR / Nvidia 720GT
-
- Posts: 222
- Joined: Sat Mar 01, 2014 3:02 pm
Re: Understanding SpiderBasic
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: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?
This methodology is available in PureBasic.J. Baker wrote:I guess I would have preferred for SpiderBasic's syntax to be a little more like PureBasic.
-
- Posts: 222
- Joined: Sat Mar 01, 2014 3:02 pm
Re: Understanding SpiderBasic
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.
You should be able to run this code with SpiderBasic and PureBasic without needing any changes.
-
- Posts: 143
- Joined: Tue Feb 25, 2014 1:27 pm
Re: Understanding SpiderBasic
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.
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.
-
- Posts: 222
- Joined: Sat Mar 01, 2014 3:02 pm
Re: Understanding SpiderBasic
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.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.......
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
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
Normally a company with 20 employees has a server.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.
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...