-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLCARSeffects4.bas
2812 lines (2511 loc) · 126 KB
/
LCARSeffects4.bas
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
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=StaticCode
Version=7.3
@EndOfDesignText@
'Code module
'Subs in this code module will be accessible from all modules.
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim DRD_TextSize As Int,DRD_TextHeight As Int, DRD_TextWidth As Int ,DRD_Font As Typeface , DRD_Red As Int = Colors.RGB(252,75,143), DRD_Height As Int , DRD_LightRed As Int = Colors.RGB(223,160,160)
Dim DRD_DarkBlue As Int = Colors.RGB(21,54,125), DRD_LightBlue = Colors.RGB(76,220,229), DRD_DarkRed As Int = Colors.RGB(96,44,46)'Colors.RGB(48,22,23)'
Type CylonText (X As Float, Y As Float, Letter As String, FontSize As Int, Color As Int, Frames As Int, Speed As Float )
Dim CylonFont As Typeface ,CylonLetters As List ,CylonLetterCount As Int = 100
Type MiniButton(Text As String, ColorID As Int)
Type MorseCodeDigit(State As Boolean, Duration As Int)
Type Blinky(RegionID As Int, Morsecode As List, CurrentMorseDigit As Int, R As Int, G As Int, B As Int, TimeTillNextDigit As Int, X As Int, Y As Int, Width As Int, Height As Int, State As Boolean )
Dim TRI_Speed As Int = 4, TRI_Click As Int ,TRI_Alpha As Int , TRI_X As Int, TRI_Scalefactor As Float ,TRI_FrontCamera As Boolean, TRI_Section As Int ,TRI_Subsection As Int
Dim TRI_FrameA As Bitmap, TRI_FrameB As Bitmap, TRI_FrameC As Bitmap, TRI_Frame As Boolean ,TRI_Pixelspace As Int = 2,CameraIsOn As Boolean,CameraToggled As Boolean,FlashIsOn As Boolean, TRI_GraphID As Int = -1
Dim TRI_Buttons As List, TRI_Angle As Int, TRI_ElementID As Int ,TRI_State As Boolean ,TRI_LastUpdate As Long ,Blinkies As List ,MorseUnit As Int = 100, TRI_Stage As Int, TRI_Delay As Int
Dim TRI_CurrentSensor As Int, TRI_Sensors(3) As Point, TRI_CameraOrientation As Int' ,TRI_Channel As Int = 1
Dim TRI_GEO_A As Int = 0, TRI_MET As Int = 1, TRI_BIO As Int = 2, TRI_GEO_B As Int = 3
Dim TRI_Text As List, TRI_TextClean As Boolean ,TRI_SampleRate As Int,TRI_RecData() As Short
Type Planet(Name As String, BodyType As Byte, Aphelion As Float, Perihelion As Float, SemiMajorAxis As Float, Eccentricity As Float, OrbitalPeriod As Double, Radius As Float, Degree As Double, Moons As Byte, Class As Byte)
Dim EarthRadius As Int = 5, AstronomicalUnit As Int, SOL_LastUpdate As Long , SOL_LW As Float, SOL_LH As Float, Planets As List ,CurrentSystem As Int = -1
Dim Sun As Byte = 0, ClassD As Byte = 1, ClassF As Byte = 2, ClassH As Byte = 3, ClassJ As Byte = 4, ClassK As Byte = 5, ClassL As Byte = 6, ClassM As Byte = 7, ClassN As Byte = 8, ClassP As Byte = 9, ClassT As Byte = 10, ClassY As Byte = 11
Dim Asteroids As Byte = 20, SOL_Speed As Float = 1, SOL_Beige As Int = Colors.RGB(195,170,142), SOL_Bars As List , OldPoint As Point
'Event Horizon
Dim EH_Stage As Int, EH_SubStage As Int , EH_MaxStage As Int = 256, EH_TextSize As Int, EH_OldHeight As Int ,EH_LastSecond As Int ,EH_TextHeight As Int , EH_Better As Boolean ,EH_TextSize2 As Int , EH_ItemHeight As Int
End Sub
Sub ResizeElement(Width As Int, Height As Int) As Int
Dim temp As Int
If Width < Height Then
Return Width * (Width /Height)
Else
Return Height
End If
End Sub
Sub DrawOval(BG As Canvas, X As Int, Y As Int, Width As Int, Height As Int, Color As Int, Stroke As Int, RelativeToCenter As Boolean)
If RelativeToCenter Then
BG.DrawOval(SetRect(X-Width*0.5,Y-Height*0.5,Width,Height),Color, Stroke=0, Stroke)
Else
BG.DrawOval(SetRect(X,Y,Width,Height),Color, Stroke=0, Stroke)
End If
End Sub
Sub SetRect(X As Int, Y As Int, Width As Int, Height As Int) As Rect
Dim Rect1 As Rect
Rect1.Initialize(X,Y,X+Width,Y+Height)
Return Rect1
End Sub
Sub DrawRect(BG As Canvas, X As Int, Y As Int, Width As Int, Height As Int, Color As Int, Stroke As Int) As Int
If Width >0 And Height> 0 Then BG.DrawRect(SetRect(X,Y,Width,Height), Color, Stroke=0,Stroke)
Return Y+Height
End Sub
Sub DrawSliver(BG As Canvas, X As Int, Y As Int, Width As Int, Height As Int, Color As Int, Left As Boolean)
Dim P As Path , Dest As Rect
LCARSeffects2.MakePoint(P, X,Y+Height)
If Left Then
LCARSeffects2.MakePoint(P, X+Height,Y)
LCARSeffects2.MakePoint(P, X+Width,Y)
Else
LCARSeffects2.MakePoint(P, X,Y)
LCARSeffects2.MakePoint(P, X+Width-Height,Y)
End If
LCARSeffects2.MakePoint(P, X+Width,Y+Height)
BG.DrawPath(P, Color, False, 2)
BG.DrawPath(P, Color, True, 0)
'LCARSeffects2.CopyPlistToPath(P, Pt, BG, Color, 2, True, False)
'DrawRect(BG,X,Y,Width,Height,Color,0)
'BG.RemoveClip
End Sub
'Left/Right side: -3=(/),-2=/for top-left/bottom-right edge,-1=/,0=|,1=\,2=\ for bottom-left/top-right edge, 3=triangle
'Align: -1=left, 0=center 1=right, 2=OOO
Sub DrawSliver2(BG As Canvas, X As Int, Y As Int, Width As Int, Height As Int, Color As Int, LeftSide As Int, RightSide As Int, Text As String,TextColor As Int, Align As Int) As Int
Dim P As Path , Dest As Rect, TextHeight As Int = Height*0.5
Select Case LeftSide'top to bottom
Case -3'(
BG.DrawCircle(X+TextHeight, Y+ TextHeight, TextHeight, Color, True,0)
LCARSeffects2.MakePoint(P, X+TextHeight,Y)'top
LCARSeffects2.MakePoint(P, X+TextHeight,Y+Height)'bottom
Case -2'/ for top half only
LCARSeffects2.MakePoint(P, X+TextHeight,Y)'top
LCARSeffects2.MakePoint(P, X,Y+TextHeight)'middle
LCARSeffects2.MakePoint(P, X,Y+Height)'bottom
Case -1'/
LCARSeffects2.MakePoint(P, X+Height,Y)'top
LCARSeffects2.MakePoint(P, X,Y+Height)'bottom
Case 0'|
LCARSeffects2.MakePoint(P, X,Y)'top
LCARSeffects2.MakePoint(P, X,Y+Height)'bottom
Case 1'\
LCARSeffects2.MakePoint(P, X,Y)'top
LCARSeffects2.MakePoint(P, X+Height,Y+Height)'bottom
Case 2'\ for bottom half only
LCARSeffects2.MakePoint(P, X,Y)'top
LCARSeffects2.MakePoint(P, X,Y+TextHeight)'top
LCARSeffects2.MakePoint(P, X+TextHeight,Y+Height)'bottom
Case 3'triangle
TextHeight= Height/3
LCARSeffects2.MakePoint(P, X+TextHeight*2,Y+TextHeight)'below top point
LCARSeffects2.MakePoint(P, X+TextHeight*2,Y)'top point
LCARSeffects2.MakePoint(P, X,Y+TextHeight*2)'left point
LCARSeffects2.MakePoint(P, X+Width-TextHeight*2,Y+TextHeight*2)'above bottom point
LCARSeffects2.MakePoint(P, X+Width-TextHeight*2,Y+Height)'bottom point
LCARSeffects2.MakePoint(P, X+Width, Y+TextHeight)'right point
End Select
Select Case RightSide'bottom to top
Case -3')
BG.DrawCircle(X+Width-TextHeight, Y+ TextHeight, TextHeight, Color, True,0)
LCARSeffects2.MakePoint(P, X+Width-TextHeight,Y+Height)'bottom
LCARSeffects2.MakePoint(P, X+Width-TextHeight,Y)'top
Case -2'/ for bottom half only
LCARSeffects2.MakePoint(P, X+Width-TextHeight,Y+Height)'bottom
LCARSeffects2.MakePoint(P, X+Width,Y+TextHeight)'middle
LCARSeffects2.MakePoint(P, X+Width,Y)'top
Case -1'/
LCARSeffects2.MakePoint(P, X+Width-Height,Y+Height)'bottom
LCARSeffects2.MakePoint(P, X+Width,Y)'top
Case 0'|
LCARSeffects2.MakePoint(P, X+Width,Y+Height)'bottom
LCARSeffects2.MakePoint(P, X+Width,Y)'top
Case 1'\
LCARSeffects2.MakePoint(P, X+Width,Y+Height)'bottom
LCARSeffects2.MakePoint(P, X+Width-Height,Y)'top
Case 2'\ for top half only
LCARSeffects2.MakePoint(P, X+Width,Y+Height)'bottom
LCARSeffects2.MakePoint(P, X+Width,Y+TextHeight)'middle
LCARSeffects2.MakePoint(P, X+Width-TextHeight,Y)'top
End Select
'LCARSeffects2.CopyPlistToPath(P, Pt, BG, Color, 2, False, False)
BG.ClipPath(P)
DrawRect(BG,X,Y,Width,Height,Color,0)
DrawScanlines(BG,X,Y,Width,Height,Colors.Black, 3,0,1)
If Text.Length>0 Then
LeftSide = API.GetTextHeight(BG, -(Width-Height*2), Text,DRD_Font)
TextHeight=BG.MeasureStringHeight(Text,DRD_Font,LeftSide)
Y=Y+ (Height*0.5) + (TextHeight*0.5)
Select Case Align
Case -1: BG.DrawText(Text, X+Height, Y, DRD_Font, LeftSide, TextColor, "LEFT") 'left
Case 0: BG.DrawText(Text, X+Width*0.5, Y, DRD_Font, LeftSide, TextColor, "CENTER") 'center
Case 1: BG.DrawText(Text, X+Width-Height, Y, DRD_Font, LeftSide, TextColor, "RIGHT") 'right
End Select
Else
Select Case Align
Case 2'000
TextHeight=Height*0.5
LeftSide=Min(Height*0.4, (Width-(Height*2))/7)
Align=Height+TextHeight
BG.DrawCircle(X+Align, Y+TextHeight, LeftSide, TextColor,True, 0)
BG.DrawCircle(X+Align, Y+TextHeight, LeftSide*0.2, Color,True, 0)
BG.DrawCircle(X+Width*0.5, Y+TextHeight, LeftSide, TextColor,True, 0)
BG.DrawCircle(X+Width*0.5, Y+TextHeight, LeftSide*0.2, Color,True, 0)
BG.DrawCircle(X+Width-Align, Y+TextHeight, LeftSide, Colors.White,True, 0)
BG.DrawCircle(X+Width-Align, Y+TextHeight, LeftSide*0.2, Color,True, 0)
Case 3'gradient bar
X=X+TextHeight+4
Width=Width-TextHeight-Height-8
End Select
End If
BG.RemoveClip
Return X+Width
End Sub
Sub DrawDRADIS(BG As Canvas, X As Int, Y As Int, Width As Int, Height As Int, Color As Int, Scanline As Int) As Rect
Dim temp As Int,temp2 As Int,temp3 As Int ,temp4 As Int,cW As Int = Width * 0.09, cH As Int,TextHeight As Int '= Height * 0.115'0.1095100864553314
If Not(DRD_Font.IsInitialized) Then DRD_Font = Typeface.LoadFromAssets("dradis.ttf")
Height=Height+1
If Width < Height Then
temp = ResizeElement(Width,Height)
Y= Y + (Height*0.5) - (temp*0.5)
Height=temp
End If
cH = Height * 0.115
If DRD_TextSize = 0 Or DRD_Height <> Height Then
DRD_TextSize = 10
DRD_Height=Height
DRD_TextWidth = BG.MeasureStringWidth("999 ", DRD_Font, DRD_TextSize)
DRD_TextHeight = BG.MeasureStringHeight("999", DRD_Font, DRD_TextSize)
End If
DrawRect(BG,X,Y,Width, LCAR.ItemHeight, Color, 0)'top
DrawRect(BG,X,Y+LCAR.ItemHeight, DRD_TextWidth*1.5, Height-LCAR.ItemHeight, Color, 0)'left
DrawRect(BG,X+Width-DRD_TextWidth*1.5,Y+LCAR.ItemHeight, DRD_TextWidth*1.5, Height-LCAR.ItemHeight, Color, 0)'right
DrawRect(BG,X,Y+Height-LCAR.ItemHeight,Width, LCAR.ItemHeight, Color, 0)'bottom
DrawCorner(BG, X+DRD_TextWidth*1.5, Y+LCAR.ItemHeight, cW,cH, Color, 0)'top left
DrawCorner(BG, X+Width-DRD_TextWidth*1.5-cW, Y+LCAR.ItemHeight, cW,cH, Color, 1)'top right
DrawCorner(BG, X+DRD_TextWidth*1.5, Y+Height-LCAR.ItemHeight-cH, cW,cH, Color, 2)'bottom left
DrawCorner(BG, X+Width-DRD_TextWidth*1.5-cW, Y+Height-LCAR.ItemHeight-cH, cW,cH, Color, 3)'bottom right
DrawRoundRect(BG,X+LCAR.ItemHeight*0.5, Y+ LCAR.ItemHeight*0.1+1, Width-LCAR.ItemHeight, LCAR.ItemHeight*0.8, Colors.Black, "", 0, 0, 0, 0)'top
DrawRoundRect(BG,X+LCAR.ItemHeight*0.5, Y+Height- LCAR.ItemHeight*0.9+1, Width-LCAR.ItemHeight, LCAR.ItemHeight*0.8, Colors.Black, "", 0, 0, 0, 0)'bottom
BG.DrawLine(X+DRD_TextWidth*1.5, Y+Height-LCAR.ItemHeight-cH-DRD_TextWidth*1.5, X+DRD_TextWidth*2.5, Y+Height-LCAR.ItemHeight-cH-DRD_TextWidth*2.5, Color, 3)
BG.DrawLine(X+DRD_TextWidth*2.5,Y+Height-LCAR.ItemHeight-cH-DRD_TextWidth*2.5, X+DRD_TextWidth*2.5,Y+cH+LCAR.ItemHeight, Color,3)
'DrawRect(BG, X+DRD_TextWidth*0.25, Y+LCAR.ItemHeight+cH, DRD_TextWidth, Height - LCAR.ItemHeight*2 - cH*2 - DRD_TextWidth*1.5, Colors.Black, 0)'left
DrawMeter(BG, X+DRD_TextWidth*0.25, Y+LCAR.ItemHeight+cH, DRD_TextWidth, Height - LCAR.ItemHeight*2 - cH*2 - DRD_TextWidth*1.5, Color)'left
temp=DRD_TextWidth*0.75
DrawRoundCorner(BG, X+temp, Y+LCAR.ItemHeight+cH-DRD_TextWidth*0.5, 0, 0, DRD_TextWidth*0.5, Colors.Black, True,False, cW/cH)
DrawRect(BG, X+Width-DRD_TextWidth*1.25, Y+Height*0.5, DRD_TextWidth, Height * 0.5 - LCAR.ItemHeight - cH, Colors.Black, 0)'right
DrawRoundCorner(BG, X+Width-temp, Y+Height-LCAR.ItemHeight - cH+DRD_TextWidth*0.5, X+Width-temp*2, Y+Height-LCAR.ItemHeight - cH-temp, DRD_TextWidth*0.5, Colors.Black, True,True, cW/cH)
If Scanline>0 Then DrawScanlines(BG,X,Y,Width,Height, Colors.Black, Scanline,0,1)
temp = DRD_TextWidth * 0.25
DrawSliver(BG, X, Y+ LCAR.ItemHeight + cH - temp, DRD_TextWidth*3+temp*4, temp, Color, False)'under top left
DrawSliver(BG, X, Y+ LCAR.ItemHeight + cH - temp*3, DRD_TextWidth*3+temp*2, temp, Color, False)'top left
TextHeight = cH - temp*4
temp2= Y+ LCAR.ItemHeight + temp*0.5
temp3= DrawRoundRect(BG, X+cW+DRD_TextWidth*1.5, temp2, Width*0.13, TextHeight, DRD_DarkRed, "CENTRAL TRK", DRD_Red, 0,0, 0)+ 5
DrawRoundRect(BG,temp3,temp2, Width*0.08,TextHeight,DRD_DarkRed, "H54 TAC", DRD_Red, 0,0, 0)
temp3= X+Width-(cW+DRD_TextWidth*1.5)
temp4=Width*0.065
DrawRoundRect(BG, temp3-temp4, temp2, temp4, TextHeight, DRD_DarkRed,"OBJ/PKT", DRD_Red,0,0, 0)
temp3=temp3-(temp4*2)-5
DrawRoundRect(BG, temp3, temp2, temp4, TextHeight, DRD_DarkRed,"OBJ", DRD_Red,0,0,0)
temp4=temp4*2
DrawRoundRect(BG, temp3-temp4-5, temp2, temp4, TextHeight, DRD_DarkRed,"SECONDARY T", DRD_Red,0,0,0)
DrawRoundRect(BG, temp3-temp4*2-10, temp2, temp4, TextHeight, DRD_DarkRed,"PRIMARY T", DRD_Red,0,0,0)
temp2=DrawSliver2(BG, X+DRD_TextWidth*3+temp*2, Y+ LCAR.ItemHeight + cH - temp*3, Width*0.13, temp*3, DRD_Red, 1,1, "DRADIS", Colors.White, -1)
DrawSliver2(BG, temp2, Y+ LCAR.ItemHeight + cH - temp*3, temp*9,temp*3,DRD_Red, 1,-1,"", 0,0)
temp2=X+Width-(DRD_TextWidth*3+temp*4)
DrawSliver(BG, temp2, Y+ LCAR.ItemHeight + cH - temp, DRD_TextWidth*3+temp*4, temp, Color, True)'under top right
DrawSliver(BG, X+Width-(DRD_TextWidth*3+temp*2), Y+ LCAR.ItemHeight + cH - temp*3, DRD_TextWidth*3+temp*2, temp, Color, True)'top right
TextHeight = Width*0.13 + temp*9
DrawSliver2(BG,temp2-TextHeight+temp*2,Y+ LCAR.ItemHeight + cH - temp*3, TextHeight, temp*3, DRD_Red, 1,-1, "FIRMWARE: " & LCAR.CurrentVersion, Colors.White,-1)
DrawRect(BG, X, Y+Height - LCAR.ItemHeight-temp*3, DRD_TextWidth*1.5 + cW + temp*2, temp, Color, 0)'bottom left
temp2=DrawSliver2(BG, X+DRD_TextWidth*1.5 + cW + temp*2+5,Y+Height - LCAR.ItemHeight-temp*4, Width*0.13, temp*3, DRD_Red, 1,1, "", DRD_Red, 2)
temp2=DrawSliver2(BG, temp2-temp, Y+Height - LCAR.ItemHeight-temp*4, temp*6,temp*3,DRD_Red, 1,1,"", 0,0)
DrawSliver2(BG, temp2-temp, Y+Height - LCAR.ItemHeight-temp*4, Width*0.13,temp*3, DRD_Red,1,1, "SYS 4EN", Colors.White, -1)
temp2=X+Width-(DRD_TextWidth*1.5 + cW + temp*2)
DrawRect(BG, temp2, Y+Height - LCAR.ItemHeight-temp*3, DRD_TextWidth*1.5 + cW + temp*2, temp, Color, 0)'bottom right
cW = temp*4 + Width*0.26
DrawSliver2(BG, temp2-cW-5,Y+Height - LCAR.ItemHeight-temp*4, cW, temp*3, DRD_Red, -1,-1, "CONFIGURATION PROFILE (USER DEFINED)", Colors.White,1)
'Text buttons
temp = BG.MeasureStringWidth(" SHUT DOWN ", DRD_Font, LCAR.Fontsize)
cW=LCAR.Fontsize
cH=Width - (LCAR.ItemHeight*2)
If cH / temp < 4 Then
cW = API.GetTextHeight(BG, - cH*0.25, " SHUT DOWN ", DRD_Font)
temp = BG.MeasureStringWidth(" SHUT DOWN ", DRD_Font, cW)
End If
TextHeight = BG.MeasureStringHeight("ABC", DRD_Font, cW) *0.5
DrawRoundRect(BG, X+LCAR.ItemHeight, Y+ LCAR.ItemHeight*0.15, temp, LCAR.ItemHeight*0.7, DRD_DarkRed, "SYS REL", Colors.White, TextHeight,cW,0)
DrawRoundRect(BG, X+LCAR.ItemHeight+temp+5, Y+ LCAR.ItemHeight*0.15, temp, LCAR.ItemHeight*0.7, DRD_DarkRed, "SHUT DOWN", Colors.White, TextHeight,cW,0)
DrawRoundRect(BG, X+Width-LCAR.ItemHeight-temp, Y+ LCAR.ItemHeight*0.15, temp, LCAR.ItemHeight*0.7, DRD_DarkRed, "ABORT", Colors.White, TextHeight,cW,0)
'Gradient at the bottom
DrawGradientBar(BG, X+LCAR.ItemHeight*0.5, Y+Height- LCAR.ItemHeight*0.9+1, Width-LCAR.ItemHeight, LCAR.ItemHeight*0.8)
End Sub
Sub DrawGradientBar(BG As Canvas, X As Int, Y As Int, Width As Int, Height As Int)
'DRD_DarkBlue DRD_LightBlue
LCARSeffects.MakeClipPath(BG,X,Y+(Height*0.4),Width,Height*0.6)
X=X+4
Width=Width-8
Y=Y+4
Height=Height-8
DrawRoundRect(BG,X,Y, Width*0.10, Height-1, DRD_LightBlue, "", 0,0, 0,0)
DrawRoundRect(BG,X+Width*0.90,Y, Width*0.10, Height-1, DRD_DarkBlue, "", 0,0, 0,0)
DrawGradientBit(BG,X,Y,Width,Height, 0.07, 0.08, 0, False)
DrawRect(BG, X+ Width*0.26, Y, Width *0.12, Height-1, DRD_LightBlue, 0)
DrawGradientBit(BG,X,Y,Width,Height, 0.145, 0.12, 0,True)
DrawRect(BG, X+ Width*0.48, Y, Width *0.12, Height-1, DRD_DarkBlue, 0)
DrawGradientBit(BG,X,Y,Width,Height, 0.37, 0.12, 0,False)
DrawGradientBit(BG,X,Y,Width,Height, 0.59, 0.10, 0,True)
DrawGradientBit(BG,X,Y,Width,Height, 0.68, 0.05, 0,False)
DrawRect(BG, X+ Width*0.76, Y, Width *0.10, Height-1, DRD_LightBlue, 0)
DrawGradientBit(BG,X,Y,Width,Height, 0.72, 0.05, 0,True)
BG.RemoveClip
LCARSeffects.MakeClipPath(BG,X,Y+(Height*0.4),Width*0.95,Height*0.6)
DrawGradientBit(BG,X,Y,Width,Height, 0.88, 0.04, 0,True)
DrawGradientBit(BG,X,Y,Width,Height, 0.85, 0.04, 0,False)
DrawGradientBit(BG,X,Y,Width,Height, 0.91, 0.04, 0,False)
BG.RemoveClip
Width=Width - LCAR.ItemHeight*0.5
Dim temp As Int, Right As Int= X + Width, Move As Int = Width/21, TextSize As Int = API.GetTextHeight(BG, Height*0.35, "0123", DRD_Font)
Y= Y+ BG.MeasureStringHeight("0123", DRD_Font,TextSize)
X = X + LCAR.ItemHeight*0.5
For temp = 0 To 100 Step 5
BG.DrawText( API.PadtoLength(temp, True,2, "0"), X, Y, DRD_Font, TextSize, DRD_LightBlue, "CENTER")
X=X+Move
Next
End Sub
'Mode: False = light to dark, True = dark to light
Sub DrawGradientBit(BG As Canvas, X As Int, Y As Int, Width As Int, Height As Int, Start As Float, WidthF As Float, CornerRadius As Int, Mode As Boolean)
LCAR.DrawGradient(BG, API.IIF(Mode, DRD_DarkBlue,DRD_LightBlue),API.IIF(Mode, DRD_LightBlue,DRD_DarkBlue), 6, X+(Width*Start),Y,Width*WidthF,Height,CornerRadius,0)
End Sub
Sub DrawMeter(BG As Canvas, X As Int, Y As Int, Width As Int, Height As Int, Color As Int)
Dim temp2 As Int , Whitespace As Int = 1, temp As Int = Y+Height - DRD_TextHeight - Whitespace, tempstr As String
DrawRect(BG,X,Y,Width,Height,Colors.Black,0)
'X=X+(Width*0.5)
Width=Width / 3
Do Until temp < Y
tempstr = API.PadtoLength(temp2, True,3, "0")
BG.DrawText(API.Left(tempstr,1), X+Width ,temp + DRD_TextHeight, DRD_Font, DRD_TextSize, Color, "RIGHT")
BG.DrawText(API.mid(tempstr,1,1), X+Width*2 ,temp + DRD_TextHeight, DRD_Font, DRD_TextSize, Color, "RIGHT")
BG.DrawText(API.right(tempstr,1), X+Width*3 ,temp + DRD_TextHeight, DRD_Font, DRD_TextSize, Color, "RIGHT")
temp = temp - DRD_TextHeight - Whitespace
temp2=temp2+10
Loop
End Sub
'Align: -1=left, 0=center, 1=right
Sub DrawRoundRect(BG As Canvas, X As Int, Y As Int, Width As Int, Height As Int, Color As Int, Text As String, TextColor As Int, TextHeight As Int, FontSize As Int, Align As Int)As Int
Dim temp As ColorDrawable
If Width>Height Then
temp.Initialize(Color, Height*0.5)
Else
temp.Initialize(Color, Width*0.5)
End If
BG.DrawDrawable(temp, SetRect(X,Y,Width,Height))
If Text.Length>0 Then
If FontSize = 0 Then FontSize = API.GetTextHeight(BG, -Width+Height, Text,DRD_Font)
If TextHeight = 0 Then TextHeight = BG.MeasureStringHeight(Text, DRD_Font, FontSize )*0.5
Select Case Align
Case -1: BG.DrawText(Text, X+10, Y+Height*0.5 + TextHeight, DRD_Font, FontSize, TextColor, "LEFT")'left
Case 0: BG.DrawText(Text, X+Width*0.5, Y+Height*0.5 + TextHeight, DRD_Font, FontSize, TextColor, "CENTER")'center
Case 1:BG.DrawText(Text, X+Width-10, Y+Height*0.5 + TextHeight, DRD_Font, FontSize, TextColor, "RIGHT")'right
End Select
End If
Return X+Width
End Sub
Sub DrawScanlines(BG As Canvas, X As Int, Y As Int, Width As Int, Height As Int, Color As Int, LinesBetween As Int, StartLine As Int, Stroke As Int)
Dim temp As Int ,Right As Int = X+Width
For temp = Y + StartLine To Y+Height Step LinesBetween
BG.DrawLine(X, temp, Right, temp, Color,Stroke)
Next
End Sub
'Align: 0=top left, 1=top right, 2=bottom left, 3=bottom right
Sub DrawCorner(BG As Canvas, X As Int, Y As Int, Width As Int, Height As Int, Color As Int, Align As Int)
Dim P As Path , Dest As Rect
If Align < 3 Then LCARSeffects2.MakePoint(P, X,Y)'0
If Align <> 2 Then LCARSeffects2.MakePoint(P, X+Width,Y)'1
If Align <> 1 Then LCARSeffects2.MakePoint(P, X,Y+Height)'2
If Align >0 Then LCARSeffects2.MakePoint(P, X+Width,Y+Height)'3
'LCARSeffects2.CopyPlistToPath(P, Pt, BG, Color, 2, True, False)
'BG.ClipPath(Pt)
BG.DrawPath(P, Color, False, 2)
BG.DrawPath(P, Color, True, 0)
'DrawRect(BG,X,Y,Width,Height,Color,0)
'BG.RemoveClip
End Sub
Sub DrawRoundCorner(BG As Canvas, X As Int, Y As Int, X2 As Int, Y2 As Int, Radius As Int, Color As Int, UseFirst As Boolean, GoUp As Boolean, Aspect As Float)
BG.DrawCircle(X,Y,Radius,Color,True,0)
If Aspect <> 0 Then
If GoUp Then
X2= X - Radius * Aspect
Y2= Y + Radius '* Aspect
Else
X2= X + Radius * Aspect
Y2= Y - Radius '* Aspect
End If
End If
BG.DrawCircle(X2,Y2,Radius,Color,True,0)
BG.DrawLine(X,Y,X2,Y2,Color,Radius*2)
If Not(UseFirst) Then
X=X2
Y=Y2
End If
DrawRect(BG,X-Radius, API.IIF(GoUp, Y-Radius-1, Y), Radius*2, Radius,Color,0)
End Sub
'Halign: 0=left align, 1=center, 2=right align. Valign: 0=below Y, 1=center, 2=above y
Sub DrawDRADISText(BG As Canvas, X As Int, Y As Int, FontSize As Int , MaxWidth As Int, Text As String, TextColor As Int, Halign As Int, Valign As Int) As Int
Dim TextHeight As Int
If Text.Length>0 Then
If Not(DRD_Font.IsInitialized) Then DRD_Font = Typeface.LoadFromAssets("dradis.ttf")
If FontSize = 0 Then
If MaxWidth >0 Then FontSize = API.GetTextHeight(BG, -MaxWidth, Text,DRD_Font) Else FontSize= LCAR.FontSize
End If
TextHeight = BG.MeasureStringHeight(Text, DRD_Font, FontSize )
If Valign=1 Then TextHeight=TextHeight*0.5
If Valign<2 Then Y=Y+TextHeight
BG.DrawText(Text, X, Y, DRD_Font, FontSize, TextColor, API.IIFIndex(Halign, Array As String("LEFT", "CENTER", "RIGHT")))
Return FontSize
End If
End Sub
Sub GetUseableSpace(X As Int, Y As Int, Width As Int, Height As Int, FullScreen As Boolean) As Rect
Dim temp As Int
If Width < Height Then
temp = ResizeElement(Width,Height)
Y= Y + (Height*0.5) - (temp*0.5)
Height=temp
End If
If Not(FullScreen) Then
temp = Width * 0.09
X=X+ (DRD_TextWidth*1.5) + temp
Width= Width-(DRD_TextWidth*3)-(temp*2)
temp=Height * 0.115
Y= Y+ LCAR.ItemHeight+temp *2
Height= Height - (LCAR.ItemHeight*2)-(temp*3)
End If
Return SetRect(X,Y,Width,Height)
End Sub
Sub DrawDRADISTimer(BG As Canvas, X As Int, Y As Int, Width As Int, Height As Int, Time As Int)
Dim Screen As Rect = GetUseableSpace(X,Y,Width,Height,False), X2 As Int = Screen.Left, Y2 As Int = Screen.Top, Width2 As Int = Screen.Right-Screen.Left, Height2 As Int = Screen.Bottom - Screen.Top
Dim temp As Int = Height2*0.07, temp2 As Int =Height2*0.5 , temp3 As Int = Width2*0.33 , temp4 As Int=temp2*0.2241379310344828 , P As Path ,Textsize As Int
LCARSeffects.MakeClipPath(BG,X2,Y2,Width2,Height2)
DrawRect(BG,X2,Y2,Width2, temp, DRD_LightRed,0)'top
temp=temp*0.5
DrawRect(BG,X2,Y2, temp ,temp2,DRD_LightRed,0)'left
DrawRect(BG,X2+Width2-temp,Y2, temp ,temp2,DRD_LightRed,0)'right
BG.DrawLine(X2, Y2+temp2,X2+temp3, Y2+Height2, DRD_LightRed,temp)'\
BG.DrawLine(X2 + Width2, Y2+temp2,X2+Width2- temp3, Y2+Height2, DRD_LightRed,temp)'/
DrawRect(BG,X2+temp3-temp*0.5, Y2+Height2- temp, temp3+temp*2, temp, DRD_LightRed,0)'_
BG.RemoveClip
DrawDRADIS(BG,X, Y, Width,Height, DRD_Red, 3)
Dim Hours As Int = Floor(Time / 3600), Minutes As Int = (Time Mod 3600) / 60, Seconds As Int = Time Mod 60, temp5 As Int = Width2*0.0958605664488017
LCAR.ActivateAA(BG,True)
Textsize= DrawDRADISText(BG,X2+temp+2, Y2+temp*2+2, 0, Width2*0.25, "FTL JUMP COUNTDOWN", DRD_LightRed, 0,0)
DrawDigital(BG, X2+temp*2+temp5, Y2+ temp4, Width2-temp5*2, temp2-temp4*2, Hours,Minutes,Seconds, Time>-1)
DrawCountDown(BG, X2+temp5*0.5, Y2+temp2, Width2-temp5,Height2, temp3,temp2-temp5*0.25, Hours,Minutes,Seconds, Time>-1,DRD_LightRed, Textsize)
End Sub
Sub DrawCountDown(BG As Canvas, X As Int, Y As Int, Width As Int, Height As Int, temp As Int,temp2 As Int, Hours As Int, Minutes As Int, Seconds As Int, IsNegative As Boolean, Color As Int, Textsize As Int)
Dim Pt As Path, Degree As Int=150 ,X2 As Int
LCARSeffects2.MakePoint(Pt, X,Y)
LCARSeffects2.MakePoint(Pt, X+temp*2,Y+Height)
LCARSeffects2.MakePoint(Pt, X+Width-temp*2,Y+Height)
LCARSeffects2.MakePoint(Pt, X+Width,Y)
temp=Colors.RGB(32,32,32)
'LCARSeffects2.CopyPlistToPath(P, Pt, BG, temp, 0, False, False)
BG.ClipPath(Pt)
DrawRect(BG,X,Y,Width,temp2,temp,0)
Height=temp2
temp=Height*0.5
X=X+Width*0.5
Y=Y+temp
BG.DrawCircle(X, Y, temp, Colors.Black, True,0)
BG.RemoveClip
BG.DrawLine(X,Y, X-temp,Y, Color,2)'middle
DrawDRADISText(BG, X-temp-10, Y, Textsize, 0, "ME2 (-12)", Color, 2,1)
BG.DrawLine(X,Y-temp*0.95, X-temp,Y-temp*0.95, Color,2)'top
DrawDRADISText(BG, X-temp-10, Y-temp*0.95, Textsize, 0, "FTL JUMP", Color, 2, 0)
BG.DrawLine(X,Y-temp*0.60, X-temp,Y-temp*0.60, Color,2)'in between middle and top
DrawDRADISText(BG, X-temp-10, Y-temp*0.60, Textsize, 0, "ME1 (-1)", Color, 2,1)
BG.DrawCircle(X, Y, temp*0.95, Colors.Black, True,0)
Pt.Initialize(X,Y-temp)'top middle
Pt.LineTo(X,Y)'middle middle
X2=Trig.findXYAngle(X,Y, temp*0.95, Degree,True) 'angle=150
Pt.LineTo(X2,Y+temp)'right bottom
Pt.LineTo(X-temp,Y+temp)'left bottom
Pt.LineTo(X-temp,Y-temp)'left top
BG.ClipPath(Pt)
BG.DrawCircle(X,Y, temp*0.95, Color, False, 2)'semi-circle
BG.RemoveClip
BG.DrawCircle(X2, Trig.findXYAngle(X,Y, temp*0.95, Degree,False) , 5, Color,True, 0)'dot
'LCARSeffects.DrawCircleSegment(BG, X, Y, temp*0.95, -2, 0,-210, Color, 4,3, 0)'outer ring with a dot
Degree=354
'Height=33
For temp2 = 1 To Max(Minutes,Seconds)'6 degrees per minute/second
'If temp2 <= Height Then LCARSeffects.DrawCircleSegment(BG, X, Y, temp*0.95, -2, temp2, 6, Color, 0, 3,0)
If Seconds >= temp2 Then LCARSeffects.DrawCircleSegment(BG, X, Y, temp*0.85, -temp*0.1, Degree, 5, Color, 0,0,0)
If Minutes >= temp2 Then LCARSeffects.DrawCircleSegment(BG, X, Y, temp*0.60, -temp*0.3, Degree, 5, Color, 0,0,0)
Degree=Degree-6
Next
Degree= 330
For temp2 = 1 To Hours'30 degrees per hour (max of 12)
LCARSeffects.DrawCircleSegment(BG, X, Y, temp*0.25, -temp*0.3, Degree, 29, Color, 0,0,0)
Degree=Degree-30
Next
End Sub
Sub DrawDigital(BG As Canvas, X As Int, Y As Int, Width As Int, Height As Int, Hours As Int, Minutes As Int, Seconds As Int, IsNegative As Boolean)
Dim UnitWidth = Height * 0.6176470588235294, SpacePerDigit = Width / 8, ColorTrue As Int = Colors.RGB(249,218,172), ColorFalse As Int = Colors.RGB(62,22,26),ShowColon As Boolean = Seconds Mod 2=0
DrawDigitalByte(BG, X,Y, UnitWidth, Height, ColorTrue,ColorFalse, API.IIF(IsNegative, -1,-2))'-
DrawDigitalByte(BG, X+SpacePerDigit,Y, UnitWidth, Height, ColorTrue,ColorFalse, Floor(Hours / 10) )'hours tens
DrawDigitalByte(BG, X+SpacePerDigit*2,Y, UnitWidth, Height, ColorTrue,ColorFalse, Hours Mod 10 )'hours ones
DrawDigitalByte(BG, X+SpacePerDigit*3, Y, SpacePerDigit-UnitWidth, Height, ColorTrue,ColorFalse, API.IIF(ShowColon, -3,-4))' :
DrawDigitalByte(BG, X+SpacePerDigit*3.5, Y, UnitWidth, Height, ColorTrue,ColorFalse, Floor(Minutes / 10) )'Minutes tens
DrawDigitalByte(BG, X+SpacePerDigit*4.5,Y, UnitWidth, Height, ColorTrue,ColorFalse, Minutes Mod 10 )'Minutes ones
DrawDigitalByte(BG, X+SpacePerDigit*5.5, Y, SpacePerDigit-UnitWidth, Height, ColorTrue,ColorFalse, API.IIF(ShowColon, -3,-4))' :
DrawDigitalByte(BG, X+SpacePerDigit*6, Y, UnitWidth, Height, ColorTrue,ColorFalse, Floor(Seconds / 10) )'Seconds tens
DrawDigitalByte(BG, X+SpacePerDigit*7,Y, UnitWidth, Height, ColorTrue,ColorFalse, Seconds Mod 10 )'Seconds ones
End Sub
Sub DrawDigitalByte(BG As Canvas, X As Int, Y As Int, Width As Int, Height As Int, ColorTrue As Int,ColorFalse As Int, Value As Int)
Dim Bits() As Boolean , O As Boolean=False, I As Boolean=True, WhiteSpace As Int = 3, Unit As Int = Height * 0.1666666666666667, Unit2 As Int =Height*0.5, DoBits As Boolean
Select Case Value' 0 1 2 3 4 5 6
'decimal
Case 0: Bits = Array As Boolean(O,I,I,I,I,I,I)'middle hor
Case 1: Bits = Array As Boolean(O,O,O,O,I,I,O)'top left ver
Case 2: Bits = Array As Boolean(I,O,I,I,O,I,I)'bottom left ver
Case 3: Bits = Array As Boolean(I,O,O,I,I,I,I)'bottom hor
Case 4: Bits = Array As Boolean(I,I,O,O,I,I,O)'bottom right ver
Case 5: Bits = Array As Boolean(I,I,O,I,I,O,I)'top right ver
Case 6: Bits = Array As Boolean(I,I,I,I,I,O,I)'top hor
Case 7: Bits = Array As Boolean(O,O,O,O,I,I,I)
Case 8: Bits = Array As Boolean(I,I,I,I,I,I,I)
Case 9: Bits = Array As Boolean(I,I,O,O,I,I,I)
'hexadecimal
Case 10:Bits= Array As Boolean(I,I,I,O,I,I,I)
Case 11:Bits= Array As Boolean(I,I,I,I,I,O,O)
Case 12:Bits= Array As Boolean(O,I,I,I,O,O,I)
Case 13:Bits= Array As Boolean(I,O,I,I,I,I,O)
Case 14:Bits= Array As Boolean(I,I,I,I,O,O,I)
Case 15:Bits= Array As Boolean(I,I,I,O,O,O,I)
'symbols
Case -1, -2' - and +
Bits = Array As Boolean(I,O,O,O,O,O,O)' -
DoBits= Value=-2'+
Case -3 ,-4' : (lit, dim)
Width=Width*0.5
DrawRect(BG,X, Y+Unit2-WhiteSpace-Width, Width, Width, API.IIF(Value = -3, ColorTrue,ColorFalse), 0)
DrawRect(BG,X, Y+Unit2+ (Unit2*0.5)- (Width*0.5), Width, Width, API.IIF(Value = -3, ColorTrue,ColorFalse), 0)
Return
End Select
'If DoBits Then
DrawDigitalBit(BG, X+WhiteSpace, Y+Unit2 - Unit*0.5, Width-WhiteSpace*2, Unit, API.IIF( Bits(0), ColorTrue,ColorFalse), 0)'middle hor
Unit=Unit*0.9
DrawDigitalBit(BG, X, Y+WhiteSpace, Unit, Unit2-WhiteSpace*2, API.IIF( Bits(1), ColorTrue,ColorFalse), 1)'top left ver
DrawDigitalBit(BG, X, Y+Unit2+WhiteSpace, Unit, Unit2-WhiteSpace*2, API.IIF( Bits(2), ColorTrue,ColorFalse), 1)'bottom left ver
DrawDigitalBit(BG, X+WhiteSpace,Y+Height-Unit, Width-WhiteSpace*2, Unit, API.IIF( Bits(3), ColorTrue,ColorFalse), 4)' bottom left hor
DrawDigitalBit(BG, X+Width-Unit, Y+Unit2+WhiteSpace, Unit, Unit2-WhiteSpace*2, API.IIF( Bits(4), ColorTrue,ColorFalse), 2)'bottom right ver
DrawDigitalBit(BG, X+Width-Unit, Y+WhiteSpace, Unit, Unit2-WhiteSpace*2, API.IIF( Bits(5), ColorTrue,ColorFalse), 2)'top right ver
DrawDigitalBit(BG, X+WhiteSpace,Y, Width-WhiteSpace*2, Unit, API.IIF( Bits(6), ColorTrue,ColorFalse), 3)' top hor
End Sub
Sub DrawDigitalBit(BG As Canvas, X As Int, Y As Int, Width As Int, Height As Int, Color As Int, BitType As Int)
Dim temp As Int , P As Path'BitType: 0= <_> 1= |> 2= <| 3= \_/ 4= /_\
Select Case BitType
Case 0'-
temp = Height *0.5
LCARSeffects2.MakePoint(P, X+temp,Y)
LCARSeffects2.MakePoint(P, X,Y+temp)
LCARSeffects2.MakePoint(P, X+temp,Y+Height)
LCARSeffects2.MakePoint(P, X+Width-temp,Y+Height)
LCARSeffects2.MakePoint(P, X+Width,Y+temp)
LCARSeffects2.MakePoint(P, X+Width-temp,Y)
Case 1'|>
LCARSeffects2.MakePoint(P, X,Y)
LCARSeffects2.MakePoint(P, X+Width,Y+Width)
LCARSeffects2.MakePoint(P, X+Width,Y+Height-Width)
LCARSeffects2.MakePoint(P, X,Y+Height)
Case 2'<|
LCARSeffects2.MakePoint(P, X,Y+Width)
LCARSeffects2.MakePoint(P, X+Width,Y)
LCARSeffects2.MakePoint(P, X+Width,Y+Height)
LCARSeffects2.MakePoint(P, X,Y+Height-Width)
Case 3'_ going down
LCARSeffects2.MakePoint(P, X,Y)
LCARSeffects2.MakePoint(P, X+Height,Y+Height)
LCARSeffects2.MakePoint(P, X+Width-Height,Y+Height)
LCARSeffects2.MakePoint(P, X+Width,Y)
Case 4'_ going up
LCARSeffects2.MakePoint(P, X,Y+Height)
LCARSeffects2.MakePoint(P, X+Height,Y)
LCARSeffects2.MakePoint(P, X+Width-Height,Y)
LCARSeffects2.MakePoint(P, X+Width,Y+Height)
End Select
If P.IsInitialized Then
'LCARSeffects2.CopyPlistToPath(P, Pt, BG, Color, 0, False, False)
'BG.ClipPath(P)
'DrawRect(BG, X,Y,Width,Height,Color,0)
'BG.RemoveClip
BG.DrawPath(P, Color, True, 0)
End If
End Sub
Sub RndLetter As String
Return Chr(Rnd(Asc("a"), Asc("o")))
End Sub
Sub NewCylonLetter(Middle As Boolean) As CylonText
Dim temp As CylonText ,Alpha As Int , GoingDown As Boolean
temp.X = Rnd(0,101) * 0.01
GoingDown = (Rnd(0,100)< 50)
If Middle Then
temp.Y = API.IIF(GoingDown, Rnd(0,21), Rnd(80,105)) * 0.01
Else
temp.Y = API.IIF(GoingDown, 0, 1)
End If
temp.Letter = RndLetter
temp.FontSize = Rnd(5,30)
temp.Frames = 5
temp.Speed = Rnd(1,7) * API.IIF(GoingDown, 0.01, -0.01)
Alpha = Min(255, temp.FontSize * 8.5)
temp.Color = Colors.ARGB(Alpha,215,89,111)
Return temp
End Sub
Sub DrawCylon(BG As Canvas, X As Int, Y As Int, Width As Int, Height As Int)
Dim temp As Int , tempLetter As CylonText
If Not(CylonFont.IsInitialized) Then CylonFont = Typeface.LoadFromAssets("cylon.ttf")
If Not(CylonLetters.IsInitialized) Then
CylonLetters.Initialize
For temp = 1 To CylonLetterCount
CylonLetters.Add( NewCylonLetter(True) )
Next
End If
For temp = 0 To CylonLetters.Size -1
tempLetter = CylonLetters.Get(temp)
BG.DrawText( tempLetter.Letter, X + Width * tempLetter.X, Y+ Height* tempLetter.Y, CylonFont, tempLetter.FontSize, tempLetter.Color , "CENTER")
Next
End Sub
Sub IncrementCylon
Dim temp As Int , tempLetter As CylonText
If CylonLetters.IsInitialized Then
For temp = 0 To CylonLetters.Size -1
tempLetter = CylonLetters.Get(temp)
tempLetter.y = tempLetter.y + tempLetter.Speed '(API.IIF(tempLetter.goingdown, tempLetter.fontsize, -tempLetter.fontsize) * 0.01)
If tempLetter.y > 1.05 Or tempLetter.y < -0.05 Then
CylonLetters.Set(temp, NewCylonLetter(False))
Else
tempLetter.Frames = tempLetter.Frames- 1
If tempLetter.Frames = 0 Then
tempLetter.Frames=5
tempLetter.Letter = RndLetter
End If
End If
Next
End If
End Sub
Sub DrawAirplaneAlart(BG As Canvas, X As Int,Y As Int, Width As Int,Height As Int, ColorID As Int,Stage As Int,Alpha As Int)
Dim Size As Int = Min(Width,Height), Color As Int, Text As String , CenterX As Int = X + Width/2, CenterY As Int = Y + Height/2, temp As Int
'pre-processing
Select Case ColorID
Case LCAR.Classic_Green, LCAR.LCAR_Yellow
Color = Colors.rgb(255,255,189) 'beige
Text = API.IIF(ColorID=LCAR.Classic_Green, "WEIRD", "BIZARRE")
Case LCAR.LCAR_Red
Alpha=255
If Stage >13 Then Stage = LCARSeffects.OkudaStages - Stage
If Stage < 13 Then Alpha = Min(255, 64 + (Stage * 16))
Color = Colors.ARGB(Alpha,203,8,8) 'red
Text = "STRANGE"
End Select
'frame
DrawRect(BG,X,Y,Width,Height, Colors.RGB(66,66,66),0)
LCARSeffects2.DrawRoundRect(BG, CenterX - Size/2, CenterY - Size/2, Size,Size, Colors.Black, Size*0.2)
Size=Size*0.8
LCARSeffects2.DrawLegacyButton(BG, CenterX - Size/2, CenterY - Size/2, Size,Size, Color, "", 1, 0)
X = CenterX - Size/2
Y = CenterY - Size/2
LCARSeffects.MakeClipPath(BG, X,Y, Size,Size)
'circles
For temp = 0 To Size *0.25 Step Size * 0.025
BG.DrawCircle(CenterX,CenterY, temp, Colors.Black, False,0)
Next
For temp = temp To Size * 1.5 Step Size * 0.05
BG.DrawCircle(CenterX,CenterY, temp, Colors.Black, False,0)
Next
'lines
For temp = 0 To Size Step Size * 0.05
BG.DrawLine(X, Y+ temp, X+Size, Y+ temp, Colors.Black, 0)
BG.DrawLine(X+ temp, Y, X+temp, Y+Size, Colors.Black, 0)
Next
'text
API.DrawTextAligned(BG, Text, X + Size*0.085, CenterY - Size/4, 0, LCARSeffects2.StarshipFont, LCAR.Fontsize, Colors.Black, -4, 0, 0)
BG.RemoveClip
End Sub
Sub StartTricoder(ElementID As Int)
TRI_Section=-1
TRI_Subsection=0
TRI_State=False
TRI_ElementID=ElementID
LCAR.SetLRwidth(ElementID,0,0)
LCAR.ForceShow(ElementID, True)'element 102 (group 44)
TRI_Buttons.Initialize
If Not(Blinkies.IsInitialized ) Then
Blinkies.Initialize
MakeBlinky(1, "MICHAEL OKUDA", 22,246,255, 51,34, 28,16)'blue (TOP LEFT)
MakeBlinky(2, "TOM NARDI", 98,210,193, 50,90, 20,10)'green (SIGMA)
MakeBlinky(4, "TECHNI MYOKO", 22,246,255, 251,95, 12,8)'blue (TOP RIGHT)
MakeBlinky(10, "%", 255,255,0, 79,365, 17,10)'orange (GEO)
MakeBlinky(11, "", 255,255,0, 105,365, 17,10)'orange (MET)
MakeBlinky(12, "", 255,255,0, 131,365, 17,10)'orange (BIO)
MakeBlinky(13, "Q DEEZY", 22,246,255, 173,365, 18,12)'blue (LB)
MakeBlinky(14, "PHIL W", 22,246,255, 193,365, 18,12)'blue (AB)
MakeBlinky(15, "", 255,122,120, 233,366, 24,20)'red (EMRG)
MakeBlinky(16, "", 255,255,0, 78,410, 20,10)'orange (SENSOR SYS Left)
MakeBlinky(17, "", 255,255,0, 127,410, 20,10)'orange (SENSOR SYS Right)
MakeBlinky(19, "THANK YOU", 22,246,255, 231,414, 15,13)'blue (INT)
MakeBlinky(20, "EVERYONE", 22,246,255, 248,414, 15,13)'blue (EXT)
MakeBlinky(21, "I NEED SLEEP", 253,236,86, 127,441, 18,15)'yellow (OSX)
MakeBlinky(25, "LOTS OF IT", 255,255,0, 233,488, 14,12)'orange (bottom right)
TRI_GraphID= LCARSeffects2.AddGraph( LCARSeffects2.UnusedGraphID, 25, False)
Else
ResetBlinkies
'SetBlinky(10, "%")
'SetBlinky(11, "")
'SetBlinky(12, "")
End If
End Sub
Sub TRI_AddButtons(Buttons() As String)
Dim temp As Int, lastcolor As Int
TRI_Buttons.Clear
For temp = 0 To Buttons.Length-1
Dim tempButton As MiniButton
tempButton.Initialize
lastcolor = LCAR.LCAR_RandomColor2(lastcolor)
tempButton.ColorID = lastcolor
tempButton.Text=Buttons(temp)
TRI_Buttons.Add(tempButton)
Next
End Sub
Sub ClearFrames
API.ClearBMP(TRI_FrameA, Colors.Black)
API.ClearBMP(TRI_FrameB, Colors.Black)
API.ClearBMP(TRI_FrameC, Colors.Black)
End Sub
'0=GEO 1=MET 2=BIO 3=2d/3d sensors
Sub SwitchTricorderSection(Section As Int, SubSection As Int)
Dim Text As String = "SCAN ANALYSIS", SideText As String = "AUXILIARY SYSTEMS MONITOR 117"
If TRI_Section <> Section Then''Dim TRI_GEO_A As Int = 0, TRI_MET As Int = 1, TRI_BIO As Int = 2, TRI_GEO_B As Int = 3
SetBlinky(10, API.IIF(Section=TRI_GEO_A Or Section=TRI_GEO_B, "%", ""))
SetBlinky(11, API.IIF(Section=TRI_MET, "%", ""))
SetBlinky(12, API.IIF(Section=TRI_BIO, "%", ""))
SetBlinky(16, "")
SetBlinky(17, "")
ClearFrames
Select Case TRI_Section'leaving section
Case TRI_GEO_A,TRI_GEO_B: If Section <> TRI_GEO_A And Section <> TRI_GEO_B Then CameraAction(6,"leaving 1")
Case TRI_MET,TRI_BIO: CameraAction(1,"leaving 0") ' LCAR.pushevent(LCAR.SYS_Camera, 1, 0,0,0,0,0, LCAR.Event_Up)'leaving section 0, stop camera
End Select
Select Case Section'entering section
Case TRI_GEO_A'1d sensors
'0=mic 13=light, 14=pressure, 15=temperature, 16=proximity, 17=battery, 18=total magnetic field, 19=medical insurance remaining
If TRI_Section<>TRI_GEO_A And TRI_Section<>TRI_GEO_B Then CameraAction(5, "entering GEOA")
UseSensor(18)
TRI_AddButtons(Array As String("MAG", "MIC", "LIT", "BAT"))
SetBlinky(16, "NINTENDO")
Case TRI_MET'camera
Text="CAM. ANALYSIS"
TRI_CurrentSensor=1
CameraAction(0,"entering MET")'LCAR.pushevent(LCAR.SYS_Camera, 0, 0,0,0,0,0, LCAR.Event_Up)'entering section 0, start camera
TRI_AddButtons(Array As String("MOT", "HST"))
Case TRI_GEO_B'2d/3d sensors
'1,2,3=acc, 4,5,6=mag, 7,8,9=ori, 10,11,12=gyro,
If TRI_Section<>TRI_GEO_A And TRI_Section<>TRI_GEO_B Then CameraAction(5, "entering GEOB")
UseSensor(-2)
TRI_AddButtons(Array As String("ACC", "MAG", "ORI", "GYR"))
SetBlinky(17, "SUCKS")
Case TRI_BIO
Text= "FREQ. ANALYSIS"
TRI_AddButtons(Array As String("MIC", "GPS", "WEA"))
TRI_Subsection=0
TRI_CurrentSensor=0
TRI_SampleRate=0
CameraAction(9, "entering BIO")
End Select
LCAR.LCAR_SetElementText(TRI_ElementID, Text,SideText)
End If
TRI_Section=Section
TRI_Subsection=SubSection
End Sub
'0: SetupCamera, 1: StopCamera, 2: camEx.ToggleFlash, 3: toggle camera, 4: TakePicture, 5: enable sensors, 6: disable sensors, 7: exit
'8: start gps, 9: start recording
Sub CameraAction(Index As Int, Reason As String) As Boolean
Select Case Index
Case 0'turn on camera
If CameraToggled Or CameraIsOn Or Not(TRI_State) Or TRI_Angle <180 Then Return
CameraToggled=True
FlashIsOn=False
Case 1'turn off camera
CameraToggled=False'to make sure it's not continually init'd
LCAR.Lightpackevent(-1, 0, 255,255,255)
FlashIsOn=False
Case 2'toggle flash
FlashIsOn = Not(FlashIsOn)
If Not(CameraIsOn) Then
Index = 0
FlashIsOn = True
End If
End Select
Log("CameraAction: " & Index & ") " & Reason)' & " " & API.IIFIndex(Index, Array As String("ON", "OFF", "FLASH", "CAMERA", "TAKE PIC")))
LCAR.pushevent(LCAR.SYS_Camera, Index, 0,0,0,0,0, LCAR.Event_Up)'leaving section 0, stop camera
End Sub
Sub TRI_HandleMouse(X As Int, Y As Int, Action As Int)As Int
Dim Region As Int = -1
If Action = LCAR.Event_Move Then Return
If LCAR.SmallScreen Then
Region=0
Region = IsRegion(Region, 26, X,Y, 0, 0, LCAR.ScaleWidth, 50)'bottom screen in smallscreen mode
If Region = 0 Then Region = -1
End If
If X>= TRI_X And X <= TRI_X + 299*TRI_Scalefactor Or Region>-1 Then
If Region = -1 Then
X=(X-TRI_X)/TRI_Scalefactor
Y=Y/TRI_Scalefactor
Region=0'out of bounds
End If
If TRI_Angle =180 Then
'row 1 - Top half
Region = IsRegion(Region, 1, X,Y, 27, 27, 61, 31)'top left
'row 2
Region = IsRegion(Region, 2, X,Y, 25, 89, 51, 17)'sigma
Region = IsRegion(Region, 3, X,Y, 80, 89, 35, 17)'COM
Region = IsRegion(Region, 4, X,Y, 234, 92, 44, 20)'right
'row 3
Region = IsRegion(Region, 5, X,Y, 28, 129, 238, 108)'top screen
'row 4
Region = IsRegion(Region, 6, X,Y, 28, 249, 178, 29)'pad below screen
Region = IsRegion(Region, 7, X,Y, 227, 249, 41, 29)'red/blue lights
'row 5 - Bottom half
Region = IsRegion(Region, 8, X,Y, 28, 314, 240, 41)'bottom screen
'row 6
Region = IsRegion(Region, 9, X,Y, 20, 362, 38, 104)'left pad
Region = IsRegion(Region, 10, X,Y, 69, 360, 32, 32)'GEO
Region = IsRegion(Region, 11, X,Y, 101, 360, 32, 32)'MET
Region = IsRegion(Region, 12, X,Y, 133, 360, 32, 32)'BIO
Region = IsRegion(Region, 13, X,Y, 165, 360, 29, 32)'LB
Region = IsRegion(Region, 14, X,Y, 190, 360, 32, 32)'LB
Region = IsRegion(Region, 15, X,Y, 222, 360, 49, 47)'EMRG
'row 7
Region = IsRegion(Region, 16, X,Y, 69, 399, 45, 27)'SENSOR SYS LEFT
Region = IsRegion(Region, 17, X,Y, 114, 399, 45, 27)'SENSOR SYS RIGHT
Region = IsRegion(Region, 18, X,Y, 160, 394, 58, 35)'WHITE BLOCK
Region = IsRegion(Region, 19, X,Y, 223, 409, 25, 25)'INT
Region = IsRegion(Region, 20, X,Y, 248, 409, 25, 25)'EXT
'row 8
Region = IsRegion(Region, 21, X,Y, 67, 434, 91, 30)'OSX
Region = IsRegion(Region, 22, X,Y, 161, 434, 59, 29)'INTRSHIP|RECORD
Region = IsRegion(Region, 23, X,Y, 224, 434, 48, 28)'HOLLOW BLOCK
'row 9
Region = IsRegion(Region, 24, X,Y, 15, 476, 171, 43)'TEXT BLOCK
Region = IsRegion(Region, 25, X,Y, 211, 476, 57, 40)'Bottom right
End If
'Log("TRI_Region: " & Region)
If Action>-1 Then
TRI_HandleAction(X,Y,Action,Region)
End If
End If
Return Region
End Sub
Sub IsRegion(RegionNow As Int, Region As Int, MouseX As Int, MouseY As Int, X As Int, Y As Int, Width As Int, Height As Int) As Int
If RegionNow = 0 Then'LOD
If MouseX >=X AND MouseX<=X+Width AND MouseY>=Y AND MouseY<=Y+Height Then Return Region
End If
Return RegionNow
End Sub
Sub TRI_HandleAction(X As Int, Y As Int, Action As Int, Region As Int)
Dim temp As Int = 34, Width As Int = 229-temp, ButtonIndex As Int = -1, OldSection As Int = TRI_Subsection
If Action = LCAR.Event_up Then Return
If (Region=8 OR Region=26) AND TRI_Buttons.IsInitialized Then'TRI_X + 32*TRI_Scalefactor, Y + 320*TRI_Scalefactor, 229*TRI_Scalefactor, 31*TRI_Scalefactor
If Region = 8 Then
X=X-32-temp
Y=Y-320
Else
Width=LCAR.ScaleWidth '/scalefactor
Region=8
End If
Width = Width/Max(TRI_Buttons.Size,4)
ButtonIndex = Floor(X / Width)
Log("ButtonIndex: " & ButtonIndex & " " & Width)
If TRI_Buttons.Size < 4 Then ButtonIndex = ButtonIndex - (4-TRI_Buttons.Size)
' If TRI_Buttons.Size = 3 Then
' ButtonIndex = ButtonIndex-1
' Else If TRI_Buttons.Size < 4 Then
' ButtonIndex = ButtonIndex-TRI_Buttons.Size
' End If
ButtonIndex= Max(-1, ButtonIndex)
If ButtonIndex >= TRI_Buttons.Size Then ButtonIndex=-1
If ButtonIndex>-1 Then TRI_Subsection = ButtonIndex
ClearFrames
Log("ButtonIndex: " & ButtonIndex)
End If
Select Case Region
Case 0'out of bounds
If TRI_Angle< 180 Then LCAR.SetLRwidth(TRI_ElementID,TRI_Angle,180)'opens
Case 10,11,12'GEO,MET,BIO
SwitchTricorderSection(Region-10, 0)
Case 15'EMRG
LCAR.SetRedAlert(Not(LCAR.RedAlert), "TRICORDER")
SetBlinky(15, API.IIF(LCAR.RedAlert,"RED ALERT",""))
Case 24'text block
CameraAction(1,"text block")
TRI_State=False
LCAR.SetLRwidth(TRI_ElementID,TRI_Angle,0)'closes
LCAR.Lightpackevent(-1, 0, 255,255,255)
Case 25'bottom right
'CameraAction(7, "bottom right")
LCAR.SystemEvent(0,-1)'exit
Case Else
Select Case TRI_Section 'Dim TRI_GEO_A As Int = 0, TRI_MET As Int = 1, TRI_BIO As Int = 2, TRI_GEO_B As Int = 3
Case TRI_GEO_A'1d sensors
Select Case Region
'0=mic 13=light, 14=pressure, 15=temperature, 16=proximity, 17=battery, 18=total magnetic field, 19=medical insurance remaining
Case 8'bottom screen
UseSensor( API.IIFIndex(ButtonIndex, Array As Int( 18, 0, 13, 17, 19 )))
Case 17
SwitchTricorderSection(3,0)
End Select
Case TRI_MET'camera stuff
Select Case Region
'Case 8:TRI_Subsection = ButtonIndex 'bottom screen
Case 18
TRI_CurrentSensor = TRI_CurrentSensor + 1
If TRI_CurrentSensor = 11 Then TRI_CurrentSensor = 1
LCAR.LCAR_SetElementText(TRI_ElementID, API.IIFIndex(TRI_CurrentSensor, Array As String("ALPHA", "RED", "GREEN", "BLUE", "LIGHTNESS", "AVERAGE", "LUMINOSITY", "HUE", "SATURATION", "VALUE", "RGB")), LCAR.LCAR_IGNORE)
Case 19,20:CameraAction(3,"INT/EXT")'INT/EXT
Case 23: CameraAction(2,"HOLLOW")
End Select
Case TRI_GEO_B'3d sensors
Select Case Region