After Day 1, this is probably what my one-button, one-label app looked like.
Basic. So, Day 2 was all about tarting it up a bit. Getting it a bit more like this:
In other words, I needed to:
- create background windows to fade the desktop to black;
- add a background gradient;
- animate the button and gradient.
Actually, the button doesn’t animate, I have two labels over it, one sun, one moon, and I animate them instead.
The background started life a quick “painting” I made in krita.
This looked quite nice – at first – until I realized the brush strokes made me imagine my screen was dirty. It also clashed a bit with my “clean” sun and moon emojis. So, rather than painting new celestial bodies, I used Inkscape to generate a gradient for me, referring to images of scenic sunsets for colour inspiration. This gradient only needed to be one-pixel-wide, as it could be horizontally stretched, thus saving me a bit of space.
A couple of neat extras:
- the window goes from “light mode” to “dark mode”;
- the icon goes from an empty bed to an occupied one.
Don’t mind him – he’s from Barcelona…
On the Model side of the app, Day 2 involved:
- ensuring that clicking or “typing” on one of the background windows should also cancel auto-sleep;
- I wanted to be able to cancel auto-sleep by pushing a key modifier like “shift” – for this, keyDown: is no good; I needed flagsChanged: too;
- I wanted to support German, French & Spanish.
Why German, French & Spanish? Well, I am very curious to find out whether going to the effort of translating text makes any sort of difference to sales. For a tiny app like Sleep Well it is not a massive amount of work to add a few translations.
But why German, French & Spanish? Well, I’m as English as Queen Victoria (I’m half-German, my father is German and I married a German). French and Spanish meanwhile are much-used around the world, I know some French from school, and Spanish also has Latin roots, so I have some tiny idea if the online translation tools I’m using aren’t just spouting gibberish at me.
As far as I am concerned, Apple’s approach to multilingual apps leaves a lot to be desired. It involves having all the translated text in one place with no context to it, and a lot of gobbledegook IDs. From such “localizable.strings” pages, how can I tell – for example – whether “Sleep” is meant as a noun or a verb? No, no, no, not for me! 🙂 I like to have text where the relevant code is. For instance:
char const * txt_hello = @”Hello|de Hallo|fr Bonjour|es Hola”;
That’s how I roll. Country codes and pipes, and let the smart labels work out which one to use. No need to restart the app or any such malarkey, just refresh some objects’ draw routines.
So that’s two days of the “one day” app. Reasonable so far? Good. It won’t stay that way… More soon…Philip