-
Notifications
You must be signed in to change notification settings - Fork 52
How it works
The Ethanon Engine virtual machine (e.g. machine.exe on Windows) starts by compiling and running main.angelscript placed in the project root directory. Eventually the main script file will #include
other source files as well.
Notice that .angelscript files must be encoded as UTF-8 with BOM.
Ethanon *.angelscript script files can be edited with SciTE, a text editor included in the SDK. SciTE can also execute (F5) and compile/build (F7) projects. The SciTE mod will highlight all AngelScript and Ethanon reserved global words, such as functions, objects and constants.
Just like many programming languages, a game starts from the main function:
[main.angelscript]
void main()
{
// loads my_scene.esc
LoadScene("scenes/my_scene.esc");
// hides the mouse cursor
HideCursor(true);
// set screen options
SetWindowProperties(
"Ethanon Engine", // window title
1024, 768, // screen size
true, // true=windowed / false=fullscreen
true, // true=enable vsync false=disable vsync
PF32BIT); // color format
}
Every Ethanon script must have a void main()
function. This function must be void
and should not have parameters.
LoadScene
is a global function that loads a scene from an ESC file. The code above loads my_scene.esc
and runs it in a regular game loop.
HideCursor
and SetWindowProperties
functions are EE's native globals too. They're called to setup window options, but both are optional. If the function SetWindowProperties
is ommited in the main
function, the core engine will use its internal defaults (normally defined in app.enml file).
SetWindowProperties
may be used at any time to change windows states such as changing screen size or toggling between windowed and full screen modes.