summaryrefslogtreecommitdiff
path: root/www/js/menu.js
blob: 8d68fcdd5dd88e6a8a4ff16dce0fb7dd74f027b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
html5ks.menu = {
  mainMenu: function () {
    html5ks.api.stop("music");
    html5ks.api.stop("sound");
    html5ks.api.stop("ambient");
    html5ks.api.window("hide");
    html5ks.api.play("music", "music_menus");
    html5ks.elements.bg.style.background = "url(dump/ui/main/bg-main.png) 0 0 / cover";
    html5ks.elements.mainMenu.style.display = "block";
  },

  activeDialog: null,

  dialog: function (name) {
    this.activeDialog = html5ks.elements.dialog[name];
    this.activeDialog.style.display = "block";
    html5ks.elements.dialogs.style.display = "block";
  },

  initEvents: function () {
    document.getElementById("start").addEventListener("click", function () {
      html5ks.elements.mainMenu.style.display = "none";
      html5ks.api.iscene("en_NOP1");
    }, false);
    document.getElementById("options-button").addEventListener("click", function () {
      html5ks.menu.dialog("options");
    }, false);
    html5ks.elements.dialog.return.addEventListener("click", function (e) {
      html5ks.menu.activeDialog.style.display = "none";
      html5ks.elements.dialogs.style.display = "none";
    }, false);
  }
};