Skip to content

Commit 9edc8e0

Browse files
committed
0.9 some Improvements
1 parent da38c4c commit 9edc8e0

File tree

8 files changed

+82
-65
lines changed

8 files changed

+82
-65
lines changed

data/Font.png

0 Bytes
Loading

data/Font2.png

13.7 KB
Loading

data/backOFF.pdn

4.36 KB
Binary file not shown.

data/backOFF.png

-923 Bytes
Loading

data/backON.png

-921 Bytes
Loading

data/cookieShower1.png

50.1 KB
Loading

data/storehead.png

46.1 KB
Loading

index.lua

+82-65
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ red=Color.new(255,80,80)
44
yellow=Color.new(255,255,80)
55
redformenu=Color.new(255,0,0)
66
green=Color.new(80,255,80)
7+
gray=Color.new(80,80,80)
78
white=Color.new(255,255,255)
9+
black=Color.new(0,0,0)
810
WhiteShade=Color.new(255,255,255,100)
911
blue=Color.new(80,80,255)
1012
Th,Tm,Ts = System.getTime()
1113
math.randomseed(Th*3600+Tm*60+Ts)
12-
img_font = Graphics.loadImage(System.currentDirectory().."data/Font.png")
14+
1315
glyph_l = {}
1416
glyph_r = {}
1517
glyph_w = {}
@@ -19,46 +21,48 @@ function g_init(char, l, r) --this saves to an array the left and right pixels,
1921
glyph_w[char] = r-l+1
2022
end
2123
--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+
6266
function gpu_drawtext(x, y, text, font_color)
6367
local text_u = string.upper(text) --my font system is caps-only.
6468
local i_str=0 --the current position in the string
@@ -71,14 +75,15 @@ function gpu_drawtext(x, y, text, font_color)
7175
i_chr = string.sub(text_u, i_str, i_str)
7276
cw = glyph_w[i_chr]
7377
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
7680
end
7781
end
7882
end
7983
if System.currentDirectory() == "/" then
8084
System.currentDirectory("romfs:/")
8185
end
86+
img_font = Graphics.loadImage(System.currentDirectory().."data/Font2.png")
8287
titlecreckeryop= Graphics.loadImage(System.currentDirectory().."data/titlecreckeryop.png")
8388
menutitle= Graphics.loadImage(System.currentDirectory().."data/menutitle.png")
8489
menugradient= Graphics.loadImage(System.currentDirectory().."data/menugradient.png")
@@ -102,11 +107,13 @@ resetOFF = Graphics.loadImage(System.currentDirectory().."data/resetOFF.png")
102107
resetNET = Graphics.loadImage(System.currentDirectory().."data/resetNET.png")
103108
AUTHORTEXT = Graphics.loadImage(System.currentDirectory().."data/AUTHOR.png")
104109
frameus = Graphics.loadImage(System.currentDirectory().."data/frameus.png")
110+
cookieshower = Graphics.loadImage(System.currentDirectory().."data/cookieShower1.png")
111+
cookieshowery = 0
105112
backx=0
106113
backy=0
107114
rota=255
108115
rotanum = 0
109-
version="0.8"
116+
version="0.9"
110117
Sound.init()
111118
function loadmusic()
112119
bgm = Sound.openOgg(System.currentDirectory().."data/bgm.ogg", false)
@@ -524,7 +531,6 @@ while true do
524531
if BACK.y>62 then
525532
BACK.y=62
526533
end
527-
Graphics.drawImage(5,7,favicon)
528534
if status=="BUY menu" then
529535
if Controls.check(pad,KEY_A) and not Controls.check(oldpad,KEY_A) and STORE.stat==0 and COOKIE.count >= CURSOR.price then
530536
Graphics.drawImage(STORE.x, STORE.y+33*STORE.stat, pressed)
@@ -653,7 +659,6 @@ while true do
653659
BANK.price=1400000*1.15^BANK.count
654660
TEMPLE.price=20000000*1.15^TEMPLE.count
655661
WIZARDTWR.price=330000000*1.15^WIZARDTWR.count
656-
Graphics.drawImage(254, 221, favicon)
657662
if status=="SELL menu" then
658663
Graphics.drawImage(250, 86, frameus)
659664
end
@@ -666,92 +671,95 @@ while true do
666671

