UI text not visible in build

you can try this

import { Behaviour } from "@needle-tools/engine";
import { screenshot } from "@needle-tools/engine/engine/engine_utils_screenshot"

export class TakeAScreenshot extends Behaviour {

    start(): void {
        const data = screenshot(this.context, 1024, 512);
        if (typeof data === "string")
        {
            var a = document.createElement("a"); //Create <a>
            a.href = "data:image/png;base64," + data; //Image Base64 Goes here
            a.download = "Image.webp"; //File name Here
            a.click(); //Downloaded file
        }
    }
}

gotta go now unfortunately

ok that look s perfect, much thanks for your help Marcel

by user 1013817853725646862

I just implemented this exact functionality but when I click the download button, chrome says ‘check internet connection’ thus a failed download. Is this implementation current ?

by user 962902844049096704

Can you try this?

 setTimeout(()=> {
            const s = screenshot();
            saveImage(s, "test.png");
        }, 1000)

^ both methods can be imported from @needle-tools/engine

It’s working now! Thank you

by user 962902844049096704