Making a Watchface or Game AddOn - GuruSR/Watchy_GSR GitHub Wiki
How to make your own WatchFace or Game AddOn
- If you haven't read the Compiling Watchy_GSR, please do so first.
- DON'T FORK This Repository! AddOns do not require a fork, they are standalone additions and shouldn't require changes in GSR.ino.
- Go into the Watchface Addons folder and download EmptyAddOn.h or EmptyGameAddOn.h
- Place the downloaded file in the same folder as GSR.ino.
- Read ALL of the commented instructions inside the file.
- Follow ALL of the commented instructions inside the file.
- Save the file and rename it to a new name as the commented instructions in the file suggests.
- #include your newly created AddOn.h into your GSR.ino file, after the first #include in GSR.ino
- Compile.
- If all went well, the compile would have succeeded. Your renamed AddOn will show up in the Watchy when it is uploaded. For Watchfaces, you need to visit the User Manual to see how to change Watchfaces and where to find the Game AddOn.
General Notes:
-
AddOns are not limited to 1 WatchFace Style / Game per file, you can create multiples in 1 file. Instructions on how to do this are in the EmptyAddOn.h file. For Game AddOns, see the EmptyGameAddOn.h, which has the same information with more for setting up a "basic game".
-
In the Watchface Addons folder will eventually have a list of AddOns from other people.
-
When adding an AddOn to the GSR.ino, place them in the order you want them to be visible in the list of the specific AddOn.
-
The currently a limit of 96 AddOns is present, sadly, there isn't sufficient RTC memory to add too many more without sacrificing space available for other things.
Weather Addition:
Also included in the Watchface Addons folder is WeatherIcons.h to be used with WatchFace AddOns, as it has a function: const unsigned char* getWeatherIcon(uint16_t Condition, bool Small = false)
that will return the weather icon from the OWM's current Conditions value which you supply from the WeatherData retrieved once Watchy_GSR has retrieved data, if one isn't found a nullptr is returned, so make sure you don't directly set that icon in a display.drawBitmap or unexpected results can happen. Setting the bool Small to true will give versions capable of sitting over top of the Status area of Watchy_GSR. There is also a second function const unsigned char* getTemperatureScaleIcon(bool Metric, bool Small)
that will return the requested Temperature Scale Icon (used right after the temperature to show either °F or °C).
Default Watchy_GSR example of InsertDrawWeather (this works for using the drawStatus() if you put this inside your InsertDrawWeather function):
const unsigned char *Cond, *Ico;
uint16_t C = (Design.Status.Inverted ? BackColor() : ForeColor());
byte X = Design.Status.WIFIx;
byte Y = Design.Status.WIFIy + 2;
int16_t x1, y1;
uint16_t w, h;
String S;
if (!Status || !IsWeatherAvailable()) return;
Cond = getWeatherIcon(GetWeatherID(), Status);
Ico = getTemperatureScaleIcon(IsMetric(), Status);
if (Cond == nullptr || Ico == nullptr) return;
display.drawBitmap(X, Y - 18, Cond, 26, 17, (Design.Status.Inverted ? BackColor() : ForeColor()), (Design.Status.Inverted ? ForeColor() : BackColor()));
display.setFont(&Bronova_Regular10pt7b);
if (IsBatteryHidden()){
X = Design.Status.BATTx + 27 - Design.Face.Gutter;
Y = Design.Status.BATTy + 17;
S = String(GetWeatherTemperatureFeelsLike());
display.getTextBounds(S, 0, 0, &x1, &y1, &w, &h);
display.setCursor(X - w, Y);
display.print(S);
X = display.getCursorX() + 1;
display.drawBitmap(X, Y - 8, Ico, 13, 10, (Design.Status.Inverted ? BackColor() : ForeColor()), (Design.Status.Inverted ? ForeColor() : BackColor()));
}
Coding more for your Watchface:
There are a large selection of functions inside Watchy_GSR.cpp for you to use with your Watchface, visiting Coding Info will give you an insight to the entire Watchface setup and operation as well as functions that offer up various functionality.