Good afternoon. I am making a game for Sber devices (All Sber technologies are here). The game should work on consoles or on TVs. Management occurs through the remote control.
Since the devices are rather weak, html5 is not suitable, and the apk generated by Defold gives a stable 60 fps
I have a problem with the back key. it is not defined as KEY_BACK, but gives a message to the “back” system
In html5 I would do this:
window.history.pushState({name: "start"}, "");
window.addEventListener("popstate", e => {
e.preventDefault();
console.log("state:" + e.state);
if (e.state == null) {
jsToDef.send("KeyPressed", {
key: event.keyCode
type: "back"
})
window.history.pushState({name: "start"}, "");
}
}, true);
And how can I do this in Defold for android:
I think that my problem is not so rare because a lot of games are made for TVs, and there is a similar situation with the back key.