One Program, Two Platforms!
Did you know that with Small Basic v0.8, you can write a program or a game and have it run identically on both your desktop and the browser? This makes it super easy to share your games with your friends (even those that may be running a Mac).
In fact it is so easy that you can have your program deployed, hosted and running on a browser with just one click of a button! So easy that it might actually be the fastest and friction free authoring environment for Silverlight.
Here’s an example. Take this simple program I wrote, which animates a bunch of balls on screen.
For i = 1 To 100 balls[i] = Shapes.AddEllipse(10, 10) EndFor While "True" For i = 1 To 100 ball = balls[i] x = Math.GetRandomNumber(640) y = Math.GetRandomNumber(480) Shapes.Animate(ball, x, y, 2000) EndFor Program.Delay(1900) EndWhile
When you run this program from Small Basic, you’ll see a window like this, running on your desktop:
When you are ready to share this program with the world, you simply hit the “Publish” button and voila the program is deployed to a Silverlight hosted website. Check it out for yourself here: http://smallbasic.com/program/?HNV340
Not only can you see your program run on this website, you can also host it on your own website or blog. Here’s the HTML code to host this little program on your website:
<object id='sbapp' data='data:application/x-silverlight-2,' type='application/x-silverlight-2' width='640' height='480'><param name='source' value='http://smallbasic.com/program/ClientBin/SBWeb.xap'/><param name='onError' value='onSilverlightError' /><param name='background' value='white' /><param name='minRuntimeVersion' value='3.0.40624.0' /><param name='autoUpgrade' value='true' /><param name='initParams' value='programId=HNV340' /></object>
Have fun creating Silverlight apps and games from Small Basic. And don’t forget to share it with your friends!