score: change b1 control scheme

pull/828/head
Mika Dede 2021-09-28 16:42:21 +02:00
parent df13e80b14
commit 7f50370669
No known key found for this signature in database
GPG Key ID: 546586DC38D45BBD
2 changed files with 26 additions and 18 deletions

View File

@ -1,18 +1,25 @@
This app will allow you to keep scores for most kinds of sports. This app will allow you to keep scores for most kinds of sports.
# Keybinds # Keybinds
*On Bangle.js 2 BTN is equivalent to BTN2 on Bangle.js 1*
| Keybinding | Description |
|-------------------|------------------------------|
| `BTN1` | Scroll up |
| `BTN3` | Scroll down |
| `BTN2` | Menu |
| tap on left side | increment left player score |
| tap on right side | increment right player score |
To correct a falsely awarded point simply open and close the menu within .5 seconds. This will put the app into correction mode (indicated by the `R`). To correct a falsely awarded point simply open and close the menu within .5 seconds. This will put the app into correction mode (indicated by the `R`).
In this mode any score increments will be decrements. To move back a set, reduce both players scores to 0, then decrement one of the scores once again. In this mode any score increments will be decrements. To move back a set, reduce both players scores to 0, then decrement one of the scores once again.
## Bangle.js 1
| Keybinding | Description |
|---------------------|------------------------------|
| `BTN1` | Increment left player score |
| `BTN3` | Increment right player score |
| `BTN2` | Menu |
| touch on left side | Scroll up |
| touch on right side | Scroll down |
## Bangle.js 2
| Keybinding | Description |
|-------------------------------------|------------------------------|
| `BTN1` | Menu |
| touch on left side of divider line | Increment left player score |
| touch on right side of divider line | Increment right player score |
# Settings # Settings
| Setting | Description | | Setting | Description |
|------------------------------------|------------------------------------------------------------------------------------------------------------------------------| |------------------------------------|------------------------------------------------------------------------------------------------------------------------------|

View File

@ -19,23 +19,28 @@ let correctionMode = false;
let w = g.getWidth(); let w = g.getWidth();
let h = g.getHeight(); let h = g.getHeight();
function getXCoord(func) {
let offset = 40;
return func(w-offset)+offset;
};
function setupInputWatchers() { function setupInputWatchers() {
if (global.BTN4) { if (global.BTN4) {
setWatch(() => handleInput(2), BTN2, { repeat: true }); setWatch(() => handleInput(2), BTN2, { repeat: true });
setWatch(() => handleInput(3), BTN1, { repeat: true }); setWatch(() => handleInput(0), BTN1, { repeat: true });
setWatch(() => handleInput(4), BTN3, { repeat: true }); setWatch(() => handleInput(1), BTN3, { repeat: true });
} else { } else {
setWatch(() => handleInput(2), BTN, { repeat: true }); setWatch(() => handleInput(2), BTN, { repeat: true });
} }
Bangle.on('touch', (b, e) => { Bangle.on('touch', (b, e) => {
if (b) { if (b) {
if (b === 1) { if (b === 1) {
handleInput(0); handleInput(3);
} else { } else {
handleInput(1); handleInput(4);
} }
} else { } else {
if (e.x < w/2) { if (e.x < getXCoord(w => w/2)) {
handleInput(0); handleInput(0);
} else { } else {
handleInput(1); handleInput(1);
@ -299,10 +304,6 @@ function handleInput(button) {
} }
function draw() { function draw() {
let getXCoord = function (func) {
let offset = 40;
return func(w-offset)+offset;
};
g.setFontAlign(0,0); g.setFontAlign(0,0);
g.clear(); g.clear();