-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVirtualPetNothingView.mc
963 lines (833 loc) · 25.9 KB
/
VirtualPetNothingView.mc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
import Toybox.Graphics;
import Toybox.Lang;
import Toybox.System;
import Toybox.WatchUi;
import Toybox.Time;
import Toybox.Weather;
import Toybox.Activity;
import Toybox.ActivityMonitor;
import Toybox.Time.Gregorian;
import Toybox.UserProfile;
enum {
PonyTail = 0,
CandyHair = 1,
BoneHair = 2,
BunHair = 3,
NormalHands = 0,
FunHands = 1,
WaveHands = 2,
NoHands = 3,
GhostGirl = 0,
GhostGuy = 1,
TooMuchCandy = 0,
SomeCandy = 1,
NoCandy = 2
}
var character = 0;
var candy = 0;
var hair = 0;
var hands = 0;
class VirtualPetNothingView extends WatchUi.WatchFace {
function initialize() { WatchFace.initialize(); }
function onLayout(dc as Dc){}
function onShow() as Void { }
function onUpdate(dc as Dc) as Void {
/* _ _ _
__ ____ _ _ __(_) __ _| |__ | | ___ ___
\ \ / / _` | '__| |/ _` | '_ \| |/ _ \/ __|
\ V / (_| | | | | (_| | |_) | | __/\__ \
\_/ \__,_|_| |_|\__,_|_.__/|_|\___||___/
*/
/*----------System Variables------------------------------*/
character = readKeyInt(Toybox.Application.getApp(),"character",0);
candy = readKeyInt(Toybox.Application.getApp(),"candy",0);
hair = readKeyInt(Toybox.Application.getApp(),"hair",0);
hands = readKeyInt(Toybox.Application.getApp(),"hands",0);
var mySettings = System.getDeviceSettings();
var screenHeightY = (System.getDeviceSettings().screenHeight)/360;
var screenWidthX = (System.getDeviceSettings().screenWidth)/360;
//Size Variations Pixel Circle
//360 VenuS2 - The Model I designed it for
//390 Size up
//416 Size up
//454 Size up
if (System.getDeviceSettings().screenHeight ==390){
screenHeightY=screenHeightY*1.1;
screenWidthX=screenWidthX *1.07;
}
if (System.getDeviceSettings().screenHeight ==416){
screenHeightY=screenHeightY*1.15;
screenWidthX=screenWidthX *1.17;
}
if (System.getDeviceSettings().screenHeight ==454){
screenHeightY=screenHeightY*1.25;
screenWidthX=screenWidthX *1.27;
}
var venus2XL=0;
if (System.getDeviceSettings().screenHeight == 390){
venus2XL = -4;
}
if (System.getDeviceSettings().screenHeight == 416){
venus2XL = -8;
}
if (System.getDeviceSettings().screenHeight == 454){
venus2XL = -13;
}
var myStats = System.getSystemStats();
var info = ActivityMonitor.getInfo();
/*----------Clock and Calendar Variables------------------------------*/
var timeFormat = "$1$:$2$";
var clockTime = System.getClockTime();
var today = Gregorian.info(Time.now(), Time.FORMAT_SHORT);
var hours = clockTime.hour;
if (!System.getDeviceSettings().is24Hour) {
if (hours == 0) {
hours = 12; // Display midnight as 12:00
} else if (hours > 12) {
hours = hours - 12;
}
} else {
timeFormat = "$1$:$2$";
hours = hours.format("%02d");
}
var timeString = Lang.format(timeFormat, [hours, clockTime.min.format("%02d")]);
var weekdayArray = ["Day", "SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY"] as Array<String>;
var monthArray = ["Month", "JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE", "JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER"] as Array<String>;
/*----------Alarms and Notify------------------------------*/
var userAlarm = "0";
if (mySettings.alarmCount != null) {
userAlarm = Lang.format("$1$", [mySettings.alarmCount.toNumber().format("%2d")]);
}
/*----------Battery------------------------------*/
var userBattery = "0";
var batteryMeter = 1;
if (myStats.battery != null) {
userBattery = myStats.battery.toNumber().toString(); // Convert to string without zero padding
} else {
userBattery = "0";
}
if (myStats.battery != null) {
batteryMeter = myStats.battery.toNumber();
} else {
batteryMeter = 1;
}
/*----------Steps------------------------------*/
var userSTEPS = 0;
if (info.steps != null){userSTEPS = info.steps.toNumber();}else{userSTEPS=0;}
var userCAL = 0;
if (info.calories != null){userCAL = info.calories.toNumber();}else{userCAL=0;}
/*----------Weather------------------------------*/
var getCC = Toybox.Weather.getCurrentConditions();
var TEMP = "000";
var FC = "0";
if (getCC != null && getCC.temperature != null) {
if (System.getDeviceSettings().temperatureUnits == 0) {
FC = "C";
TEMP = getCC.temperature.format("%d");
} else {
TEMP = (((getCC.temperature * 9) / 5) + 32).format("%d");
FC = "F";
}
} else {
TEMP = "000";
}
var cond = 0;
if (getCC != null && getCC.condition != null) {
cond = getCC.condition.toNumber();
} else {
cond = 0; // Default to sun condition if unavailable
}
var userHEART = "0";
var heartRate = getHeartRate();
if (heartRate == null) {
userHEART = "0"; // Set to "0" if heart rate is unavailable
} else {
userHEART = heartRate.toString();
}
var moonnumber = getMoonPhase(today.year, ((today.month)-1), today.day);
var moon1 = moonArrFun(moonnumber);
var centerX = (dc.getWidth()) / 2;
var wordFont = WatchUi.loadResource( Rez.Fonts.smallFont );
var DataFont = WatchUi.loadResource( Rez.Fonts.wordFont );
var bigFont= WatchUi.loadResource( Rez.Fonts.bigFont );
var funFont= DataFont;
View.onUpdate(dc);
/* _ _ _
__| |_ __ __ ___ __ ___| | ___ ___| | __
/ _` | '__/ _` \ \ /\ / / / __| |/ _ \ / __| |/ /
| (_| | | | (_| |\ V V / | (__| | (_) | (__| <
\__,_|_| \__,_| \_/\_/ \___|_|\___/ \___|_|\_\
*/
//Draw Background
var water= waterPhase();
water.draw(dc);
//Draw Sprite
if (clockTime.hour < 6) {
var sleep = sleepPhase(character); //userSTEPS or (today.sec*180) fix 15 and 16 and 17 to be higher
sleep.draw(dc);
}else{
//Sprite
if (character == 0){
var dog = dogPhase(today.min); //userSTEPS or (today.sec*180) fix 15 and 16 and 17 to be higher
dog.draw(dc);
}else{
var doll = dollPhase(today.min); //userSTEPS or (today.sec*180) fix 15 and 16 and 17 to be higher
doll.draw(dc);
var hair = hairPhase(hair);
hair.draw(dc);
if (hands==3){}else{
var handy = handPhase(hands);}
handy.draw(dc);
}
//Candy Rain
if (candy == 2){}
else if (candy == 0) {
var goal2 = goalPhase(6, today.sec, userSTEPS); //userSTEPS or (today.sec*180) fix 15 and 16 and 17 to be higher
goal2.draw(dc);
var goal = goalPhase(3, (today.sec)+13, userSTEPS); //userSTEPS or (today.sec*180) fix 15 and 16 and 17 to be higher
goal.draw(dc);
var goal3 = goalPhase(1, today.sec+25, userSTEPS); //userSTEPS or (today.sec*180) fix 15 and 16 and 17 to be higher
goal3.draw(dc);
}else{ var goal2 = goalPhase(6, today.sec, userSTEPS); //userSTEPS or (today.sec*180) fix 15 and 16 and 17 to be higher
goal2.draw(dc);}
}
//Draw Moon and Battery
moon1.draw(dc);
var shift=-35;
//hours=hours+2;
if (System.getDeviceSettings().is24Hour || hours/10> 0){
shift = -20;
var digitHour=(digitPhase(hours/10,-115+shift));
digitHour.draw(dc);
}
var digitColon=(digitPhase(10,-20+shift));
digitColon.draw(dc);
var digitHours=(digitPhase(hours%10,-65+shift));
digitHours.draw(dc);
var digitSec=(digitPhase(today.min/10,25+shift));
digitSec.draw(dc);
var digitSecT=(digitPhase(today.min%10,85+shift));
digitSecT.draw(dc);
//Draw Top Font with shadow
dc.setColor(0x2A3088, Graphics.COLOR_TRANSPARENT);
dc.drawText( 221 *screenWidthX+venus2XL,(40*screenHeightY)+venus2XL, wordFont, (TEMP+" " +FC), Graphics.TEXT_JUSTIFY_CENTER );
dc.setColor(0xFFFFFF, Graphics.COLOR_TRANSPARENT);
dc.drawText( centerX-2,0, bigFont, weather(cond), Graphics.TEXT_JUSTIFY_CENTER );
// dc.drawText(centerX,(95*screenHeightY)+(venus2XL*2),wordFont,(weekdayArray[today.day_of_week]+" , "+ monthArray[today.month]+" "+ today.day +" " +today.year), Graphics.TEXT_JUSTIFY_CENTER );
//dc.drawText( (159 *screenWidthX)-(venus2XL/2)+3,314*screenHeightY+(venus2XL*4)+6 , wordFont, token , Graphics.TEXT_JUSTIFY_CENTER );
// dc.drawText( (42 *screenWidthX),(centerX-30) , funFont, ("^"), Graphics.TEXT_JUSTIFY_CENTER );
dc.drawText( (45 *screenWidthX), 150*screenHeightY, funFont, userHEART, Graphics.TEXT_JUSTIFY_CENTER );
// dc.setColor(0xF8FDB1, Graphics.COLOR_TRANSPARENT);
// dc.drawText( (315 *screenWidthX), centerX-30, funFont, ("$"), Graphics.TEXT_JUSTIFY_CENTER );
dc.drawText( (45 *screenWidthX), 224*screenHeightY, funFont, (userSTEPS), Graphics.TEXT_JUSTIFY_CENTER );
// dc.setColor(0xFFD200, Graphics.COLOR_TRANSPARENT);
// dc.drawText( (315 *screenWidthX),(centerX*6/4)-60 , funFont, "!", Graphics.TEXT_JUSTIFY_CENTER );
// dc.drawText( (315 *screenWidthX),(centerX*6/4)-30 , funFont, userCAL, Graphics.TEXT_JUSTIFY_CENTER );
//dc.setColor(0x6933F6, Graphics.COLOR_TRANSPARENT);
//dc.drawText(45 *screenWidthX,(centerX*6/4)-60,funFont, ">", Graphics.TEXT_JUSTIFY_CENTER );
// dc.drawText(42 *screenWidthX,(centerX*6/4)-30,funFont, userAlarm, Graphics.TEXT_JUSTIFY_CENTER );
/*---------------Draw Battery---------------*/
if (batteryMeter >= 10 && batteryMeter <= 32) {
//Red
dc.setColor(0xB00B1E, Graphics.COLOR_TRANSPARENT);
dc.fillRectangle(centerX * 350 / 360, (centerX * 88 / 360)+venus2XL, 9, 15);
} else if (batteryMeter >= 33 && batteryMeter <= 65) {
//Yellow
dc.setColor(0xFFFF00, Graphics.COLOR_TRANSPARENT);
dc.fillRectangle(centerX * 350 / 360, (centerX * 88 / 360)+venus2XL, 9,15 );
} else if (batteryMeter >= 66) {
//Nothing
}else{
//Nothing
}
}
/* _ _
__ _____ (_) __| |
\ \ / / _ \| |/ _` |
\ V / (_) | | (_| |
\_/ \___/|_|\__,_|
*/
function onHide() as Void { }
function onExitSleep() as Void {}
function onEnterSleep() as Void {}
/* _ _
__ _____ __ _| |_| |__ ___ _ __
\ \ /\ / / _ \/ _` | __| '_ \ / _ \ '__|
\ V V / __/ (_| | |_| | | | __/ |
\_/\_/ \___|\__,_|\__|_| |_|\___|_|
*/
function weather(cond) {
if (cond == 0 || cond == 40){return "b";}//sun
else if (cond == 50 || cond == 49 ||cond == 47||cond == 45||cond == 44||cond == 42||cond == 31||cond == 27||cond == 26||cond == 25||cond == 24||cond == 21||cond == 18||cond == 15||cond == 14||cond == 13||cond == 11||cond == 3){return "a";}//rain
else if (cond == 52||cond == 20||cond == 2||cond == 1){return "e";}//cloud
else if (cond == 5 || cond == 8|| cond == 9|| cond == 29|| cond == 30|| cond == 33|| cond == 35|| cond == 37|| cond == 38|| cond == 39){return "g";}//wind
else if (cond == 51 || cond == 48|| cond == 46|| cond == 43|| cond == 10|| cond == 4){return "i";}//snow
else if (cond == 32 || cond == 37|| cond == 41|| cond == 42){return "f";}//whirlwind
else {return "c";}//suncloudrain
}
/* _
__| |_ __ __ ___ __ _ __ _ __ __ _
/ _` | '__/ _` \ \ /\ / / | '_ \| '_ \ / _` |
| (_| | | | (_| |\ V V / | |_) | | | | (_| |
\__,_|_| \__,_| \_/\_/ | .__/|_| |_|\__, |
|_| |___/ */
//DrawOpacityGraphic - dog -
function dogPhase(minutes){
var screenHeightY = System.getDeviceSettings().screenHeight;
var screenWidthX = System.getDeviceSettings().screenWidth;
var venus2X = 0;
//var venus2X = (screenWidthX)-((seconds%20)*20);
var venus2Y = 0;
if (screenHeightY == 390){
venus2Y = venus2Y+50;
venus2X = venus2X+10;}
if (screenHeightY == 416){
venus2Y = venus2Y+60;
venus2X = venus2X+20;}
if (screenHeightY == 454){
venus2Y = venus2Y+40;
venus2X = venus2X+40;}
var dogARRAY = [
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.dog0,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.dog1,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.dog2,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.dog3,
:locX => venus2X,
:locY => venus2Y
}))
];
return dogARRAY[minutes%4 ];
}
//DrawOpacityGraphic - doll -
function dollPhase(minutes) {
var screenHeightY = System.getDeviceSettings().screenHeight;
var screenWidthX = System.getDeviceSettings().screenWidth;
var venus2X = 0;
var venus2Y = 0;
if (screenHeightY == 390) {
venus2Y = venus2Y + 50;
venus2X = venus2X + 10;
}
if (screenHeightY == 416) {
venus2Y = venus2Y + 60;
venus2X = venus2X + 20;
}
if (screenHeightY == 454) {
venus2Y = venus2Y + 40;
venus2X = venus2X + 40;
}
var dollARRAY = [
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.doll0,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.doll1,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.doll2,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.doll3,
:locX => venus2X,
:locY => venus2Y
}))
];
return dollARRAY[minutes % 4];
}
//DrawOpacityGraphic - hand -
function handPhase(hands) {
var screenHeightY = System.getDeviceSettings().screenHeight;
var screenWidthX = System.getDeviceSettings().screenWidth;
var venus2X = 0;
var venus2Y = 0;
if (screenHeightY == 390) {
venus2Y = venus2Y + 50;
venus2X = venus2X + 10;
}
if (screenHeightY == 416) {
venus2Y = venus2Y + 60;
venus2X = venus2X + 20;
}
if (screenHeightY == 454) {
venus2Y = venus2Y + 40;
venus2X = venus2X + 40;
}
var handARRAY = [
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.hands0,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.hands1,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.hands2,
:locX => venus2X,
:locY => venus2Y
}))
];
return handARRAY[hands];
}
//DrawOpacityGraphic - hair -
function hairPhase(hair) {
var screenHeightY = System.getDeviceSettings().screenHeight;
var screenWidthX = System.getDeviceSettings().screenWidth;
var venus2X = 0;
var venus2Y = 0;
if (screenHeightY == 390) {
venus2Y = venus2Y + 50;
venus2X = venus2X + 10;
}
if (screenHeightY == 416) {
venus2Y = venus2Y + 60;
venus2X = venus2X + 20;
}
if (screenHeightY == 454) {
venus2Y = venus2Y + 40;
venus2X = venus2X + 40;
}
var hairARRAY = [
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.hair0,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.hair1,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.hair2,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.hair3,
:locX => venus2X,
:locY => venus2Y
}))
];
return hairARRAY[hair];
}
//DrawOpacityGraphic - dog -
function sleepPhase(character){
var screenHeightY = System.getDeviceSettings().screenHeight;
var screenWidthX = System.getDeviceSettings().screenWidth;
var venus2X = 0;
//var venus2X = (screenWidthX)-((seconds%20)*20);
var venus2Y = 0;
if (screenHeightY == 390){
venus2Y = venus2Y+50;
venus2X = venus2X+10;}
if (screenHeightY == 416){
venus2Y = venus2Y+60;
venus2X = venus2X+20;}
if (screenHeightY == 454){
venus2Y = venus2Y+40;
venus2X = venus2X+40;}
var sleepARRAY = [
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.sleep0,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.sleep1,
:locX => venus2X,
:locY => venus2Y
}))
];
return sleepARRAY[character];
}
function goalPhase(number, seconds, steps){
var screenHeightY = System.getDeviceSettings().screenHeight;
var screenWidthX = System.getDeviceSettings().screenWidth;
var venus2X = ((screenWidthX)* (number)/8);
//var venus2X = (screenWidthX)-((seconds%20)*20);
var venus2Y = 0+((seconds%15)*30);
if (screenHeightY == 390){
venus2Y = venus2Y;
venus2X = venus2X+10;}
if (screenHeightY == 416){
venus2Y = venus2Y;
venus2X = venus2X+20;}
if (screenHeightY == 454){
venus2Y = venus2Y;
venus2X = venus2X+40;}
var goalARRAY = [
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.goal0,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.goal1,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.goal2,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.goal3,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.goal4,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.goal5,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.goal6,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.goal7,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.goal8,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.goal9,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.goal10,
:locX => venus2X,
:locY => venus2Y
}))
];
if (steps>9999){return goalARRAY[10];}
else{
return goalARRAY[steps/1000];}
}
//DrawOpacityGraphic - dog -
function waterPhase(){
var screenHeightY = System.getDeviceSettings().screenHeight;
// var screenWidthX = System.getDeviceSettings().screenWidth;
var venus2X = 0;
var venus2Y = 0;
var waterArray = [
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.water360,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.water390,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.water416,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.water454,
:locX => venus2X,
:locY => venus2Y
}))
];
if (screenHeightY==360){return waterArray[0]; }
else if (screenHeightY==390){return waterArray[1]; }
else if (screenHeightY==416){return waterArray[2]; }
else if (screenHeightY==454){return waterArray[3]; }
else{return waterArray[0]; }
}
/* _ _ __ _
| |__ ___ __ _ _ __| |_ /__\ __ _| |_ ___
| '_ \ / _ \/ _` | '__| __| / \/// _` | __/ _ \
| | | | __/ (_| | | | |_ / _ \ (_| | || __/
|_| |_|\___|\__,_|_| \__| \/ \_/\__,_|\__\___|
*/
private function getHeartRate() {
// Initialize to null
var heartRate = null;
// Get the activity info if possible
var info = Activity.getActivityInfo();
if (info != null && info.currentHeartRate != null) {
heartRate = info.currentHeartRate;
} else {
// Fallback to `getHeartRateHistory`
var history = ActivityMonitor.getHeartRateHistory(1, true);
if (history != null) {
var latestHeartRateSample = history.next();
if (latestHeartRateSample != null && latestHeartRateSample.heartRate != null) {
heartRate = latestHeartRateSample.heartRate;
}
}
}
// Could still be null if the device doesn't support it
return heartRate;
}
/*
__ __ ___ _
| \/ |___ ___ _ _ | _ \ |_ __ _ ___ ___
| |\/| / _ \/ _ \ ' \ | _/ ' \/ _` (_-</ -_)
|_| |_\___/\___/_||_| |_| |_||_\__,_/__/\___|
*/
function getMoonPhase(year, month, day) {
var c=0;
var e=0;
var jd=0;
var b=0;
if (month < 3) {
year--;
month += 12;
}
++month;
c = 365.25 * year;
e = 30.6 * month;
jd = c + e + day - 694039.09;
jd /= 29.5305882;
b = (jd).toNumber();
jd -= b;
b = Math.round(jd * 8);
if (b >= 8) {
b = 0;
}
return (b).toNumber();
}
/*
0 => New Moon
1 => Waxing Crescent Moon
2 => Quarter Moon
3 => Waxing Gibbous Moon
4 => Full Moon
5 => Waning Gibbous Moon
6 => Last Quarter Moon
7 => Waning Crescent Moon
*/
function moonArrFun(moonnumber){
var screenHeightY = System.getDeviceSettings().screenHeight;
var screenWidthX = System.getDeviceSettings().screenWidth;
var venus2Y = 25*(screenHeightY/360);
var venus2XL = ((screenWidthX)*115/360);
//Size Variations Pixel Circle
//360 VenuS2 - The Model I designed it for
//390 Size up
//416 Size up
//454 Size up
if (screenHeightY == 390){
venus2XL = ((venus2XL)+4);
}
if (screenHeightY == 416){
venus2XL = ((venus2XL)+8);
}
if (screenHeightY == 454){
venus2XL = ((venus2XL)+15);
}
var moonArray= [
(new WatchUi.Bitmap({
:rezId=>Rez.Drawables.newmoon,//0
:locX=> venus2XL,
:locY=> venus2Y
})),
(new WatchUi.Bitmap({
:rezId=>Rez.Drawables.waxcres,//1
:locX=> venus2XL,
:locY=> venus2Y
})),
(new WatchUi.Bitmap({
:rezId=>Rez.Drawables.firstquar,//2
:locX=> venus2XL,
:locY=> venus2Y
})),
(new WatchUi.Bitmap({
:rezId=>Rez.Drawables.waxgib,//3
:locX=> venus2XL,
:locY=> venus2Y
})),
(new WatchUi.Bitmap({
:rezId=>Rez.Drawables.full,//4
:locX=> venus2XL,
:locY=> venus2Y
})),
(new WatchUi.Bitmap({
:rezId=>Rez.Drawables.wangib,//5
:locX=> venus2XL,
:locY=> venus2Y
})),
(new WatchUi.Bitmap({
:rezId=>Rez.Drawables.thirdquar,//6
:locX=> venus2XL,
:locY=> venus2Y
})),
(new WatchUi.Bitmap({
:rezId=>Rez.Drawables.wancres,//7
:locX=> venus2XL,
:locY=> venus2Y,
})),
];
return moonArray[moonnumber];
}
}
function digitPhase(seconds, push){
var screenHeightY = System.getDeviceSettings().screenHeight;
//var screenWidthX = System.getDeviceSettings().screenWidth;
var venus2X = screenHeightY/2+push;
// var venus2Y = 15;
var venus2Y = ((screenHeightY/6)+15);
if (screenHeightY == 416){
venus2Y = ((venus2Y)-8);
}
var digitArray = [
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.digit0,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.digit1,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.digit2,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.digit3,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.digit4,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.digit5,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.digit6,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.digit7,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.digit8,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.digit9,
:locX => venus2X,
:locY => venus2Y
})),
(new WatchUi.Bitmap({
:rezId => Rez.Drawables.colon,
:locX => venus2X,
:locY => venus2Y
}))
];
return digitArray[seconds];
}
// helper function to retrieve the property for any numeric setting
function readKeyInt(myApp, key, thisDefault) {
var value = myApp.getProperty(key);
if (value == null || !(value instanceof Number)) {
if (value != null) {
// Attempt to cast the value to a Number
try {
value = value as Number; // This tries to cast the value to a Number
} catch (e) {
value = thisDefault; // If it fails, fall back to the default
}
} else {
value = thisDefault; // If value is null, use the default
}
}
return value;
}
/*
Horoscope, Zodiac, and Weather Font:
A FAR
B capricorn
C CELCIUS
D Celcius
E SAGIT
F TAUR
G SCORP
H VIRGO
I LIBRA
J LEO
K BULL
L SHEEP
M PM
N AM
0 :
a rain
b sun
c rainsuncloud
d dragon
e cloud
f whirl
g wind
h rat
i snow
j dog
k tiger
l sun up
m rabbit
n sun down
o snake
p horse
q rooster
r monkey
s pig
t male
u female
v aquarius
w aries
x gemini
y leo
z libra
*/
// questionmark=calorie *=heart [=battery ]=steps @=battery #=phone
// = is small battery ^ is small steps ~ is small calories + is small heart