job = Dispatch.onUpdate(...);Dispatch.cancel(job);
// Call from event loop ASAP:jobToken = Dispatch.now(func);// Call from event loop in X seconds:jobToken = Dispatch.later(2.0, function() { pig.eat(you); });// Call at the start of every frame:jobToken = Dispatch.onUpdate(function() { pig.hunger++; });// Call at the end of every frame (just before flip). These can have priority and// higher priority jobs are rendered later in a frame according to the painter's// algorithm:jobToken = Dispatch.onRender(function() { pig.draw(); });jobToken = Dispatch.onRender(function() { pig.draw(); }, 8); // priority 8.0// Cancel an active job:Dispatch.cancel(jobToken);
Ohh, I see. It just seemed sensible to me that updates can also be executed in some specific order, just like renderscripts. Like updating the player position before or after checking enemy interactions, for example. But i see why you would give renderscripts specifically an order - it determines what overlaps what after all.
screen.frameRate = 60; // 60 fpsscreen.frameRate = Infinity; // unthrottledscreen.frameRate = 0; // RangeError: invalid frame rate
screen.fullScreen = !screen.fullScreen;
import { FileReader, FileWriter } from 'struct';function saveGame(world){ var stream = new FileStream("~/saveFile.dat", FileMode.Write); var fw = new FileWriter(stream); fw.writeString8(world.playerName); // etc. etc.}
com.authorname.gamename