667672
end
668673
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)
670676
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)
672679
end
673680
if STORE.stat==0 then
674-
gpu_drawtext(379, 55,CURSOR.count, white)
681+
gpu_drawtext(125,210,"# "..CURSOR.count, white)
675682
if status=="BUY menu" then
676683
Price = CURSOR.price
677684
elseif status=="SELL menu" then
678685
Price = CURSOR.sellprice
679686
end
680687
end
681688
if STORE.stat==1 then
682-
gpu_drawtext(379, 55,GRANDMA.count, white)
689+
gpu_drawtext(125,210,"# "..GRANDMA.count, white)
683690
if status=="BUY menu" then
684691
Price = GRANDMA.price
685692
elseif status=="SELL menu" then
686693
Price = GRANDMA.sellprice
687694
end
688695
end
689696
if STORE.stat==2 then
690-
gpu_drawtext(379, 55,FARM.count, white)
697+
gpu_drawtext(125,210,"# "..FARM.count, white)
691698
if status=="BUY menu" then
692699
Price = FARM.price
693700
elseif status=="SELL menu" then
694701
Price = FARM.sellprice
695702
end
696703
end
697704
if STORE.stat==3 then
698-
gpu_drawtext(379, 55,MINE.count, white)
705+
gpu_drawtext(125,210,"# "..MINE.count, white)
699706
if status=="BUY menu" then
700707
Price = MINE.price
701708
elseif status=="SELL menu" then
702709
Price = MINE.sellprice
703710
end
704711
end
705712
if STORE.stat==4 then
706-
gpu_drawtext(379, 55,FACTORY.count, white)
713+
gpu_drawtext(125,210,"# "..FACTORY.count, white)
707714
if status=="BUY menu" then
708715
Price = FACTORY.price
709716
elseif status=="SELL menu" then
710717
Price = FACTORY.sellprice
711718
end
712719
end
713720
if STORE.stat==5 then
714-
gpu_drawtext(379, 55,BANK.count, white)
721+
gpu_drawtext(125,210,"# "..BANK.count, white)
715722
if status=="BUY menu" then
716723
Price = BANK.price
717724
elseif status=="SELL menu" then
718725
Price = BANK.sellprice
719726
end
720727
end
721728
if STORE.stat==6 then
722-
gpu_drawtext(379, 55,TEMPLE.count, white)
729+
gpu_drawtext(125,210,"# "..TEMPLE.count, white)
723730
if status=="BUY menu" then
724731
Price = TEMPLE.price
725732
elseif status=="SELL menu" then
726733
Price = TEMPLE.sellprice
727734
end
728735
end
729736
if STORE.stat==7 then
730-
gpu_drawtext(379, 55,WIZARDTWR.count,white)
737+
gpu_drawtext(125,210,"# "..WIZARDTWR.count,white)
731738
if status=="BUY menu" then
732739
Price = WIZARDTWR.price
733740
elseif status=="SELL menu" then
734741
Price = WIZARDTWR.sellprice
735742
end
736743
end
737-
gpu_drawtext(253, 61," press SELECT ", white)
744+
--gpu_drawtext(253, 61," press SELECT ", white)
738745
if status=="BUY menu" then
739746
if Price>COOKIE.count then
740-
gpu_drawtext(273, 226,math.floor(Price), red)
747+
gpu_drawtext(254, 220,math.floor(Price), red)
741748
else
742-
gpu_drawtext(273, 226,math.floor(Price), green)
749+
gpu_drawtext(254, 220,math.floor(Price), green)
743750
end
744751
end
745752
if status=="SELL menu" then
746-
gpu_drawtext(273, 226,math.floor(Price),blue)
753+
gpu_drawtext(254, 220,math.floor(Price),blue)
747754
end
748-
gpu_drawtext(25, 10,(math.floor(COOKIE.count)).." Cookies", white)
755+
gpu_drawtext(5, 5,(math.floor(COOKIE.count)).." Cookies", white)
749756
gpu_drawtext(5, 30,"per second : "..CpS, white)
750757
if string.len(Tm)==2 then
751-
gpu_drawtext(5, 210,Th..": "..Tm, blue)
758+
gpu_drawtext(5, 204,Th..": "..Tm, blue)
752759
else
753-
gpu_drawtext(5, 210,Th..": 0"..Tm, blue)
760+
gpu_drawtext(5, 204,Th..": 0"..Tm, blue)
754761
end
762+
gpu_drawtext(290, 5,"STORE",white)
755763
screenshotmake()
756764
Graphics.termBlend()
757765
Graphics.initBlend(BOTTOM_SCREEN)
@@ -838,12 +846,17 @@ while true do
838846
end
839847
elseif state=="MENU" then
840848
Graphics.initBlend(TOP_SCREEN)
849+
cookieshowery=cookieshowery+2
841850
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
842854
Graphics.drawImage(0, 0, menugradient)
843855
Graphics.drawImage(0, 0, menutitle)
856+
gpu_drawtext(300,220,"pre: "..version,white,TOP_SCREEN)
844857
screenshotmake()
845858
Graphics.termBlend()
846-
Screen.debugPrint(300,220,"pre: "..version,white,TOP_SCREEN)
859+
847860
Graphics.initBlend(BOTTOM_SCREEN)
848861
Graphics.drawImage(backx, backy, BackgroundTop1)
849862

@@ -881,12 +894,16 @@ while true do
881894
end
882895
elseif state=="OPTIONS" then
883896
Graphics.initBlend(TOP_SCREEN)
897+
cookieshowery=cookieshowery+2
884898
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
885902
Graphics.drawImage(0, 0, menugradient)
886903
Graphics.drawImage(0, 0, menutitle)
904+
gpu_drawtext(300,220,"pre: "..version,white,TOP_SCREEN)
887905
screenshotmake()
888906
Graphics.termBlend()
889-
Screen.debugPrint(300,220,"pre: "..version,white,TOP_SCREEN)
890907
Graphics.initBlend(BOTTOM_SCREEN)
891908
Graphics.drawImage(backx, backy, BackgroundTop1)
892909
if System.doesFileExist("/ccsave.sav") then

0 commit comments

Comments
 (0)