diff --git a/apps.json b/apps.json index 0271c244d..293a709c7 100644 --- a/apps.json +++ b/apps.json @@ -914,7 +914,7 @@ { "id": "marioclock", "name": "Mario Clock", "icon": "marioclock.png", - "version":"0.09", + "version":"0.10", "description": "Animated retro Mario clock, with Gameboy style 8-bit grey-scale graphics.", "tags": "clock,mario,retro", "type": "clock", diff --git a/apps/marioclock/ChangeLog b/apps/marioclock/ChangeLog index acce6a7ed..b4a4c7af9 100644 --- a/apps/marioclock/ChangeLog +++ b/apps/marioclock/ChangeLog @@ -6,4 +6,5 @@ 0.06: Performance refactor, and enhanced graphics! 0.07: Swipe right to change between Mario and Toad characters, swipe left to toggle night mode 0.08: Update date panel to be info panel toggling between Date, Battery and Temperature. Add Princes Daisy -0.09: Add GadgetBridge functionality. Mario shows message type in speach bubble, while message scrolls in info panel \ No newline at end of file +0.09: Add GadgetBridge functionality. Mario shows message type in speach bubble, while message scrolls in info panel +0.10: Swiping left to enable night-mode now also reduces LCD brightness through 3 levels before returning to day-mode. \ No newline at end of file diff --git a/apps/marioclock/README.md b/apps/marioclock/README.md index e6aeaa1bb..25276a351 100644 --- a/apps/marioclock/README.md +++ b/apps/marioclock/README.md @@ -8,7 +8,7 @@ Enjoy watching Mario, or one of the other game characters run through a level wh ## Features * Multiple characters - swipe the screen right to change the character between `Mario`, `Toad`, and `Daisy` -* Night and Day modes - swipe left to toggle mode +* Night and Day modes - swipe left to enter night mode, with 3 levels of darkness before returning to day mode. * Smooth animation * Awesome 8-bit style grey-scale graphics * Mario jumps to change the time, every minute diff --git a/apps/marioclock/marioclock-app.js b/apps/marioclock/marioclock-app.js index 529f1c95b..e213c2498 100644 --- a/apps/marioclock/marioclock-app.js +++ b/apps/marioclock/marioclock-app.js @@ -16,6 +16,8 @@ const is12Hour = settings["12hour"] || false; // Screen dimensions let W, H; +// Screen brightness +let brightness = 1; let intervalRef, displayTimeoutRef = null; @@ -164,7 +166,17 @@ function switchCharacter() { } function toggleNightMode() { - nightMode = !nightMode; + if (!nightMode) { + nightMode = true; + return; + } + + brightness -= 0.30; + if (brightness <= 0) { + brightness = 1; + nightMode = false; + } + Bangle.setLCDBrightness(brightness); } function incrementTimer() { @@ -625,4 +637,4 @@ function init() { } // Initialise! -init() \ No newline at end of file +init(); \ No newline at end of file