@@ -4,12 +4,14 @@ red=Color.new(255,80,80)
4
4
yellow = Color .new (255 ,255 ,80 )
5
5
redformenu = Color .new (255 ,0 ,0 )
6
6
green = Color .new (80 ,255 ,80 )
7
+ gray = Color .new (80 ,80 ,80 )
7
8
white = Color .new (255 ,255 ,255 )
9
+ black = Color .new (0 ,0 ,0 )
8
10
WhiteShade = Color .new (255 ,255 ,255 ,100 )
9
11
blue = Color .new (80 ,80 ,255 )
10
12
Th ,Tm ,Ts = System .getTime ()
11
13
math.randomseed (Th * 3600 + Tm * 60 + Ts )
12
- img_font = Graphics . loadImage ( System . currentDirectory () .. " data/Font.png " )
14
+
13
15
glyph_l = {}
14
16
glyph_r = {}
15
17
glyph_w = {}
@@ -19,46 +21,48 @@ function g_init(char, l, r) --this saves to an array the left and right pixels,
19
21
glyph_w [char ] = r - l + 1
20
22
end
21
23
-- glyph_w = {} --precalculate this so it's faster on the text drawing system
22
- g_init (' 0' ,0 ,5 )
23
- g_init (' 1' ,6 ,9 )
24
- g_init (' 2' ,10 ,15 )
25
- g_init (' 3' ,16 ,21 )
26
- g_init (' 4' ,22 ,27 )
27
- g_init (' 5' ,28 ,33 )
28
- g_init (' 6' ,34 ,39 )
29
- g_init (' 7' ,40 ,45 )
30
- g_init (' 8' ,46 ,51 )
31
- g_init (' 9' ,52 ,57 )
32
- g_init (' A' ,58 ,63 )
33
- g_init (' B' ,64 ,69 )
34
- g_init (' C' ,70 ,75 )
35
- g_init (' D' ,76 ,81 )
36
- g_init (' E' ,82 ,87 )
37
- g_init (' F' ,88 ,93 )
38
- g_init (' G' ,94 ,99 )
39
- g_init (' H' ,100 ,105 )
40
- g_init (' I' ,106 ,109 )
41
- g_init (' J' ,110 ,115 )
42
- g_init (' K' ,116 ,121 )
43
- g_init (' L' ,122 ,127 )
44
- g_init (' M' ,128 ,133 )
45
- g_init (' N' ,134 ,139 )
46
- g_init (' O' ,140 ,145 )
47
- g_init (' P' ,146 ,151 )
48
- g_init (' Q' ,152 ,157 )
49
- g_init (' R' ,158 ,163 )
50
- g_init (' S' ,164 ,169 )
51
- g_init (' T' ,170 ,175 )
52
- g_init (' U' ,176 ,181 )
53
- g_init (' V' ,182 ,187 )
54
- g_init (' W' ,188 ,193 )
55
- g_init (' X' ,194 ,199 )
56
- g_init (' Y' ,200 ,205 )
57
- g_init (' Z' ,206 ,211 )
58
- g_init (' .' ,212 ,213 )
59
- g_init (' ' ,213 ,213 )
60
- g_init (' :' ,215 ,216 )
61
- g_init (' -' ,217 ,219 )
24
+ g_init (' 0' ,414 ,430 )
25
+ g_init (' 1' ,431 ,439 )
26
+ g_init (' 2' ,440 ,454 )
27
+ g_init (' 3' ,455 ,468 )
28
+ g_init (' 4' ,469 ,483 )
29
+ g_init (' 5' ,484 ,497 )
30
+ g_init (' 6' ,498 ,512 )
31
+ g_init (' 7' ,512 ,525 )
32
+ g_init (' 8' ,526 ,540 )
33
+ g_init (' 9' ,541 ,554 )
34
+ g_init (' A' ,1 ,19 )
35
+ g_init (' B' ,20 ,35 )
36
+ g_init (' C' ,36 ,52 )
37
+ g_init (' D' ,53 ,70 )
38
+ g_init (' E' ,71 ,84 )
39
+ g_init (' F' ,85 ,98 )
40
+ g_init (' G' ,99 ,116 )
41
+ g_init (' H' ,117 ,133 )
42
+ g_init (' I' ,134 ,139 )
43
+ g_init (' J' ,140 ,148 )
44
+ g_init (' K' ,149 ,164 )
45
+ g_init (' L' ,165 ,177 )
46
+ g_init (' M' ,178 ,196 )
47
+ g_init (' N' ,197 ,213 )
48
+ g_init (' O' ,214 ,232 )
49
+ g_init (' P' ,233 ,248 )
50
+ g_init (' Q' ,249 ,268 )
51
+ g_init (' R' ,269 ,284 )
52
+ g_init (' S' ,285 ,296 )
53
+ g_init (' T' ,297 ,310 )
54
+ g_init (' U' ,311 ,327 )
55
+ g_init (' V' ,328 ,344 )
56
+ g_init (' W' ,345 ,367 )
57
+ g_init (' X' ,368 ,383 )
58
+ g_init (' Y' ,384 ,399 )
59
+ g_init (' Z' ,400 ,413 )
60
+ g_init (' .' ,562 ,568 )
61
+ g_init (' ' ,580 ,581 )
62
+ g_init (' :' ,555 ,561 )
63
+ g_init (' -' ,569 ,580 )
64
+ g_init (' #' ,582 ,599 )
65
+
62
66
function gpu_drawtext (x , y , text , font_color )
63
67
local text_u = string.upper (text ) -- my font system is caps-only.
64
68
local i_str = 0 -- the current position in the string
@@ -71,14 +75,15 @@ function gpu_drawtext(x, y, text, font_color)
71
75
i_chr = string.sub (text_u , i_str , i_str )
72
76
cw = glyph_w [i_chr ]
73
77
if cw ~= nil then -- as long as the character exists
74
- Graphics .drawPartialImage (x + str_width , y , glyph_l [i_chr ], 0 , cw , 10 , img_font , font_color )
75
- str_width = str_width + cw + 1
78
+ Graphics .drawPartialImage (x + str_width , y , glyph_l [i_chr ], 0 , cw , 22 , img_font , font_color )
79
+ str_width = str_width + cw - 1
76
80
end
77
81
end
78
82
end
79
83
if System .currentDirectory () == " /" then
80
84
System .currentDirectory (" romfs:/" )
81
85
end
86
+ img_font = Graphics .loadImage (System .currentDirectory ().. " data/Font2.png" )
82
87
titlecreckeryop = Graphics .loadImage (System .currentDirectory ().. " data/titlecreckeryop.png" )
83
88
menutitle = Graphics .loadImage (System .currentDirectory ().. " data/menutitle.png" )
84
89
menugradient = Graphics .loadImage (System .currentDirectory ().. " data/menugradient.png" )
@@ -102,11 +107,13 @@ resetOFF = Graphics.loadImage(System.currentDirectory().."data/resetOFF.png")
102
107
resetNET = Graphics .loadImage (System .currentDirectory ().. " data/resetNET.png" )
103
108
AUTHORTEXT = Graphics .loadImage (System .currentDirectory ().. " data/AUTHOR.png" )
104
109
frameus = Graphics .loadImage (System .currentDirectory ().. " data/frameus.png" )
110
+ cookieshower = Graphics .loadImage (System .currentDirectory ().. " data/cookieShower1.png" )
111
+ cookieshowery = 0
105
112
backx = 0
106
113
backy = 0
107
114
rota = 255
108
115
rotanum = 0
109
- version = " 0.8 "
116
+ version = " 0.9 "
110
117
Sound .init ()
111
118
function loadmusic ()
112
119
bgm = Sound .openOgg (System .currentDirectory ().. " data/bgm.ogg" , false )
@@ -524,7 +531,6 @@ while true do
524
531
if BACK .y > 62 then
525
532
BACK .y = 62
526
533
end
527
- Graphics .drawImage (5 ,7 ,favicon )
528
534
if status == " BUY menu" then
529
535
if Controls .check (pad ,KEY_A ) and not Controls .check (oldpad ,KEY_A ) and STORE .stat == 0 and COOKIE .count >= CURSOR .price then
530
536
Graphics .drawImage (STORE .x , STORE .y + 33 * STORE .stat , pressed )
@@ -653,7 +659,6 @@ while true do
653
659
BANK .price = 1400000 * 1.15 ^ BANK .count
654
660
TEMPLE .price = 20000000 * 1.15 ^ TEMPLE .count
655
661
WIZARDTWR .price = 330000000 * 1.15 ^ WIZARDTWR .count
656
- Graphics .drawImage (254 , 221 , favicon )
657
662
if status == " SELL menu" then
658
663
Graphics .drawImage (250 , 86 , frameus )
659
664
end
@@ -666,92 +671,95 @@ while true do
666
671
667
672
end
668
673
if status == " BUY menu" then
669
- gpu_drawtext (255 , 47 ," BUY menu" , green )
674
+ gpu_drawtext (265 , 187 ," BUY" , white )
675
+ gpu_drawtext (332 , 187 ," SELL" , gray )
670
676
elseif status == " SELL menu" then
671
- gpu_drawtext (255 , 47 ," SELL menu" , blue )
677
+ gpu_drawtext (332 , 187 ," SELL" , white )
678
+ gpu_drawtext (265 , 187 ," BUY" , gray )
672
679
end
673
680
if STORE .stat == 0 then
674
- gpu_drawtext (379 , 55 , CURSOR .count , white )
681
+ gpu_drawtext (125 , 210 , " # " .. CURSOR .count , white )
675
682
if status == " BUY menu" then
676
683
Price = CURSOR .price
677
684
elseif status == " SELL menu" then
678
685
Price = CURSOR .sellprice
679
686
end
680
687
end
681
688
if STORE .stat == 1 then
682
- gpu_drawtext (379 , 55 , GRANDMA .count , white )
689
+ gpu_drawtext (125 , 210 , " # " .. GRANDMA .count , white )
683
690
if status == " BUY menu" then
684
691
Price = GRANDMA .price
685
692
elseif status == " SELL menu" then
686
693
Price = GRANDMA .sellprice
687
694
end
688
695
end
689
696
if STORE .stat == 2 then
690
- gpu_drawtext (379 , 55 , FARM .count , white )
697
+ gpu_drawtext (125 , 210 , " # " .. FARM .count , white )
691
698
if status == " BUY menu" then
692
699
Price = FARM .price
693
700
elseif status == " SELL menu" then
694
701
Price = FARM .sellprice
695
702
end
696
703
end
697
704
if STORE .stat == 3 then
698
- gpu_drawtext (379 , 55 , MINE .count , white )
705
+ gpu_drawtext (125 , 210 , " # " .. MINE .count , white )
699
706
if status == " BUY menu" then
700
707
Price = MINE .price
701
708
elseif status == " SELL menu" then
702
709
Price = MINE .sellprice
703
710
end
704
711
end
705
712
if STORE .stat == 4 then
706
- gpu_drawtext (379 , 55 , FACTORY .count , white )
713
+ gpu_drawtext (125 , 210 , " # " .. FACTORY .count , white )
707
714
if status == " BUY menu" then
708
715
Price = FACTORY .price
709
716
elseif status == " SELL menu" then
710
717
Price = FACTORY .sellprice
711
718
end
712
719
end
713
720
if STORE .stat == 5 then
714
- gpu_drawtext (379 , 55 , BANK .count , white )
721
+ gpu_drawtext (125 , 210 , " # " .. BANK .count , white )
715
722
if status == " BUY menu" then
716
723
Price = BANK .price
717
724
elseif status == " SELL menu" then
718
725
Price = BANK .sellprice
719
726
end
720
727
end
721
728
if STORE .stat == 6 then
722
- gpu_drawtext (379 , 55 , TEMPLE .count , white )
729
+ gpu_drawtext (125 , 210 , " # " .. TEMPLE .count , white )
723
730
if status == " BUY menu" then
724
731
Price = TEMPLE .price
725
732
elseif status == " SELL menu" then
726
733
Price = TEMPLE .sellprice
727
734
end
728
735
end
729
736
if STORE .stat == 7 then
730
- gpu_drawtext (379 , 55 , WIZARDTWR .count ,white )
737
+ gpu_drawtext (125 , 210 , " # " .. WIZARDTWR .count ,white )
731
738
if status == " BUY menu" then
732
739
Price = WIZARDTWR .price
733
740
elseif status == " SELL menu" then
734
741
Price = WIZARDTWR .sellprice
735
742
end
736
743
end
737
- gpu_drawtext (253 , 61 ," press SELECT " , white )
744
+ -- gpu_drawtext(253, 61," press SELECT ", white)
738
745
if status == " BUY menu" then
739
746
if Price > COOKIE .count then
740
- gpu_drawtext (273 , 226 ,math.floor (Price ), red )
747
+ gpu_drawtext (254 , 220 ,math.floor (Price ), red )
741
748
else
742
- gpu_drawtext (273 , 226 ,math.floor (Price ), green )
749
+ gpu_drawtext (254 , 220 ,math.floor (Price ), green )
743
750
end
744
751
end
745
752
if status == " SELL menu" then
746
- gpu_drawtext (273 , 226 ,math.floor (Price ),blue )
753
+ gpu_drawtext (254 , 220 ,math.floor (Price ),blue )
747
754
end
748
- gpu_drawtext (25 , 10 ,(math.floor (COOKIE .count )).. " Cookies" , white )
755
+ gpu_drawtext (5 , 5 ,(math.floor (COOKIE .count )).. " Cookies" , white )
749
756
gpu_drawtext (5 , 30 ," per second : " .. CpS , white )
750
757
if string.len (Tm )== 2 then
751
- gpu_drawtext (5 , 210 ,Th .. " : " .. Tm , blue )
758
+ gpu_drawtext (5 , 204 ,Th .. " : " .. Tm , blue )
752
759
else
753
- gpu_drawtext (5 , 210 ,Th .. " : 0" .. Tm , blue )
760
+ gpu_drawtext (5 , 204 ,Th .. " : 0" .. Tm , blue )
754
761
end
762
+ gpu_drawtext (290 , 5 ," STORE" ,white )
755
763
screenshotmake ()
756
764
Graphics .termBlend ()
757
765
Graphics .initBlend (BOTTOM_SCREEN )
@@ -838,12 +846,17 @@ while true do
838
846
end
839
847
elseif state == " MENU" then
840
848
Graphics .initBlend (TOP_SCREEN )
849
+ cookieshowery = cookieshowery + 2
841
850
Graphics .drawImage (backx , backy , BackgroundTop1 )
851
+ Graphics .drawImage (0 , cookieshowery - 512 , cookieshower )
852
+ Graphics .drawImage (0 , cookieshowery , cookieshower )
853
+ if cookieshowery > 512 then cookieshowery = 0 end
842
854
Graphics .drawImage (0 , 0 , menugradient )
843
855
Graphics .drawImage (0 , 0 , menutitle )
856
+ gpu_drawtext (300 ,220 ," pre: " .. version ,white ,TOP_SCREEN )
844
857
screenshotmake ()
845
858
Graphics .termBlend ()
846
- Screen . debugPrint ( 300 , 220 , " pre: " .. version , white , TOP_SCREEN )
859
+
847
860
Graphics .initBlend (BOTTOM_SCREEN )
848
861
Graphics .drawImage (backx , backy , BackgroundTop1 )
849
862
@@ -881,12 +894,16 @@ while true do
881
894
end
882
895
elseif state == " OPTIONS" then
883
896
Graphics .initBlend (TOP_SCREEN )
897
+ cookieshowery = cookieshowery + 2
884
898
Graphics .drawImage (backx , backy , BackgroundTop1 )
899
+ Graphics .drawImage (0 , cookieshowery - 512 , cookieshower )
900
+ Graphics .drawImage (0 , cookieshowery , cookieshower )
901
+ if cookieshowery > 512 then cookieshowery = 0 end
885
902
Graphics .drawImage (0 , 0 , menugradient )
886
903
Graphics .drawImage (0 , 0 , menutitle )
904
+ gpu_drawtext (300 ,220 ," pre: " .. version ,white ,TOP_SCREEN )
887
905
screenshotmake ()
888
906
Graphics .termBlend ()
889
- Screen .debugPrint (300 ,220 ," pre: " .. version ,white ,TOP_SCREEN )
890
907
Graphics .initBlend (BOTTOM_SCREEN )
891
908
Graphics .drawImage (backx , backy , BackgroundTop1 )
892
909
if System .doesFileExist (" /ccsave.sav" ) then
0 commit comments