evenNumbers = from(listOfNumbers).where(v => v % 2 === 0);// print all the even numbers in listOfNumbers (live!)for (let n of evenNumbers) { console.log(n);}
import { Thread } from 'threads';class SomeEntity extends Thread{ constructor() { super({ priority: 812 }); // initialize entity } /* methods... */ on_update() { /* update stuff... */ } on_render() { /* render stuff... */ }}
let myEntity = new SomeEntity();myEntity.start(); // starts the thread runningmyEntity.stop(); // kills the threadmyEntity.join(); // blocks until thread dies
4.5.7 fixes the Sphere Studio project template so it compiles out of the box again.
I'm in the process of porting The Rainis Manuscript over to miniSphere. It seems very little is actually needed to get it to run, but I have noticed a few graphical bugs involving transparencies and fonts. It's been a few months since I ran it last since I'm still working on the game proper, but I could try it again if these are not known issues.
There indeed shouldn't be much effort needed to migrate - almost all of the Sphere 1.5 API is implemented. I tried to make it as painless as possible to phase in the new features too - in large part you can mix Sphere v1 and v2 functions freely (objects are not interchangeable, however).There's really only a handful of stuff that's not implemented, mostly some esoteric APIs like Complex() and a few surface blend modes (because they're impossible to implement with the OpenGL fixed-function pipeline), but otherwise everything should work correctly. There shouldn't be any issues with fonts though; what kind of bugs did you encounter there?
// main.js automatically generated by Sphere Studio// Vanilla compiler pluginfont1 = LoadFont("main.rfn");font2 = LoadFont("main.rfn");var c = CreateColor(255,0,128,255)font2.setColorMask(c);function game(){ var txt = "SeT GQwWoO!"; while (true) { font1.drawZoomedText(0,0,2,txt);//renders without alpha font2.drawZoomedText(0,20,2,txt);// .. font1.drawZoomedText(0,40,1,txt);//also renders without alpha font2.drawZoomedText(0,60,1, txt);// ... font1.drawText(0,80,txt);//Render correctly font2.drawText(0,100, txt);// .. FlipScreen(); }}