https://linen.dev logo
```hx FlxG.stage.window.onKeyDown.add((code, modif...
# lime
a
Copy code
hx
FlxG.stage.window.onKeyDown.add((code, modifier) ->
{
    if (code == A)
    {
        // get the data
        var image_pixels = FlxG.stage.window.readPixels(new Rectangle(0, 0, FlxG.stage.window.width, FlxG.stage.window.height));
        var image_bytes = image_pixels.encode();

        // write the data to disk
        var file = sys.io.File.write("test.png", true);
        file.writeBytes(image_bytes, 0, image_bytes.length);
        file.close();
    }
});
5 Views