I did a similar approach too! But some of the key nnames were different. There were 'Left/Right Alt/Control/Shift', (yeah ctrl was spelled control) 'Return' instead of 'Enter', etc. So some string conversion had to be done. I am left with invalid key references for saved games tho. Maybe a JS script convert from * to Sphere and Sphere to *? That might take some work, lol. I wonder if it's a constant off or altogether mixed up? I'm tempted to do something like: "key_code + n = sphere_key_code"
Alright, I just added joysticks. It can support up to 8 (currently), joysticks at a time. It can also auto-detect a plugged-in joystick. Vanilla Sphere could not: you had to restart the game engine.
Also, my windowstyle test crashes in Sphere v1.6 and in Sphere v1.5 but not my my sphere-sfml. It has to do with WindowStyle.clone();
// Purpose: Tests the speed and efficiency of images.
function TestWindows()
{
var done = false;
var wind = LoadWindowStyle("main.rws");
var wind2 = wind.clone();
var blue = CreateColor(0, 0, 255);
var white = CreateColor(255, 255, 255);
var time = 0, i = 1, x = 0, y = 0;
while (!done) {
wind.drawWindow(32, 32, 80, 80);
wind.setColorMask(blue);
wind.drawWindow(128, 32, 80, 80);
wind2.drawWindow(32, 128, 80 + x, 80 + y);
wind.setColorMask(white);
if (time + 25 < GetTime()) {
if (x == 100 || x == -4) i *= -1;
x += 4 * i;
y += i;
time = GetTime();
}
FlipScreen();
while (AreKeysLeft()) {
if (GetKey() == KEY_ENTER) done = true;
}
}
}
I cannot believe Sphere does not have a clone method for windowstyles when it does have one for most other objects. Removing the offending windowstyles makes it run in Sphere 1.5, but it crashes after 5 seconds in sphere 1.6. There you have it folks: Sphere 1.6 is very unstable. Oh! Now I know why Blockman randomly crashes, it too grows and shrinks windowstyles.