Permalink
Browse files

loaded image grid, need to finish including google material icons and…

… to add functionality to the grid
  • Loading branch information...
1 parent 7392ea4 commit 582403410c7b6c54fc498ee9ed45cd2a598d9af1 Abdallah Soliman committed Jul 4, 2016
Showing with 131 additions and 84 deletions.
  1. +42 −47 index.html
  2. +1 −1 opus
  3. +45 −0 static/css/style.css
  4. BIN static/fonts/MaterialIcons-Regular.woff
  5. +43 −36 static/js/index.js
View
@@ -1,24 +1,23 @@
<!DOCTYPE html>
<html>
-<head>
- <meta http-equiv="Pragma" content="no-cache">
- <meta http-equiv="Expires" content="-1">
- <title>Moonlight</title>
- <!-- <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> -->
- <link rel="stylesheet" href="static/css/material.min.css">
- <link rel="stylesheet" href="static/css/style.css">
-</head>
-<body data-name="moonlight-chrome" data-tools="pnacl" data-configs="Debug Release" data-path="{tc}/{config}">
- <div class="mdl-layout mdl-js-layout mdl-layout--fixed-header">
- <header class="mdl-layout__header">
- <div class="mdl-layout__header-row">
- <!-- Title -->
- <span class="mdl-layout-title">Moonlight</span>
- <!-- Add spacer, to align navigation to the right -->
- <div class="mdl-layout-spacer"></div>
- </div>
- </header>
- <main id="main-content" class="mdl-layout__content">
+ <head>
+ <meta http-equiv="Pragma" content="no-cache">
+ <meta http-equiv="Expires" content="-1">
+ <title>Moonlight</title>
+ <link rel="stylesheet" href="static/css/material.min.css">
+ <link rel="stylesheet" href="static/css/style.css">
+ </head>
+ <body data-name="moonlight-chrome" data-tools="pnacl" data-configs="Debug Release" data-path="{tc}/{config}">
+ <div class="mdl-layout mdl-js-layout mdl-layout--fixed-header">
+ <header class="mdl-layout__header">
+ <div class="mdl-layout__header-row">
+ <!-- Title -->
+ <span class="mdl-layout-title">Moonlight</span>
+ <!-- Add spacer, to align navigation to the right -->
+ <div class="mdl-layout-spacer"></div>
+ </div>
+ </header>
+ <main id="main-content" class="mdl-layout__content">
<div id="streamSettings">
<div class="mdl-select">
@@ -60,11 +59,7 @@
</div>
</div>
- <div id="gameSelection" class="mdl-select">
- <p>Select a game to run</p>
- <select id="selectGame"> </select>
- <button class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored" id="startGameButton">Run Game</button>
- <button class="mdl-button mdl-js-button mdl-button--raised mdl-button--accent" id="quitGameButton">Quit Current Game</button>
+ <div id="game-grid" class="mdl-grid">
</div>
<div id="listener"></div> <!-- NaCl module placeholder. NaCl gets thrown into here -->
@@ -76,43 +71,43 @@ <h5 id="loadingMessage"></h5>
<div id="naclSpinner" class="mdl-progress mdl-js-progress mdl-progress__indeterminate">
<h5 id="naclSpinnerMessage"></h5>
</div>
- </main>
- </div>
- <script defer src="static/js/jquery-2.2.0.min.js"></script>
- <script defer src="static/js/material.min.js"></script>
- <script type="text/javascript" src="static/js/messages.js"></script>
- <script type="text/javascript" src="static/js/common.js"></script>
- <script type="text/javascript" src="static/js/index.js"></script>
- <script type="text/javascript" src="static/js/utils.js"></script>
- <script type="text/javascript" src="static/js/mdns-browser/dns.js"></script>
- <script type="text/javascript" src="static/js/mdns-browser/main.js"></script>
+ </main>
+ </div>
+ <script defer src="static/js/jquery-2.2.0.min.js"></script>
+ <script defer src="static/js/material.min.js"></script>
+ <script type="text/javascript" src="static/js/messages.js"></script>
+ <script type="text/javascript" src="static/js/common.js"></script>
+ <script type="text/javascript" src="static/js/index.js"></script>
+ <script type="text/javascript" src="static/js/utils.js"></script>
+ <script type="text/javascript" src="static/js/mdns-browser/dns.js"></script>
+ <script type="text/javascript" src="static/js/mdns-browser/main.js"></script>
- <dialog id="pairingDialog" class="mdl-dialog">
+ <dialog id="pairingDialog" class="mdl-dialog">
<h3 class="mdl-dialog__title">Pairing</h3>
<div class="mdl-dialog__content">
<p id="pairingDialogText">
- Please enter the number XXXX on the GFE dialog on the computer. This dialog will be dismissed once complete
+ Please enter the number XXXX on the GFE dialog on the computer. This dialog will be dismissed once complete
</p>
</div>
<div class="mdl-dialog__actions">
<button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored" id="cancelPairingDialog">Cancel</button>
</div>
- </dialog>
+ </dialog>
- <dialog id="replaceAppDialog" class="mdl-dialog">
+ <dialog id="replaceAppDialog" class="mdl-dialog">
<h3 class="mdl-dialog__title">Quit Running App?</h3>
<div class="mdl-dialog__content">
<p id="replaceAppDialogText">
- Y is already running. Would you like to quit Y to start X?
+ Y is already running. Would you like to quit Y to start X?
</p>
</div>
<div class="mdl-dialog__actions">
<button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored" id="cancelReplaceApp">No</button>
<button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored" id="continueReplaceApp">Yes</button>
</div>
- </dialog>
+ </dialog>
- <dialog id="addHostDialog" class="mdl-dialog">
+ <dialog id="addHostDialog" class="mdl-dialog">
<h3 class="mdl-dialog__title">Add PC Manually</h3>
<div class="mdl-dialog__content">
<p>IP Address or Hostname of Geforce PC</p>
@@ -126,11 +121,11 @@ <h3 class="mdl-dialog__title">Add PC Manually</h3>
<button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored" id="cancelAddHost">Cancel</button>
<button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-button--colored" id="continueAddHost">Continue</button>
</div>
- </dialog>
+ </dialog>
- <div id="snackbar" class="mdl-snackbar mdl-js-snackbar">
- <div class="mdl-snackbar__text"></div>
- <button id='snackButton' class="mdl-snackbar__action" type="button"></button> <!-- this button exists to suppress the snackbar warning. we're really using a toast. -->
- </div>
-</body>
+ <div id="snackbar" class="mdl-snackbar mdl-js-snackbar">
+ <div class="mdl-snackbar__text"></div>
+ <button id='snackButton' class="mdl-snackbar__action" type="button"></button> <!-- this button exists to suppress the snackbar warning. we're really using a toast. -->
+ </div>
+ </body>
</html>
Submodule opus updated 57 files
+6 −3 .gitignore
+19 −19 Makefile.am
+2 −2 celt/bands.c
+7 −3 celt/celt_decoder.c
+8 −5 celt/celt_encoder.c
+1 −2 celt/celt_lpc.c
+1 −1 celt/kiss_fft.c
+1 −1 celt/mathops.c
+40 −27 celt/pitch.c
+1 −1 celt/rate.c
+1 −1 celt/vq.c
+30 −9 configure.ac
+1 −0 doc/Makefile.am
+133 −37 doc/draft-ietf-codec-oggopus.xml
+112 −14 doc/draft-ietf-codec-opus-update.xml
+19 −23 doc/opus_in_isobmff.html
+1 −1 include/opus_defines.h
+1 −1 m4/opus-intrinsics.m4
+32 −29 silk/CNG.c
+3 −2 silk/NLSF_encode.c
+2 −1 silk/PLC.c
+1 −1 silk/decode_core.c
+13 −8 silk/fixed/burg_modified_FIX.c
+4 −4 silk/stereo_LR_to_MS.c
+5 −8 src/analysis.c
+3 −2 src/opus_demo.c
+11 −12 src/opus_encoder.c
+148 −25 src/opus_multistream_encoder.c
+24 −0 win32/.gitignore
+0 −264 win32/VS2010/celt.vcxproj
+0 −239 win32/VS2010/opus.vcxproj
+0 −169 win32/VS2010/opus_demo.vcxproj
+0 −325 win32/VS2010/silk_common.vcxproj
+0 −201 win32/VS2010/silk_fixed.vcxproj
+0 −253 win32/VS2010/silk_float.vcxproj
+0 −167 win32/VS2010/test_opus_api.vcxproj
+0 −171 win32/VS2010/test_opus_decode.vcxproj
+0 −171 win32/VS2010/test_opus_encode.vcxproj
+593 −0 win32/VS2015/celt.vcxproj
+0 −0 win32/VS2015/celt.vcxproj.filters
+86 −2 win32/VS2015/opus.sln
+591 −0 win32/VS2015/opus.vcxproj
+0 −0 win32/VS2015/opus.vcxproj.filters
+446 −0 win32/VS2015/opus_demo.vcxproj
+0 −0 win32/VS2015/opus_demo.vcxproj.filters
+664 −0 win32/VS2015/silk_common.vcxproj
+0 −0 win32/VS2015/silk_common.vcxproj.filters
+493 −0 win32/VS2015/silk_fixed.vcxproj
+0 −0 win32/VS2015/silk_fixed.vcxproj.filters
+594 −0 win32/VS2015/silk_float.vcxproj
+3 −3 win32/VS2015/silk_float.vcxproj.filters
+446 −0 win32/VS2015/test_opus_api.vcxproj
+0 −0 win32/VS2015/test_opus_api.vcxproj.filters
+454 −0 win32/VS2015/test_opus_decode.vcxproj
+0 −0 win32/VS2015/test_opus_decode.vcxproj.filters
+454 −0 win32/VS2015/test_opus_encode.vcxproj
+0 −0 win32/VS2015/test_opus_encode.vcxproj.filters
View
@@ -1,3 +1,36 @@
+@font-face {
+ font-family: 'Material Icons';
+ font-style: normal;
+ font-weight: 400;
+ src: local('Material Icons'),
+ local('MaterialIcons-Regular'),
+ url('../fonts/MaterialIcons-Regular.woff') format('woff'),
+}
+.material-icons {
+ font-family: 'Material Icons';
+ font-weight: normal;
+ font-style: normal;
+ font-size: 24px; /* Preferred icon size */
+ display: inline-block;
+ line-height: 1;
+ text-transform: none;
+ letter-spacing: normal;
+ word-wrap: normal;
+ white-space: nowrap;
+ direction: ltr;
+
+ /* Support for all WebKit browsers. */
+ -webkit-font-smoothing: antialiased;
+ /* Support for Safari and Chrome. */
+ text-rendering: optimizeLegibility;
+
+ /* Support for Firefox. */
+ -moz-osx-font-smoothing: grayscale;
+
+ /* Support for IE. */
+ font-feature-settings: 'liga';
+}
+
.mdl-layout__header-row {
color: #fff;
}
@@ -126,3 +159,15 @@ main {
width 100%;
border: none !important;
}
+.box-art {
+ background-color: transparent;;
+}
+.box-art > img {
+ padding: 0;
+ margin: 0;
+ width: 100%;
+ height: 100%;
+}
+.current-game {
+ border: 1px solid red;
+}
Binary file not shown.
View
@@ -55,8 +55,8 @@ function restoreUiAfterNaClLoad() {
function snackbarLog(givenMessage) {
console.log(givenMessage);
var data = {
- message: givenMessage,
- timeout: 2000
+ message: givenMessage,
+ timeout: 2000
};
document.querySelector('#snackbar').MaterialSnackbar.showSnackbar(data);
}
@@ -83,11 +83,11 @@ function moduleDidLoad() {
console.log('Returned error was: ' + failedCert);
}).then(function (ret) {
sendMessage('httpInit', [pairingCert.cert, pairingCert.privateKey, myUniqueid]).then(function (ret) {
- restoreUiAfterNaClLoad();
- }, function (failedInit) {
- console.log('ERROR: failed httpInit!');
- console.log('Returned error was: ' + failedInit);
- });
+ restoreUiAfterNaClLoad();
+ }, function (failedInit) {
+ console.log('ERROR: failed httpInit!');
+ console.log('Returned error was: ' + failedInit);
+ });
});
}
else {
@@ -106,7 +106,7 @@ function updateHost() {
if (host == null || host == "") {
host = $("#selectHost option:selected").val();
}
-
+
if(api && api.address != host) {
api = new NvHTTP(host, myUniqueid);
}
@@ -143,10 +143,10 @@ function pairTo(host, onSuccess, onFailure) {
}
onFailure();
}
-
+
snackbarLog('Pairing successful');
pairingDialog.close();
-
+
var hostSelect = $('#selectHost')[0];
for(var i = 0; i < hostSelect.length; i++) { // check if we already have the host.
if (hostSelect.options[i].value == host) onSuccess();
@@ -228,9 +228,9 @@ function continueAddHost() {
var inputHost = $('#dialogInputHost').val();
pairTo(inputHost,
- function() { document.querySelector('#addHostDialog').close() },
- function() {snackbarLog('pairing to ' + inputHost + ' failed!');}
- );
+ function() { document.querySelector('#addHostDialog').close() },
+ function() {snackbarLog('pairing to ' + inputHost + ' failed!');}
+ );
}
@@ -256,22 +256,29 @@ function showApps() {
}
api.getAppList().then(function (appList) {
- if ($('#selectGame').has('option').length > 0 ) {
- // there was already things in the dropdown. Clear it, then add the new ones.
- // Most likely, the user just hit the 'retrieve app list' button again
- $('#selectGame').empty();
+
+ // if game grid is populated, empty it
+ if($("#game-grid").children().length > 0) {
+ $("game-grid").empty();
}
+
appList.forEach(function (app) {
- $('#selectGame').append($('<option>', {value: app.id, text: app.title}));
+ api.getBoxArt(app.id).then(function (resolvedPromise) {
+ var imageBlob = new Blob([resolvedPromise], {type: "image/png"});
+ $("#game-grid").append($("<div>", {html:$("<img \>", {src: URL.createObjectURL(imageBlob), id: 'game-'+app.id }), class: 'box-art mdl-cell mdl-cell--3-col'}));
+ }, function (failedPromise) {
+ console.log(failedPromise)
+ });
+
});
- $("#selectGame").html($("#selectGame option").sort(function (a, b) { // thanks, http://stackoverflow.com/a/7466196/3006365
- return a.text.toUpperCase() == b.text.toUpperCase() ? 0 : a.text.toUpperCase() < b.text.toUpperCase() ? -1 : 1
- }));
-
if (api.currentGame != 0)
- $('#selectGame').val(api.currentGame);
+ $('#game-'+ api.currentGame).addClass(".current-game");
+
+ $("#streamSettings").hide();
+ $("#hostSettings").hide();
+ $(".mdl-layout__header-row").append("<button class='mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab'><i class='material-icons'>arrow_back</i></button>")
gameSelectUpdated(); // default the button to 'Resume Game' if one is running.
}, function (failedAppList) {
@@ -350,27 +357,27 @@ function startSelectedGame() {
if(api.currentGame == appID) // if user wants to launch the already-running app, then we resume it.
return api.resumeApp(rikey, rikeyid).then(function (ret) {
sendMessage('startRequest', [host, streamWidth, streamHeight, frameRate,
- bitrate.toString(), api.serverMajorVersion.toString(), rikey, rikeyid.toString()]);
+ bitrate.toString(), api.serverMajorVersion.toString(), rikey, rikeyid.toString()]);
}, function (failedResumeApp) {
console.log('ERROR: failed to resume the app!');
console.log('Returned error was: ' + failedResumeApp);
return;
});
api.launchApp(appID,
- streamWidth + "x" + streamHeight + "x" + frameRate,
- 1, // Allow GFE to optimize game settings
- rikey, rikeyid,
- 0, // Play audio locally too
- 0x030002 // Surround channel mask << 16 | Surround channel count
- ).then(function (ret) {
- sendMessage('startRequest', [host, streamWidth, streamHeight, frameRate,
+ streamWidth + "x" + streamHeight + "x" + frameRate,
+ 1, // Allow GFE to optimize game settings
+ rikey, rikeyid,
+ 0, // Play audio locally too
+ 0x030002 // Surround channel mask << 16 | Surround channel count
+ ).then(function (ret) {
+ sendMessage('startRequest', [host, streamWidth, streamHeight, frameRate,
bitrate.toString(), api.serverMajorVersion.toString(), rikey, rikeyid.toString()]);
- }, function (failedLaunchApp) {
- console.log('ERROR: failed to launch app with appID: ' + appID);
- console.log('Returned error was: ' + failedLaunchApp);
- return;
- });
+ }, function (failedLaunchApp) {
+ console.log('ERROR: failed to launch app with appID: ' + appID);
+ console.log('Returned error was: ' + failedLaunchApp);
+ return;
+ });
});
}

0 comments on commit 5824034

Please sign in to comment.