I made this little GUI menu yesterday after playing one of my PC games and noticing that I had the option of a sword cursor. I thought to myself, "Why don't I do this in BASIC," and got to work. It renders rather quickly on my 84+, and works perfectly. Here is a screenshot:



Here is the code:
BASIC Code wrote:
:{8,4,7,5,6,5,7,6,5,4,8,5,4,3,4,3,2,3,2,1,2,1,0,1,0→L1
:L1+40→L1
:{0,0,1,1,2,2,3,3,3,3,4,4,4,4,5,5,5,6,6,6,7,7,7,8,8→L2
:L2+24→L2
:0→Xmin
:0→Ymin
:94→Xmax
:62→YMax
:PlotsOff
:AxesOff
:FnOff
:ClrDraw
:Text(0,6,"PLEASE SELECT AN OPTION
:Horizontal 56
:Text(21,10,"NEW GAME
:Text(21,55,"CONTINUE
:Text(41,10,"ABOUT
:Text(41,55,"QUIT
:Line(8,14,30,14
:Line(9,13,31,13
:Line(31,13,31,21
:Line(8,14,8,22
:Line(8,22,30,22
:Line(30,14,30,22
:Line(53,14,72,14
:Line(54,13,73,13
:Line(73,13,73,21
:Line(53,14,53,22
:Line(53,22,72,22
:Line(72,22,72,14
:Line(8,34,8,42
:Line(9,33,40,33
:Line(40,33,40,41
:Line(39,34,39,42
:Line(8,34,39,34
:Line(8,42,39,42
:Line(87,34,87,42
:Line(88,33,54,33
:Line(88,33,88,41
:Line(53,34,53,42
:Line(53,34,87,34
:Line(53,42,87,42
:StorePic 1
:DelVar KRepeat (K=45) or ((K=21) and ((L1(1)≥61 and L1(1)≤79) and (L2(1)≥6 and L2(1)≤14)))
:Plot1(Scatter ,L1,L2,∙
:RecallPic 1
:Repeat (K=24)(L1(1)≠8) or (K=25)(L2(1)≠48) or (K=26)(L1(1)≠96) or (K=34)(L2(1)≠0) or K=45 or K=21
:getKey→K
:End
:L1-8((K=24)-(K=26→L1
:L2-8((K=34)-(K=25→L2
:If K=21
:Then
:If (L1(1)≥16 and L1(1)≤47) and (L2(1)≥26 and L2(1)≤34)
:Then
:ClrHome
:Disp "YOU CHOSE
:Pause "NEW GAME
:ClrHome
:End
:If (L1(1)≥61 and L1(1)≤95) and (L2(1)≥26 and L2(1)≤34)
:Then
:ClrHome
:Disp "YOU CHOSE
:Pause "CONTINUE
:ClrHome
:End
:If (L1(1)≥16 and L1(1)≤38) and (L2(1)≥6 and L2(1)≤14)
:Then
:ClrHome
:Disp "CREATED BY
:Disp "ROBERTO SANCHEZ
:Pause "SANCHEZ@STIS.NET
:ClrHome
:End
:End
:End
:PlotsOff
:ClrDraw
:Clear Entries
:0
:DelVar L1DelVar L2DelVar KDelVar Pic1Output(1,1,"
Generated by SourceCoder, © 2005 Cemetech

NOTE: For some reason, the loop-end count said I had a while loop in there, and SC still doesn't add the { to lists. Also, other ASCII characters, like @, aren't noticed by SC.
Nice job, that looks really neat. Why do you bother putting that zero in the last line? That would only update Ans to 0, which will not free you up any space seeing as how 9E99 and 0E1 are both 9 byte floating point numbers.
I thought I would need it. See my thread BASIC Program Memory Loss. If I don't really need it, then I'll remove it.
I don't think you need to have it. Ans will remain intact no matter what. You do need to clear entries though, as you have done. I did read the topic, just so you know Wink
something1990 wrote:
I thought I would need it. See my thread BASIC Program Memory Loss. If I don't really need it, then I'll remove it.
Clearing entries might be a hair rude for a program to do, if you know what I mean. Smile
I updated the program and used a mouse pointer instead of a sword. I've also made a few other small changes.



BASIC Code wrote:
:{7,6,7,5,6,4,0,5,3,1,0,4,2,0,3,0,4,0,5,4,3,2,1,0→L1
:L1+40→L1
:(0,0,1,1,2,2,2,3,3,3,3,4,4,4,5,5,6,6,7,7,7,7,7,7→L2
:L2+24→L2
:0→Xmin
:0→Ymin
:94→Xmax
:62→YMax
:PlotsOff
:AxesOff
:FnOff
:ClrDraw
:Text(0,6,"PLEASE SELECT AN OPTION
:Horizontal(56
:Text(21,10,"NEW GAME
:Text(21,54,"CONTINUE
:Text(45,10,"ABOUT
:Text(45,54,"QUIT
:Line(8,10,30,10
:Line(9,9,31,9
:Line(30,10,30,18
:Line(8,10,8,18
:Line(8,18,30,18
:Line(31,17,31,9
:Line(52,10,70,10
:Line(53,9,71,9
:Line(71,9,71,17
:Line(52,10,52,17
:Line(52,18,70,18
:Line(70,18,70,10
:Line(8,34,8,42
:Line(9,33,40,33
:Line(40,33,40,41
:Line(39,34,39,42
:Line(8,34,39,34
:Line(8,42,39,42
:Line(86,34,86,42
:Line(87,33,53,33
:Line(87,33,87,41
:Line(52,34,52,42
:Line(52,34,86,34
:Line(52,42,86,42
:StorePic 1
:DelVar KRepeat (K=45) or ((sum(K={21,105})) and ((L1(1)≥61 and L1(1)≤79) and (L2(1)≥6 and L2(1)≤14)))
:Plot1Scatter ,L1,L2,∙
:RecallPic 1
:Repeat (K=24)(L1(1)≠7) or (K=25)(L2(1)≠48) or (K=26)(L1(1)≠95) or (K=34)(L2(1)≠0) or (sum(K={45,21,105}))
:getKey→K
:End
:L1-8((K=24)-(K=26→L1
:L2-8((K=34)-(K=25→L2
:If sum(K={21,105
:Then
:If (L1(1)≥16 and L1(1)≤46) and (L2(1)≥26 and L2(1)≤34)
:Then
:ClrHome
:Disp "YOU CHOSE
:Pause "NEW GAME
:ClrHome
:End
:If (L1(1)≥61 and L1(1)≤94) and (L2(1)≥26 and L2(1)≤34)
:Then
:ClrHome
:Disp "YOU CHOSE
:Pause "CONTINUE
:ClrHome
:End
:If (L1(1)≥16 and L1(1)≤38) and (L2(1)≥6 and L2(1)≤14)
:Then
:ClrHome
:Disp "CREATED BY
:Disp "ROBERTO SANCHEZ
:Pause "SANCHEZ@STIS.NET
:ClrHome
:End
:End
:End
:PlotsOff
:ClrDraw
:0
:DelVar L1DelVar L2DelVar KDelVar Pic1Output(1,1,"
Generated by SourceCoder, © 2005 Cemetech

Anyone who has a chance to try this out on an 83+, is it quick on that calc?
Looks impressive!
I see very few optimizations that could be made. Congrats, you're really doing well! Perhaps you might consider applying to the 1337 as an apprentice?
Wasn't I already an apprentice?
something1990 wrote:
Wasn't I already an apprentice?
Ah, indeed. How about going for full 1337ness then?
Alright. I have to apply again for full 1337ness right?
something1990 wrote:
Alright. I have to apply again for full 1337ness right?
Aye, just submit an example of why you should be 1337, and we'll get right on it.
Chipmaster wrote:
Nice job, that looks really neat. Why do you bother putting that zero in the last line? That would only update Ans to 0, which will not free you up any space seeing as how 9E99 and 0E1 are both 9 byte floating point numbers.


it will free up space is ans is a list, string, complex number, etc... Wink
Kllrnohj wrote:
Chipmaster wrote:
Nice job, that looks really neat. Why do you bother putting that zero in the last line? That would only update Ans to 0, which will not free you up any space seeing as how 9E99 and 0E1 are both 9 byte floating point numbers.


it will free up space is ans is a list, string, complex number, etc... Wink
...and looking at his code, L2 would indeed be the ans.
You could slightly optimize the beginning:

40+{8,4,7,5,6,5,7,6,5,4,8,5,4,3,4,3,2,3,2,1,2,1,0,1,0 ->L1

And similarly for L2.
Ah, indeed. I usually do that with lists to eliminate the closing paren or bracket.
I did that and many more optimizations since this has been released. That 83 Optimization guide that was featured at ticalc.org had excellent stuff on lists. Idea I just got another idea to shrink the size down further. Instead of doing Line( I could just make each box a stat sprite. All I would have to do is load the data into lists and reuse that data each time I want to draw. I'll try it out and see if it really does shrink the size of the program.
Superly. Are you going to release this at any point, do you think?
It's been released on ticalc.org. I'll make those modifications and see if they save size. I'll also make some other minor modifications that I think will improve speed and then update the ticalc.org release. EDIT: I just figured out why my idead won't save space. The program is designed so that users can change the size of the boxes to match the length of the text they wish to input. If I do it with stat sprites, the boxes might have to be done over again each time the menu is implemented. Plus, not all the boxes on the screen are the same size. The only remedy for this is to allow for four, and only four, standard options (start, about, save, quit) and have all boxes be the size of the largest box.
k, cool. I didn't realize that you had ever actually released the program at ticalc.org. Speaking of which, I haven't checked my stats in a few days...
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement