nakamichi and jtnewman pretty much nailed the intent of the project. I intend to make development of homebrew easier for people without much experience in programming. People who use this will also avoid having to setup a unix-ish environment and cross compiler.
DS stands for DreamScript. I have ported the KJS JavaScript engine found in KDE's web browser, Knoquerer, with promising results. So far, I have implemented objects for video, images, controllers, and mice and I've done a some simple tests.
I've always liked JavaScript. It has a nice syntax similar to C/C++, useful core objects, and is very flexible. The way I see it, it's a perfect candidate for a scripting language on DC. A good number of you have probably done web development which involved writing some JavaScript. So it's syntax and behavior should be well known.
Using a scripting language provides that extra layer that will allow me to write a PC based application that duplicates what would happen on the DC. So instead of constantly uploading your new script to the DC, you can test right on your PC until you are ready. And KJS easily makes true step-by-step debugging possible. So I will defintely write a cross platform IDE for DreamScript. Maybe in Java?
So far I only have 2D homebrew in mind. I'm not sure if the extra overhead of the script engine will allow for complex 3D games. I still have to find out the limits of scripting 2D.
If I keep the API generic enough, it could conceivably be ported to other systems in the future.
Here's a WIP document that gives a logical description of the classes and objects that will be available.
Code: Select all
DreamScript API Specification
by Scherzo
The following class and function definitions are only logical and are not any actually implementation of
any language.
class DSGlobal
{
enum { DM_320x240, DM_640x480, DM_800x608, DM_256x256, DM_768x480, DM_768x576 };
enum { FILE_READ, FILE_WRITE, FILE_BINARY };
}
// Completed!
class Image
{
Image();
String toString();
Boolean load(String fn, Number list, Number filtering, Number alpha);
Undefined unload();
Undefined draw(Number x, Number y, Number scale, Number a, Number z);
Undefined drawWH(Number x, Number y, Number width, Number height, Number a, Number z);
Undefined drawRotated(Number x, Number y, Number scale, Number a, Number z, Number pivotu, Number pivotv, Number angle);
String getFilename();
Number getWidth();
Number getHeight();
};
// Completed!
class Controller
{
Undefined poll();
Boolean a;
Boolean b;
Boolean x;
Boolean y;
Boolean start;
Boolean up;
Boolean down;
Boolean left;
Boolean right;
Number joyx;
Number joyy;
Number ltrig;
Number rtrig;
}
class Keyboard
{
Undefined poll();
}
// Completed!
class Mouse
{
Undefined poll();
Number dx;
Number dy;
Number dz;
Boolean lbutton;
Boolean rbutton;
Boolean sbutton;
}
singleton class Input
{
Boolean rescanDevices();
Array<Controller> pad;
Array<Keyboard> keyboard;
Array<Mouse> mouse;
}
singleton class Video
{
Boolean setMode(Number mode);
Number availableMemory();
String toString();
Undefined frameBegin();
Undefined frameFinish();
Undefined listBegin(Number list);
Undefined listFinish();
}
singleton class System
{
Number availableMemory();
}
singleton class Audio
{
Boolean init(Number freq = 44100, Boolean stereo = true);
Boolean shutdown();
}
class MP3
{
MP3();
Boolean load(String fn);
Boolean play();
Boolean stop();
}
class OGG
{
OGG();
Boolean load(String fn);
Boolean play();
Boolean stop();
}
class WAV
{
WAV();
Boolean load(String fn);
Boolean play(Number chan = -1); // between 2 and 63. -1 means next available channel
Boolean stop(Number chan = -1); // If -1 specified. Will stop play on lasst channel used
static Boolean stopAll();
}
singleton class FileSystem
{
Boolean resetCD();
}
class File
{
File();
Boolean open(String fn, String mode);
Undefined close();
Boolean seek(Number offset, Number origin);
Number tell();
Number ReadInt8();
Number ReadInt16();
Number ReadInt32();
Boolean WriteInt8(Number n);
Boolean WriteInt16(Number n);
Boolean WriteInt32(Number n);
String ReadString();
Boolean WriteString(String str);
String ReadChar();
static String ReadContents(String fn);
}
That covers it for now. I welcome any input.