parent
42947f27bc
commit
2f91496e57
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Dutch Clock
|
||||||
|
This clock shows the time, in words, the way a Dutch person would tell you what time it is. Useful when learning Dutch.
|
||||||
|
|
||||||
|
It was inspired by my wife, who sometimes insists I tell her exactly what time it says on the watch and not just an approximation.
|
||||||
|
|
||||||
|
## Options
|
||||||
|
- Three modes:
|
||||||
|
- exact time ("zeven voor half zes / twee voor tien")
|
||||||
|
- approximate time, rounded to the nearest 5-minute mark ("bijna vijf voor half zes / tegen tienen") (the default)
|
||||||
|
- hybrid mode, rounded when close to the quarter marks and exact otherwise ("zeven voor half zes / tegen tienen")
|
||||||
|
- Option to turn top widgets on/off (on by default)
|
||||||
|
- Option to show digital time at the bottom (off by default)
|
||||||
|
- Option to show the date at the bottom (on by default)
|
||||||
|
|
||||||
|
## Screenshots
|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|
|
@ -7,8 +7,9 @@ const SCREEN_HEIGHT = g.getHeight();
|
||||||
const TOP_SPACING = 5;
|
const TOP_SPACING = 5;
|
||||||
const WIDGETS_HEIGHT = 20;
|
const WIDGETS_HEIGHT = 20;
|
||||||
const DATETIME_SPACING_HEIGHT = 5;
|
const DATETIME_SPACING_HEIGHT = 5;
|
||||||
const DATE_HEIGHT = 10;
|
|
||||||
const TIME_HEIGHT = 10;
|
const TIME_HEIGHT = 10;
|
||||||
|
const DATE_HEIGHT = 10;
|
||||||
|
const BOTTOM_SPACING = 5;
|
||||||
|
|
||||||
const TEXT_WIDTH = SCREEN_WIDTH - 2;
|
const TEXT_WIDTH = SCREEN_WIDTH - 2;
|
||||||
|
|
||||||
|
|
@ -84,18 +85,19 @@ function draw() {
|
||||||
|
|
||||||
// Reset the state of the graphics library
|
// Reset the state of the graphics library
|
||||||
g.clear(true);
|
g.clear(true);
|
||||||
|
|
||||||
// draw the current time (4x size 7 segment)
|
// draw the current time (4x size 7 segment)
|
||||||
setFont(timeLines);
|
setFont(timeLines);
|
||||||
|
|
||||||
g.setFontAlign(0,0); // align center top
|
g.setFontAlign(0,0); // align center top
|
||||||
g.drawString(timeLines.join("\n"), X, Y, true /*clear background*/);
|
g.drawString(timeLines.join("\n"), X, Y, false);
|
||||||
|
|
||||||
if (bottomLines.length) {
|
if (bottomLines.length) {
|
||||||
// draw the time and/or date, in a normal font
|
// draw the time and/or date, in a normal font
|
||||||
g.setFont("6x8");
|
g.setFont("6x8");
|
||||||
g.setFontAlign(0,1); // align center bottom
|
g.setFontAlign(0,1); // align center bottom
|
||||||
// pad the date - this clears the background if the date were to change length
|
// pad the date - this clears the background if the date were to change length
|
||||||
g.drawString(bottomLines.join('\n'), SCREEN_WIDTH/2, SCREEN_HEIGHT - 5, true /*clear background*/);
|
g.drawString(bottomLines.join('\n'), SCREEN_WIDTH/2, SCREEN_HEIGHT - BOTTOM_SPACING, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Show launcher when middle button pressed
|
/* Show launcher when middle button pressed
|
||||||
|
|
@ -130,13 +132,13 @@ function getBottomLines() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.showDate) {
|
if (settings.showDate) {
|
||||||
lines.push(locale.date(date, 1));
|
lines.push(locale.date(date));
|
||||||
}
|
}
|
||||||
|
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTimeLines(m) {
|
function getTimeLines(m) {
|
||||||
switch (settings.variant) {
|
switch (settings.variant) {
|
||||||
case VARIANT_EXACT:
|
case VARIANT_EXACT:
|
||||||
return getExactTimeLines(m);
|
return getExactTimeLines(m);
|
||||||
|
|
@ -153,6 +155,10 @@ function getBottomLines() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getExactTimeLines(m) {
|
function getExactTimeLines(m) {
|
||||||
|
if (m === 0) {
|
||||||
|
return ['middernacht'];
|
||||||
|
}
|
||||||
|
|
||||||
const hour = getHour(m);
|
const hour = getHour(m);
|
||||||
const minutes = getMinutes(hour.offset);
|
const minutes = getMinutes(hour.offset);
|
||||||
|
|
||||||
|
|
@ -166,15 +172,8 @@ function getExactTimeLines(m) {
|
||||||
|
|
||||||
function getApproximateTimeLines(m) {
|
function getApproximateTimeLines(m) {
|
||||||
const roundMinutes = getRoundMinutes(m);
|
const roundMinutes = getRoundMinutes(m);
|
||||||
const hour = getHour(roundMinutes.minutes);
|
|
||||||
|
|
||||||
const minutes = getMinutes(hour.offset);
|
const lines = getExactTimeLines(roundMinutes.minutes);
|
||||||
|
|
||||||
const lines = minutes.concat(hour.lines);
|
|
||||||
|
|
||||||
if (lines.length === 1) {
|
|
||||||
lines.push('uur');
|
|
||||||
}
|
|
||||||
|
|
||||||
return addApproximateDescription(lines, roundMinutes.offset);
|
return addApproximateDescription(lines, roundMinutes.offset);
|
||||||
}
|
}
|
||||||
|
|
@ -222,7 +221,7 @@ function addApproximateDescription(lines, offset) {
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lines[1] === 'uur') {
|
if (lines.length === 1 || lines[1] === 'uur') {
|
||||||
const singular = lines[0];
|
const singular = lines[0];
|
||||||
const plural = getPlural(singular);
|
const plural = getPlural(singular);
|
||||||
return {
|
return {
|
||||||
|
|
@ -243,6 +242,7 @@ function addApproximateDescription(lines, offset) {
|
||||||
|
|
||||||
function getPlural(h) {
|
function getPlural(h) {
|
||||||
return {
|
return {
|
||||||
|
middernacht: 'middernacht',
|
||||||
een: 'enen',
|
een: 'enen',
|
||||||
twee: 'tweeën',
|
twee: 'tweeën',
|
||||||
drie: 'drieën',
|
drie: 'drieën',
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,16 @@
|
||||||
"name": "Dutch Clock",
|
"name": "Dutch Clock",
|
||||||
"shortName":"Dutch Clock",
|
"shortName":"Dutch Clock",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"version":"0.10",
|
"version":"0.11",
|
||||||
"description": "A clock that displays the time the way a Dutch person would respond when asked what time it is.",
|
"description": "A clock that displays the time the way a Dutch person would respond when asked what time it is.",
|
||||||
"type": "clock",
|
"type": "clock",
|
||||||
"tags": "clock,dutch,text",
|
"tags": "clock,dutch,text",
|
||||||
"supports": ["BANGLEJS", "BANGLEJS2"],
|
"supports": ["BANGLEJS", "BANGLEJS2"],
|
||||||
"allow_emulator": true,
|
"allow_emulator": true,
|
||||||
"screenshots": [
|
"screenshots": [
|
||||||
|
{"url":"screenshotbangle1-2.png"},
|
||||||
{"url":"screenshotbangle2.png"},
|
{"url":"screenshotbangle2.png"},
|
||||||
{"url":"screenshotbangle1.png"},
|
{"url":"screenshotbangle1.png"}
|
||||||
{"url":"screenshotbangle1-2.png"}
|
|
||||||
],
|
],
|
||||||
"storage": [
|
"storage": [
|
||||||
{"name":"dutchclock.app.js","url":"app.js"},
|
{"name":"dutchclock.app.js","url":"app.js"},
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
],
|
],
|
||||||
"data": [
|
"data": [
|
||||||
{"name":"dutchclock.json"}
|
{"name":"dutchclock.json"}
|
||||||
]
|
],
|
||||||
|
"readme":"README.md"
|
||||||
}
|
}
|
||||||
|
|
||||||
Loading…
Reference in New Issue