initial commit

This commit is contained in:
2025-10-09 14:37:45 +03:00
commit fe3b5899ab
22 changed files with 657 additions and 0 deletions

View File

@ -0,0 +1,57 @@
import Toybox.Application.Properties;
import Toybox.Graphics;
import Toybox.Lang;
import Toybox.WatchUi;
class IBackground extends Drawable {
var Marks as Array<IMark> = [];
typedef BackgroundParams as {
:Identifier as Object,
:Color as ColorType,
};
enum BackgroundStyleType {
SOLID_BACKGROUND,
}
static function getBackground(style as BackgroundStyleType, options as BackgroundParams) as IBackground {
switch (style) {
case SOLID_BACKGROUND:
default:
return new SolidBackground(options);
}
}
function initialize(options as BackgroundParams) {
var identifier = options[:Identifier];
Drawable.initialize({:identifier => identifier});
for (var seconds = 0; seconds < 60; ++seconds) {
var markType = IMark.getMarkType(seconds);
var markIdentifier = Lang.format("$1$/Marks/$2$", [identifier, markType]);
var markStyle = Properties.getValue(Lang.format("$1$/Type", [markIdentifier])) as IMark.MarkStyleType;
var mark = IMark.getMark(markStyle, markType, {
:Identifier => markIdentifier,
:Color => Properties.getValue(Lang.format("$1$/Color", [markIdentifier])) as ColorType,
:Seconds => seconds,
:Size => markType == IMark.TERTIARY_MARK ? 0.033 : 0.1,
});
if (mark != null) {
Marks.add(mark);
}
}
}
function draw(dc as Dc) as Void {
drawBackground(dc);
for (var i = 0; i < Marks.size(); ++i) {
Marks[i].draw(dc);
}
}
function drawBackground(dc as Dc) as Void {}
}