From 193426e583dcaf4423a5f29a0f9297b0bf23231c Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Thu, 27 Jun 2013 21:37:05 -0400 Subject: doodeedoodeediddlydooo --- TODO | 5 + lighttpd.conf | 8 +- www/css/GentiumPlus.svg | 257 ------------------ www/css/GentiumPlus.ttf | Bin 32496 -> 0 bytes www/css/GentiumPlus.woff | Bin 15144 -> 0 bytes www/css/PlaytimeWithHotToddies.svg | 433 ------------------------------- www/css/PlaytimeWithHotToddies.ttf | Bin 46488 -> 0 bytes www/css/PlaytimeWithHotToddies.woff | Bin 29924 -> 0 bytes www/css/font/GentiumPlus.svg | 257 ++++++++++++++++++ www/css/font/GentiumPlus.ttf | Bin 0 -> 32496 bytes www/css/font/GentiumPlus.woff | Bin 0 -> 15144 bytes www/css/font/PlaytimeWithHotToddies.svg | 433 +++++++++++++++++++++++++++++++ www/css/font/PlaytimeWithHotToddies.ttf | Bin 0 -> 46488 bytes www/css/font/PlaytimeWithHotToddies.woff | Bin 0 -> 29924 bytes www/css/font/gentium.ttf | Bin 0 -> 362664 bytes www/css/font/playtime-webfont.svg | 229 ++++++++++++++++ www/css/font/playtime-webfont.ttf | Bin 0 -> 95952 bytes www/css/font/playtime-webfont.woff | Bin 0 -> 55584 bytes www/css/font/playtime.ttf | Bin 0 -> 71220 bytes www/css/font/playtime_bold.ttf | Bin 0 -> 47916 bytes www/css/gentium.ttf | Bin 362664 -> 0 bytes www/css/index.css | 68 +++-- www/css/playtime-webfont.svg | 229 ---------------- www/css/playtime-webfont.ttf | Bin 95952 -> 0 bytes www/css/playtime-webfont.woff | Bin 55584 -> 0 bytes www/css/playtime.ttf | Bin 71220 -> 0 bytes www/css/playtime_bold.ttf | Bin 47916 -> 0 bytes www/index.html | 63 +++-- www/js/api.js | 44 +++- www/js/html5ks.js | 41 ++- www/js/menu.js | 33 +++ 31 files changed, 1121 insertions(+), 979 deletions(-) delete mode 100644 www/css/GentiumPlus.svg delete mode 100644 www/css/GentiumPlus.ttf delete mode 100644 www/css/GentiumPlus.woff delete mode 100644 www/css/PlaytimeWithHotToddies.svg delete mode 100644 www/css/PlaytimeWithHotToddies.ttf delete mode 100644 www/css/PlaytimeWithHotToddies.woff create mode 100644 www/css/font/GentiumPlus.svg create mode 100644 www/css/font/GentiumPlus.ttf create mode 100644 www/css/font/GentiumPlus.woff create mode 100644 www/css/font/PlaytimeWithHotToddies.svg create mode 100644 www/css/font/PlaytimeWithHotToddies.ttf create mode 100644 www/css/font/PlaytimeWithHotToddies.woff create mode 100644 www/css/font/gentium.ttf create mode 100644 www/css/font/playtime-webfont.svg create mode 100644 www/css/font/playtime-webfont.ttf create mode 100644 www/css/font/playtime-webfont.woff create mode 100644 www/css/font/playtime.ttf create mode 100644 www/css/font/playtime_bold.ttf delete mode 100644 www/css/gentium.ttf delete mode 100644 www/css/playtime-webfont.svg delete mode 100644 www/css/playtime-webfont.ttf delete mode 100644 www/css/playtime-webfont.woff delete mode 100644 www/css/playtime.ttf delete mode 100644 www/css/playtime_bold.ttf create mode 100644 www/js/menu.js diff --git a/TODO b/TODO index 2cc70bc..ef98b89 100644 --- a/TODO +++ b/TODO @@ -1,2 +1,7 @@ +todo ordered by most to least important... ish + +- imachine +- menu +- extend - fix cursor to apply to all document - cache script.json files diff --git a/lighttpd.conf b/lighttpd.conf index f2df7b7..445c0e2 100644 --- a/lighttpd.conf +++ b/lighttpd.conf @@ -23,9 +23,13 @@ index-file.names = ("index.html") dir-listing.activate = "enable" -server.modules = ( "mod_compress", "mod_expire", "mod_setenv" ) +server.modules = ( "mod_expire", "mod_compress", "mod_setenv" ) -expire.url = ("/dump/" => "access plus 1 years", "/js/lib/" => "access plus 1 days") +expire.url = ("/dump/" => "access plus 1 years", + "/css/font/" => "access plus 7 days", + "/js/lib/" => "access plus 1 days", + "/scripts/" => "access plus 1 days", + "/" => "access plus 5 seconds") setenv.add-response-header += ( "Cache-Control" => "public" ) diff --git a/www/css/GentiumPlus.svg b/www/css/GentiumPlus.svg deleted file mode 100644 index 78dca99..0000000 --- a/www/css/GentiumPlus.svg +++ /dev/null @@ -1,257 +0,0 @@ - - - - -Created by FontForge 20110222 at Sun Jun 23 09:39:48 2013 - By alex -Copyright (c) 2003-2012, SIL International (http://scripts.sil.org/) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/www/css/GentiumPlus.ttf b/www/css/GentiumPlus.ttf deleted file mode 100644 index c27adb5..0000000 Binary files a/www/css/GentiumPlus.ttf and /dev/null differ diff --git a/www/css/GentiumPlus.woff b/www/css/GentiumPlus.woff deleted file mode 100644 index 5cbe4c0..0000000 Binary files a/www/css/GentiumPlus.woff and /dev/null differ diff --git a/www/css/PlaytimeWithHotToddies.svg b/www/css/PlaytimeWithHotToddies.svg deleted file mode 100644 index 820e79b..0000000 --- a/www/css/PlaytimeWithHotToddies.svg +++ /dev/null @@ -1,433 +0,0 @@ - - - - -Created by FontForge 20110222 at Sun Jun 23 09:57:41 2013 - By alex -Copyright (c) Fontype Freebies, 2004. All rights reserved. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/www/css/PlaytimeWithHotToddies.ttf b/www/css/PlaytimeWithHotToddies.ttf deleted file mode 100644 index 01835e8..0000000 Binary files a/www/css/PlaytimeWithHotToddies.ttf and /dev/null differ diff --git a/www/css/PlaytimeWithHotToddies.woff b/www/css/PlaytimeWithHotToddies.woff deleted file mode 100644 index d745c54..0000000 Binary files a/www/css/PlaytimeWithHotToddies.woff and /dev/null differ diff --git a/www/css/font/GentiumPlus.svg b/www/css/font/GentiumPlus.svg new file mode 100644 index 0000000..78dca99 --- /dev/null +++ b/www/css/font/GentiumPlus.svg @@ -0,0 +1,257 @@ + + + + +Created by FontForge 20110222 at Sun Jun 23 09:39:48 2013 + By alex +Copyright (c) 2003-2012, SIL International (http://scripts.sil.org/) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/css/font/GentiumPlus.ttf b/www/css/font/GentiumPlus.ttf new file mode 100644 index 0000000..c27adb5 Binary files /dev/null and b/www/css/font/GentiumPlus.ttf differ diff --git a/www/css/font/GentiumPlus.woff b/www/css/font/GentiumPlus.woff new file mode 100644 index 0000000..5cbe4c0 Binary files /dev/null and b/www/css/font/GentiumPlus.woff differ diff --git a/www/css/font/PlaytimeWithHotToddies.svg b/www/css/font/PlaytimeWithHotToddies.svg new file mode 100644 index 0000000..820e79b --- /dev/null +++ b/www/css/font/PlaytimeWithHotToddies.svg @@ -0,0 +1,433 @@ + + + + +Created by FontForge 20110222 at Sun Jun 23 09:57:41 2013 + By alex +Copyright (c) Fontype Freebies, 2004. All rights reserved. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/css/font/PlaytimeWithHotToddies.ttf b/www/css/font/PlaytimeWithHotToddies.ttf new file mode 100644 index 0000000..01835e8 Binary files /dev/null and b/www/css/font/PlaytimeWithHotToddies.ttf differ diff --git a/www/css/font/PlaytimeWithHotToddies.woff b/www/css/font/PlaytimeWithHotToddies.woff new file mode 100644 index 0000000..d745c54 Binary files /dev/null and b/www/css/font/PlaytimeWithHotToddies.woff differ diff --git a/www/css/font/gentium.ttf b/www/css/font/gentium.ttf new file mode 100644 index 0000000..a8c1756 Binary files /dev/null and b/www/css/font/gentium.ttf differ diff --git a/www/css/font/playtime-webfont.svg b/www/css/font/playtime-webfont.svg new file mode 100644 index 0000000..f63de50 --- /dev/null +++ b/www/css/font/playtime-webfont.svg @@ -0,0 +1,229 @@ + + + + +This is a custom SVG webfont generated by Font Squirrel. +Copyright : Copyright c Fontype Freebies 2004 All rights reserved +Foundry : Fontype Freebies + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/www/css/font/playtime-webfont.ttf b/www/css/font/playtime-webfont.ttf new file mode 100644 index 0000000..33917b3 Binary files /dev/null and b/www/css/font/playtime-webfont.ttf differ diff --git a/www/css/font/playtime-webfont.woff b/www/css/font/playtime-webfont.woff new file mode 100644 index 0000000..57867e2 Binary files /dev/null and b/www/css/font/playtime-webfont.woff differ diff --git a/www/css/font/playtime.ttf b/www/css/font/playtime.ttf new file mode 100644 index 0000000..a36000a Binary files /dev/null and b/www/css/font/playtime.ttf differ diff --git a/www/css/font/playtime_bold.ttf b/www/css/font/playtime_bold.ttf new file mode 100644 index 0000000..e730c2b Binary files /dev/null and b/www/css/font/playtime_bold.ttf differ diff --git a/www/css/gentium.ttf b/www/css/gentium.ttf deleted file mode 100644 index a8c1756..0000000 Binary files a/www/css/gentium.ttf and /dev/null differ diff --git a/www/css/index.css b/www/css/index.css index 7818403..23acff5 100644 --- a/www/css/index.css +++ b/www/css/index.css @@ -1,16 +1,16 @@ @font-face { font-family: "Playtime"; /* src: url("playtime.ttf"); */ - src: url("PlaytimeWithHotToddies.svg"); - src: url("PlaytimeWithHotToddies.ttf"); - src: url("PlaytimeWithHotToddies.woff"); + src: url("font/PlaytimeWithHotToddies.svg"); + src: url("font/PlaytimeWithHotToddies.ttf"); + src: url("font/PlaytimeWithHotToddies.woff"); } @font-face { font-family: "Gentium"; /* src: url("gentium.ttf"); */ - src: url("GentiumPlus.svg"); - src: url("GentiumPlus.ttf"); - src: url("GentiumPlus.woff"); + src: url("font/GentiumPlus.svg"); + src: url("font/GentiumPlus.ttf"); + src: url("font/GentiumPlus.woff"); } body { margin: 0; @@ -18,14 +18,22 @@ body { background: gray; font: 22px/27px Playtime, sans-serif; } +* { + -moz-user-select: -moz-none; + -webkit-user-select: none; + -ms-user-select: none; + user-select: none; +} +#container, #bg, #vid { + cursor: url("../dump/ui/mousecursor.png"), default; + position: absolute; + top: 50%; + left: 50%; +} #container { - cursor: url("/dump/ui/mousecursor.png"), auto; width: 800px; height: 600px; - position: absolute; - top: 50%; margin-top: -300px; - left: 50%; margin-left: -400px; } @keyframes toright { @@ -36,11 +44,6 @@ body { left: -190px; } } -#bg,#vid { - position: absolute; - width: 800px; - height: 600px; -} #who { color: black; position: absolute; @@ -55,10 +58,6 @@ body { position: absolute; top: 493px; left: 28px; - -moz-user-select: none; - -webkit-user-select: none; - -ms-user-select: none; - user-select: none; } #window-image { position: absolute; @@ -94,9 +93,10 @@ html.no-js #warn-container { width: 600px; z-index: 10; } -#notwork { - font: 28px/34px Playtime; +h2 { + font: 20px/28px Playtime; font-weight: bold; + opacity: 0.4; } html.no-js #warn li:not(#js) { display: none; } html.video #warn li#video { display: none; } @@ -106,10 +106,16 @@ html.csstransforms #warn li#csstransforms { display: none; } html.csstransitions #warn li#csstransitions { display: none; } html #warn li#html-svg-filter { display: none; } .button { - cursor: pointer; + display: block; +} +.button-enabled { +/* cursor: pointer; */ opacity: 0.4; } -.button:hover { +.button-disabled { + opacity: 0.1; +} +.button-enabled:hover { opacity: 1; } #gotit { @@ -118,3 +124,19 @@ html #warn li#html-svg-filter { display: none; } html.no-js #gotit { display: none; } +#main-menu-buttons .button { + margin: 4px; +} +input[type="checkbox"] { + display: none; +} +input[type="checkbox"] + span:before { + display: inline-block; + height: 19px; + width: 20px; + content: ""; + background: url("../dump/ui/bt-cf-unchecked.png") no-repeat left bottom; +} +input[type="checkbox"]:checked + span:before { + background: url("../dump/ui/bt-cf-checked.png") no-repeat left bottom; +} diff --git a/www/css/playtime-webfont.svg b/www/css/playtime-webfont.svg deleted file mode 100644 index f63de50..0000000 --- a/www/css/playtime-webfont.svg +++ /dev/null @@ -1,229 +0,0 @@ - - - - -This is a custom SVG webfont generated by Font Squirrel. -Copyright : Copyright c Fontype Freebies 2004 All rights reserved -Foundry : Fontype Freebies - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/www/css/playtime-webfont.ttf b/www/css/playtime-webfont.ttf deleted file mode 100644 index 33917b3..0000000 Binary files a/www/css/playtime-webfont.ttf and /dev/null differ diff --git a/www/css/playtime-webfont.woff b/www/css/playtime-webfont.woff deleted file mode 100644 index 57867e2..0000000 Binary files a/www/css/playtime-webfont.woff and /dev/null differ diff --git a/www/css/playtime.ttf b/www/css/playtime.ttf deleted file mode 100644 index a36000a..0000000 Binary files a/www/css/playtime.ttf and /dev/null differ diff --git a/www/css/playtime_bold.ttf b/www/css/playtime_bold.ttf deleted file mode 100644 index e730c2b..0000000 Binary files a/www/css/playtime_bold.ttf and /dev/null differ diff --git a/www/index.html b/www/index.html index 64950d5..a512b02 100644 --- a/www/index.html +++ b/www/index.html @@ -11,24 +11,24 @@ }; window.define.amd = {}; - - - - - - - - - - - - + + + + + + + + + + + + -
+
-
We use a lot of new features in this; your browser seems to have some issues...
+

We use a lot of new features in this; your browser seems to have some issues...

-
I know it's broken, let me play!
+
I know it's broken, let me play!
+
-
- + +
+
diff --git a/www/js/api.js b/www/js/api.js index 14d8335..e5a6a58 100644 --- a/www/js/api.js +++ b/www/js/api.js @@ -25,7 +25,7 @@ window.html5ks.api = { // TODO: fade var deferred = when.defer(), audio = html5ks.elements.audio[channel]; - audio.src = "/dump/" + (channel === "music" ? "bgm/" + html5ks.data.music[name] + ".ogg" : html5ks.data.sfx[name]); + audio.src = "dump/" + (channel === "music" ? "bgm/" + html5ks.data.music[name] + ".ogg" : html5ks.data.sfx[name]); audio.load(); audio.volume = fade ? 0 : 1; audio.play(); @@ -56,16 +56,30 @@ window.html5ks.api = { }, movie_cutscene: function (vid_src) { var deferred = when.defer(), - video = html5ks.elements.video; - video.src = "/dump/video/" + vid_src + ".webm"; + video = html5ks.elements.video, + src = "dump/video/" + vid_src + "."; + + if (Modernizr.video.webm) { + video.src = src + "webm"; + } else if (Modernizr.video.ogg) { + video.src = src + "ogg"; + } else if (Modernizr.video.h264) { + video.src = src + "mp4"; + } + video.load(); + video.style.display = "block"; video.play(); var done = function () { this.style.display = "none"; this.pause(); deferred.resolve(); }; - video.addEventListener("mouseup", done, false); + video.addEventListener("click", function (e) { + if (e.button === 0) { + done.call(this); + } + }, false); video.addEventListener("ended", done, false); video.addEventListener("error", function () { deferred.reject(this.error); @@ -81,10 +95,15 @@ window.html5ks.api = { var label = html5ks.data.script[target], i = 0; (function run() { - html5ks.api.runInst(label[i]).then(run, console.error); - i++; + if (label[i]) { + html5ks.api.runInst(label[i]).then(run, console.error); + i++; + } else { + html5ks.mainMenu(); + } }()); }, + window: function (action, transition) { var windw = html5ks.elements.window, deferred = when.defer(); @@ -96,6 +115,7 @@ window.html5ks.api = { deferred.resolve(action); return deferred.promise; }, + // NOT iscene scene: function (type, name) { var deferred = when.defer(), @@ -122,15 +142,20 @@ window.html5ks.api = { } img.onload = function () { console.debug("setting bg " + img.src); - html5ks.elements.bg.style.background = "url(" + img.src + ")"; + var bg = html5ks.elements.bg; + bg.style.background = "url(" + img.src + ") no-repeat 0 0 / cover black"; deferred.resolve(); }; img.onerror = function () { throw new Error("bg could not load"); }; - img.src = "/dump/" + image.image; + if (Modernizr.webp) { + image.image = image.image.replace(/\.[a-z]+$/, ".webp"); + } + img.src = "dump/" + image.image; return deferred.promise; }, + show: function () { var deferred = when.defer(); deferred.resolve(); @@ -141,9 +166,11 @@ window.html5ks.api = { deferred.resolve(); return deferred.promise; }, + with: function (transition, action) { return this.runInst(action); }, + runInst: function (inst) { var cmd = inst[0], args = inst.slice(1); @@ -163,6 +190,7 @@ window.html5ks.api = { } } }, + character: function (name, str) { var deferred = when.defer(), text = str, diff --git a/www/js/html5ks.js b/www/js/html5ks.js index 6c0234e..3291dab 100644 --- a/www/js/html5ks.js +++ b/www/js/html5ks.js @@ -35,7 +35,13 @@ who: document.getElementById("who"), say: document.getElementById("say"), bg: document.getElementById("bg"), - window: document.getElementById("window") + window: document.getElementById("window"), + mainMenu: document.getElementById("main-menu"), + dialogs: document.getElementById("dialogs"), + dialog: { + options: document.getElementById("options"), + return: document.getElementById("return") + } }; this.elements.audio.music.loop = true; this.elements.audio.ambient.loop = true; @@ -47,8 +53,8 @@ localStorage.persistent = JSON.stringify(this.persistent); }, scale: function () { - var newScale = 1; if (html5ks.persistent.settings.scale) { + var newScale = 1; var height = document.documentElement.clientHeight, width = document.documentElement.clientWidth; if (height / width <= 0.75) { // widescreen @@ -56,12 +62,22 @@ } else { newScale = width / 800; } - } else { - newScale = 1; + + var container = html5ks.elements.container; + container.style.webkitTransform = "scale(" + newScale + ")"; + container.style.mozTransform = "scale(" + newScale + ")"; + container.style.transform = "scale(" + newScale + ")"; + + var applyScale = function (el, scale) { + el.style.height = scale * 600 + "px"; + el.style.marginTop = "-" + scale * 300 + "px"; + el.style.width = scale * 800 + "px"; + el.style.marginLeft = "-" + scale * 400 + "px"; + } + + applyScale(html5ks.elements.bg, newScale); + applyScale(html5ks.elements.video, newScale); } - html5ks.elements.container.style.webkitTransform = "scale(" + newScale + ")"; - html5ks.elements.container.style.mozTransform = "scale(" + newScale + ")"; - html5ks.elements.container.style.transform = "scale(" + newScale + ")"; }, next: function () {}, initEvents: function () { @@ -69,6 +85,13 @@ this.elements.container.addEventListener("mouseup", function () { html5ks.next(); }, false); + var deselect = function () { + window.getSelection().collapse(this, 0); + }; + document.body.addEventListener("mousemove", deselect, true); + document.body.addEventListener("mouseup", deselect, true); + document.body.addEventListener("keyup", deselect, true); + this.menu.initEvents(); }, warnUnsupported: function () { if (!html5ks.persistent.settings.gotit) { @@ -101,7 +124,7 @@ winload: function () { this.fetch("script", "a1-monday").then(function () { html5ks.api.movie_cutscene("4ls").then(function () { - html5ks.api.iscene("en_NOP1") + html5ks.menu.mainMenu(); }); }); }, @@ -114,7 +137,7 @@ deferred.resolve(); } else { var xhr = new XMLHttpRequest(); - xhr.open("GET", "/scripts/script-" + name + ".json"); + xhr.open("GET", "scripts/script-" + name + ".json"); xhr.onreadystatechange = function () { script[name] = true; if (xhr.readyState === 4) { diff --git a/www/js/menu.js b/www/js/menu.js new file mode 100644 index 0000000..8d68fcd --- /dev/null +++ b/www/js/menu.js @@ -0,0 +1,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); + } +}; -- cgit v1.2.3-70-g09d2