Mercurial > molko
diff README.md @ 447:e1fa1b867281
cmake: resurrection
Using GNU make for such a big project is tedious.
author | David Demelier <markand@malikania.fr> |
---|---|
date | Sat, 18 Feb 2023 12:43:05 +0100 |
parents | 2862526f1fc9 |
children | e070fdcc592b |
line wrap: on
line diff
--- a/README.md Sat Feb 18 12:15:14 2023 +0100 +++ b/README.md Sat Feb 18 12:43:05 2023 +0100 @@ -11,8 +11,54 @@ - Simple, flexible, - Well documented, - Virtual file system support. +- Usable in both C or Javascript. - Can embed resources using `mlk-bcc`. +Javascript quick startup +------------------------ + +The `mlk-run` executable exposes the Javascript API and start a game from a +directory or a .mlk file (which is a .zip file with a .mlk extension). + +Hello world in Javascript: + + mkdir superluigi + +Add the following content in superluigi/main.js: + +```js +var w = new Window("Super Luigi, number one", 640, 480); +var run = true; + +while (run) { + var ev; + + while ((ev = Event.poll())) { + switch (ev.type) { + case Event.Type.QUIT: + run = false; + break; + default: + break; + } + + Painter.color = 0xFFFFFFFF; + Painter.clear(); + Painter.present(); + } +} +``` + +Finally run the game using `mlk-run superluigi`. + +You can also create a .zip file with a .mlk extension and `mlk-run` will be able +to use content from it. + + cd superluigi + zip -r ../superluigi.mlk . + cd .. + mlk-run superluigi.mlk + Documentation -------------