Skip to content

Commit

Permalink
Do some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
wchill committed May 18, 2018
1 parent 6e2aa83 commit 0da3b54
Show file tree
Hide file tree
Showing 15 changed files with 756 additions and 2,081 deletions.
5 changes: 1 addition & 4 deletions docs/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ GEM
jekyll (~> 3.3)
jekyll-gist (1.5.0)
octokit (~> 4.2)
jekyll-git_metadata (0.2.0)
jekyll (~> 3.0)
jekyll-github-metadata (2.9.4)
jekyll (~> 3.1)
octokit (~> 4.0, != 4.4.0)
Expand Down Expand Up @@ -248,9 +246,8 @@ PLATFORMS

DEPENDENCIES
github-pages
jekyll-git_metadata
jekyll-relative-links
wdm (>= 0.1.0)

BUNDLED WITH
1.16.1
1.16.2
28 changes: 0 additions & 28 deletions docs/_layouts/play-test.html

This file was deleted.

32 changes: 17 additions & 15 deletions docs/_layouts/play.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@

<link rel="stylesheet" type="text/css" href="assets/css/gamepad.css">

<div id="gamepadStatusContainer">
<h3>Status:</h3>
<h4 id="gamepadStatus" class="inactive">Not connected</h4>
<h4 id="gamepadActive" class="inactive">It's not your turn</h4>
</div>
<div id="app" v-cloak>
<controller-select class="center-text min-padding" v-model="currentController" v-bind:gamepads="allControllers"></controller-select>
<server-status v-bind:state="connectState" v-on:request="requestTurn"></server-status>

<div id="statsContainer" style="float:right">
<component v-bind:is="currentControllerComponent" v-bind:gamepadindex="currentController" v-bind:gamepadname="gamepadName" v-bind:axes="axes" v-bind:buttons="buttons" v-on:update="onControllerUpdate"></component>

</div>
<div id="gamepadCanvasContainer">
<canvas class="gamepadCanvas" id="gamepadCanvas"></canvas>
<div id="help">{{content}}</div>
<notifications position="top center"/>
</div>

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://vuejs.org/js/vue.js"></script>
<script type="text/javascript">
window.vue = window.Vue; // quick fix for vue-notification
</script>
<script type="text/javascript" src="https://unpkg.com/vue-notification"></script>
<script type="text/javascript">
window.vueNotification = window["vue-notification"].default;
Vue.use(vueNotification);
</script>
<script src="assets/js/websocket.js"></script>
<script src="assets/js/stats.js"></script>
<script src="assets/js/PxGamepad.js"></script>
<script src="assets/js/PxLoader-all.js"></script>
<script src="assets/js/gamepad.js"></script>

<div id="help">{{content}}</div>
<script src="assets/js/bundle.js"></script>
20 changes: 10 additions & 10 deletions docs/assets/js/BaseController.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export let unsupportedController = {
};

