Skip to content

Commit

Permalink
Add L2, R2, L3, R3 mappings to keyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
sergystepanov committed Nov 26, 2023
1 parent aa10008 commit a77069a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion web/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ body {
color: #979797;
font-size: 8px;
top: 269px;
left: 68px;
left: 30px;
position: absolute;

user-select: none;
Expand Down
8 changes: 4 additions & 4 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<link rel="icon" href="data:,">

<link href="css/main.css?4" rel="stylesheet">
<link href="css/main.css?5" rel="stylesheet">
<link href="css/ui.css?v=1" rel="stylesheet">
<title>Cloud Retro</title>
</head>
Expand Down Expand Up @@ -48,7 +48,7 @@
<div id="servers"></div>

<div id="guide-txt">
<b>Arrows</b> (move), <b>ZXCVAS</b> (game ABXYLR), <b>1/2</b> (1st/2nd player), <b>Shift/Enter/K/L</b> (select/start/save/load), <b>F</b> (fullscreen), <b>share</b> (copy shared link to the clipboard)
<b>Arrows</b> (move), <b>ZXCVAS;'./</b> (game ABXYL1-L3R1-R3), <b>1/2</b> (1st/2nd player), <b>Shift/Enter/K/L</b> (select/start/save/load), <b>F</b> (fullscreen), <b>share</b> (copy the link to the clipboard)
</div>
<div id="btn-join" class="btn big" value="join"></div>
<div id="slider-playeridx" class="slidecontainer">
Expand Down Expand Up @@ -123,7 +123,7 @@ <h1>Options</h1>
<script src="js/event/event.js?v=5"></script>
<script src="js/input/keys.js?v=3"></script>
<script src="js/settings/opts.js?v=1"></script>
<script src="js/settings/settings.js?v=2"></script>
<script src="js/settings/settings.js?v=3"></script>
<script src="js/env.js?v=5"></script>
<script src="js/input/input.js?v=3"></script>
<script src="js/gameList.js?v=3"></script>
Expand All @@ -137,7 +137,7 @@ <h1>Options</h1>
<script src="js/workerManager.js?v=1"></script>
<script src="js/stats/stats.js?v=1"></script>
<script src="js/controller.js?v=8"></script>
<script src="js/input/keyboard.js?v=5"></script>
<script src="js/input/keyboard.js?v=6"></script>
<script src="js/input/touch.js?v=3"></script>
<script src="js/input/joystick.js?v=3"></script>

Expand Down
4 changes: 4 additions & 0 deletions web/js/input/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const keyboard = (() => {
KeyV: KEY.Y,
KeyA: KEY.L,
KeyS: KEY.R,
Semicolon: KEY.L2,
Quote: KEY.R2,
Period: KEY.L3,
Slash: KEY.R3,
Enter: KEY.START,
ShiftLeft: KEY.SELECT,
// non-game
Expand Down
12 changes: 8 additions & 4 deletions web/js/settings/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
const settings = (() => {
// internal structure version
const revision = 1.1;
const revision = 1.2;

// default settings
// keep them for revert to defaults option
Expand Down Expand Up @@ -123,6 +123,7 @@ const settings = (() => {

return {
get,
clear: () => localStorage.removeItem(root),
set,
remove,
save,
Expand Down Expand Up @@ -164,12 +165,15 @@ const settings = (() => {
}

const init = () => {
// try to load settings from the localStorage with fallback to null-object
provider = localStorageProvider(store) || voidProvider(store);
provider.loadSettings();

if (revision > store.settings._version) {
// !to handle this with migrations
log.warn(`Your settings are in older format (v${store.settings._version})`);
const lastRev = (store.settings || {_version: 0})._version

if (revision > lastRev) {
log.warn(`Your settings are in older format (v${lastRev}) and will be reset to (v${revision})!`);
_reset();
}
}

Expand Down

0 comments on commit a77069a

Please sign in to comment.