import Toybox.Application.Properties; import Toybox.Graphics; import Toybox.Lang; import Toybox.WatchUi; class IBackground extends Drawable { var Marks as Array = []; 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 s = 0; s < 60; s += 1) { var markType = IMark.getMarkType(s); 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 => s, :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 {} }