Files
wf/source/wfView.mc
2025-10-09 14:37:45 +03:00

74 lines
2.2 KiB
MonkeyC

import Toybox.Application;
import Toybox.Graphics;
import Toybox.Lang;
import Toybox.System;
import Toybox.WatchUi;
class wfView extends WatchUi.WatchFace {
private var hands as IHands?;
function initialize() {
WatchFace.initialize();
hands = new SimpleHands({});
}
// Load your resources here
function onLayout(dc as Dc) as Void {
setLayout(Rez.Layouts.WatchFace(dc));
}
// Called when this View is brought to the foreground. Restore
// the state of this View and prepare it to be shown. This includes
// loading resources into memory.
function onShow() as Void {
}
// Update the view
// function onUpdate(dc as Dc) as Void {
// // Get the current time and format it correctly
// var timeFormat = "$1$:$2$";
// var clockTime = System.getClockTime();
// var hours = clockTime.hour;
// if (!System.getDeviceSettings().is24Hour) {
// if (hours > 12) {
// hours = hours - 12;
// }
// } else {
// if (Application.Properties.getValue("UseMilitaryFormat")) {
// timeFormat = "$1$$2$";
// hours = hours.format("%02d");
// }
// }
// var timeString = Lang.format(timeFormat, [hours, clockTime.min.format("%02d")]);
// // Update the view
// var view = View.findDrawableById("TimeLabel") as Text;
// view.setColor(Application.Properties.getValue("ForegroundColor") as Number);
// view.setText(timeString);
// // Call the parent onUpdate function to redraw the layout
// View.onUpdate(dc);
// }
function onUpdate(dc as Dc) as Void {
dc.clear();
dc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_BLACK);
hands.draw(dc);
}
// Called when this View is removed from the screen. Save the
// state of this View here. This includes freeing resources from
// memory.
function onHide() as Void {
}
// The user has just looked at their watch. Timers and animations may be started here.
function onExitSleep() as Void {
}
// Terminate any active timers and prepare for slow updates.
function onEnterSleep() as Void {
}
}