pebble-moon-layer
v1.2.1
Published
A Layer for Pebble apps that renders a small (![Phases](extras/phases.gif) 10x10) icon representing the moon phase for a given date and hemisphere.
Downloads
13
Readme
Pebble Moon Layer
A Layer for Pebble apps that renders a small ( 10x10) icon representing the moon phase for a given date and hemisphere.
Usage
Install the library by running
pebble package install pebble-moon-layer --save
.Include
moon-layer.h
in your code.#include <pebble-moon-layer/moon-layer.h>
Create a new
MoonLayer
. TheGPoint
parameter represents the position of the center-point of the image.MoonLayer* moon_layer = moon_layer_create(GPoint(20, 20));
Set the date for the layer.
time_t temp = time(NULL); struct tm *tick_time = localtime(&temp); moon_layer_set_date(moon_layer, tick_time);
Other configurations
People in different hemispheres see the moon in a slightly different way, so it's possible to configure the hemisphere where the moon is being viewed from. Possible options are MoonLayerHemisphereNorthern
and MoonLayerHemisphereSouthern
(default value is MoonLayerHemisphereNorthern
).
moon_layer_set_hemisphere(moon_layer, MoonLayerHemisphereSouthern);
It's also possible to display a 1px border around the icon to improve visibility. Any GColor
value is accepted. Use GColorClear
for no border (default values are GColorWhite
on BW devices and GColorClear
on Color devices).
moon_layer_set_border_color(moon_layer, GColorBlack);