Pick one of the samples (like “BunnyMark”) and run npm install to setup dependencies:
cd openfl-samples-ts/BunnyMark
npm install
Start a dev server
npm start
The project should compile, and open a browser window. Hot reloading is enabled, so make changes to the source *.ts files, and the project will automatically rebuild, and the window will reload.
All of the code (in these samples) run on the client, but if users are interested in making code work from a server (such as Node.js) then we may make some improvements to better support that (long-term)
The Stage constructor was (window:Window, background:Int), and still is in some code. I plan on unifying this more in the future, but for now, I believe that when using the NPM version of OpenFL, it should not hit the second case unless you pass a bad parameter to the first argument.
I have just updated the OpenFL library on NPM, with support for setting the renderer type in the constructor.
We use OpenGL (WebGL) by default, but now you should be able to choose a different renderer type:
var stage = new Stage (550, 400, 0xFFFFFF, App, { renderer: "canvas" });
var stage = new Stage (550, 400, 0xFFFFFF, App, { renderer: "webgl1" });
var stage = new Stage (550, 400, 0xFFFFFF, App, { renderer: "dom" });
We use "webgl" (or "opengl") by default, which uses WebGL 2 if available, and falls back to canvas if WebGL is not available. Using a different value can force use of WebGL 1 only, or using a 2D canvas (even if WebGL is available).
I want to set this canvas to be transparent, but this color can’t be set to transparent. @singmajesty
Whether this parameter can be modified to a string type (‘rgba(0,0,0,0)’).
I forgot to enable the stencil buffer on our WebGL builds
(If you use OpenFL from source, I just added an npm run watch command, so it can recompile our CommonJS modules automatically upon changes to the source. It rebuilds all our files for now, but in the future we can probably improve it more)
EDIT: OpenFL has been updated on NPM with this fix