export let baseController = {
props: ['gamepadindex', 'gamepadname', 'axes', 'buttons'],
props: ['gamepadindexes', 'gamepadname', 'axes', 'buttons'],
data: function() {
return {
spriteSheetUrl: 'assets/images/xboxGamepadSprites.png',
Expand Down Expand Up @@ -267,15 +267,6 @@ export let baseController = {
this.$emit('request');
}
},
created: function() {
// bit of a hack - I could use optionMergeStrategies but this works
let that = this;
if (this.overrides) {
Object.keys(this.overrides).map(function(key) {
that[key] = that.overrides[key];
});
}
},
mounted: function() {
if (this.experimental) {
this.$notify({
Expand All @@ -297,4 +288,13 @@ export let baseController = {
this.spriteSheetReady = false;
},
template: '<div><canvas class="gamepadCanvas" ref="gamepadCanvas"></canvas><img ref="spriteSheet" v-bind:src="spriteSheetUrl" style="display:none;" @load="imageLoaded"/><span class="center-text">Controller (( gamepadindex )): (( gamepadname ))</span><span class="center-text">Detected as: (( canonicalName ))</span></div>'
};

export let xboxController = {
mixins: [baseController],
data: function() {
return {
canonicalName: 'Xbox/XInput controller'
};
}
};
96 changes: 46 additions & 50 deletions docs/assets/js/DualshockController.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,33 @@ let dualShockControllerBase = {
mixins: [baseController],
data: function() {
return {
overrides: {
// TODO: Provide a spritesheet for this.
buttonMapping: {
faceDown: {val: switchButtons.B, index: 0},
faceRight: {val: switchButtons.A, index: 1},
faceLeft: {val: switchButtons.Y, index: 2},
faceUp: {val: switchButtons.X, index: 3},
leftTop: {val: switchButtons.L, index: 4},
rightTop: {val: switchButtons.R, index: 5},
leftTrigger: {val: switchButtons.ZL, index: 6, invisible: true},
rightTrigger: {val: switchButtons.ZR, index: 7, invisible: true},
select: {val: switchButtons.MINUS, index: 8},
start: {val: switchButtons.PLUS, index: 9},
leftStick: {val: switchButtons.L3, index: 10, invisible: true},
rightStick: {val: switchButtons.R3, index: 11, invisible: true}
},
dpadMapping: {
dpadUp: {index: 12},
dpadDown: {index: 13},
dpadLeft: {index: 14},
dpadRight: {index: 15}
},
stickMapping: {
leftStick: {axisX: 0, axisY: 1, index: 10},
rightStick: {axisX: 2, axisY: 3, index: 11}
},
canonicalName: 'DualShock Controller',
experimental: true
}
// TODO: Provide a spritesheet for this.
buttonMapping: {
faceDown: {val: switchButtons.B, index: 0},
faceRight: {val: switchButtons.A, index: 1},
faceLeft: {val: switchButtons.Y, index: 2},
faceUp: {val: switchButtons.X, index: 3},
leftTop: {val: switchButtons.L, index: 4},
rightTop: {val: switchButtons.R, index: 5},
leftTrigger: {val: switchButtons.ZL, index: 6, invisible: true},
rightTrigger: {val: switchButtons.ZR, index: 7, invisible: true},
select: {val: switchButtons.MINUS, index: 8},
start: {val: switchButtons.PLUS, index: 9},
leftStick: {val: switchButtons.L3, index: 10, invisible: true},
rightStick: {val: switchButtons.R3, index: 11, invisible: true}
},
dpadMapping: {
dpadUp: {index: 12},
dpadDown: {index: 13},
dpadLeft: {index: 14},
dpadRight: {index: 15}
},
stickMapping: {
leftStick: {axisX: 0, axisY: 1, index: 10},
rightStick: {axisX: 2, axisY: 3, index: 11}
},
canonicalName: 'DualShock Controller',
experimental: true
};
}
};
Expand All @@ -46,27 +44,25 @@ export let dualShockControllerWinFirefox = {
mixins: [dualShockControllerBase],
data: function() {
return {
overrides: {
buttonMapping: {
faceLeft: {index: 0},
faceDown: {index: 1},
faceRight: {index: 2},
faceUp: {index: 3}
},
dpadMapping: {
// Remap the guide button to index 12
// The other buttons don't seem to work, so leave them blank.
dpadUp: {index: 13},
dpadDown: {index: 12},
dpadLeft: {},
dpadRight: {}
},
stickMapping: {
leftStick: {axisX: 0, axisY: 1, index: 10},
rightStick: {axisX: 2, axisY: 5, index: 11}
},
notifyMessage: 'The D-Pad does not work properly in Firefox on Windows. The touchpad has been mapped to D-Pad Up. If this doesn\'t work for you, try using Chrome.'
}
buttonMapping: {
faceLeft: {index: 0},
faceDown: {index: 1},
faceRight: {index: 2},
faceUp: {index: 3}
},
dpadMapping: {
// Remap the guide button to index 12
// The other buttons don't seem to work, so leave them blank.
dpadUp: {index: 13},
dpadDown: {index: 12},
dpadLeft: {},
dpadRight: {}
},
stickMapping: {
leftStick: {axisX: 0, axisY: 1, index: 10},
rightStick: {axisX: 2, axisY: 5, index: 11}
},
notifyMessage: 'The D-Pad does not work properly in Firefox on Windows. The touchpad has been mapped to D-Pad Up. If this doesn\'t work for you, try using Chrome.'
};
}
};
Loading

0 comments on commit 0da3b54

Please sign in to comment.