Hello,
I want to add an entry in the title menu to open an URL, using the player's browser. I have the code to do that, but when I open the URL, I cannot interact anymore with the game, as if I lost the focus. I can still refresh the game with F5, I can still here the main menu music playing, but I can't scroll, or anything in the menu.
There may be a subtlety that I did not understand.
I want to add an entry in the title menu to open an URL, using the player's browser. I have the code to do that, but when I open the URL, I cannot interact anymore with the game, as if I lost the focus. I can still refresh the game with F5, I can still here the main menu music playing, but I can't scroll, or anything in the menu.
JavaScript:
(function () {
var commandList = Window_TitleCommand.prototype.makeCommandList;
Window_TitleCommand.prototype.makeCommandList = function () {
commandList.call(this);
this.addCommand("CLICK ME", 'openURL');
};
var commandWindow = Scene_Title.prototype.createCommandWindow;
Scene_Title.prototype.createCommandWindow = function () {
commandWindow.call(this);
this._commandWindow.setHandler('openURL', this.commandOpenURL.bind(this));
};
Scene_Title.prototype.commandOpenURL = function () {
require('nw.gui').Shell.openExternal('https://example.com/');
};
})();
There may be a subtlety that I did not understand.