* WalrusIRC

You need to have 5 posts and not be part of restricted usergroups in order to use the WalrusIRC embedded shoutbox. However, you can also access our IRC channel called #CodeWalrus via EFnet.

Author Topic: Simple Axe Menu  (Read 3966 times)

0 Members and 1 Guest are viewing this topic.

Offline CKH4

  • Extravagant Sushi
  • Super User
  • Join Date: Jan 2015
  • Location:
  • Posts: 872
  • Post Rating Ratio: +3/-2
  • Gender: Male
Simple Axe Menu
« on: January 14, 2015, 04:56:35 am »
Here is some simple code that may help new Axe programmers learn the basics of a menu or even allow basic programmers to get into Axe Parser.

Screenshot:


Features:
  • Easy to change
  • Readable Code
  • Use custom select images

Code:
Code: [Select]
.MENU

ClrDraw

[0103030303030100]->Pic1
[80C0C0C0C0C08000]

7->X
4->Y->W

Fix 5

Text(X+5,Y,"PLAY
Text(X+1,Y+8,"SCORES
Text(X+5,Y+16,"HELP
Text(X+5,Y+24,"QUIT

RectI(X,Y,25,7

Pt-Change(X-9,Y,Pic1
Pt-Change(X+26,Y,Pic1+8

DispGraph

Repeat getKey(15)

If Y!=(W+24)
If getKey(1)

Y+8->theta

RectI(X,Y,25,7
Pt-Change(X-9,Y,Pic1
Pt-Change(X+26,Y,Pic1+8

Repeat Y=theta
RectI(X,Y,25,7
Pt-Change(X-9,Y,Pic1
Pt-Change(X+26,Y,Pic1+8
DispGraph
RectI(X,Y,25,7
Pt-Change(X-9,Y,Pic1
Pt-Change(X+26,Y,Pic1+8
Y++
End
RectI(X,Y,25,7
Pt-Change(X-9,Y,Pic1
Pt-Change(X+26,Y,Pic1+8
DispGraph
End
End

If Y!=W
If getKey(4)

Y-8->theta

RectI(X,Y,25,7
Pt-Change(X-9,Y,Pic1
Pt-Change(X+26,Y,Pic1+8

Repeat Y=theta
RectI(X,Y,25,7
Pt-Change(X-9,Y,Pic1
Pt-Change(X+26,Y,Pic1+8
DispGraph
RectI(X,Y,25,7
Pt-Change(X-9,Y,Pic1
Pt-Change(X+26,Y,Pic1+8
Y--
End
RectI(X,Y,25,7
Pt-Change(X-9,Y,Pic1
Pt-Change(X+26,Y,Pic1+8
DispGraph
End
End

Pause 10

End

Fix 4

If you want any help or have any questions I'll attempt to help you out. I will update this until I consider it complete.


  • Calculators owned: TI-83+, TI-84+


Online xlibman

  • Omni founder & CW co-founder
  • Super User
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18735
  • Post Rating Ratio: +95/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • DJ Omnimaga music store
  • Gender: Male
Re: Simple Axe Menu
« Reply #1 on: January 14, 2015, 07:16:03 am »
I am unsure if there was another tutorial available before on Omni for such menu, although I think you should make yours so that the code is commented, to explain what each part do. Also nice menu by the way. It reminds me my xLIB xLIB Revolution menu :P
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline Duke "Tape" Eiyeron

  • Urist McEiyolobster
  • Super User
  • Join Date: Nov 2014
  • Location: (V)(-_(//));(V)
  • Posts: 1636
  • Post Rating Ratio: +11/-2
  • Fanciest Walrus of the oceans.
    • @@Eiyeron
    • Eiyeron
    • /u/Eiyeron
    • Eiyeron
    • Rétro-Actif : Rétro/Prog/Blog
  • Gender: Male
Re: Simple Axe Menu
« Reply #2 on: January 14, 2015, 07:31:32 am »
Hey, it looks a lot like the mockup I did just before starting HBE on Axe!



And that's the same idea I had (a counter to move the bar). I was sure that was not too ugly. Thanks for make me sure of this choice.
  • Calculators owned: A lot.

Offline CKH4

  • Extravagant Sushi
  • Super User
  • Join Date: Jan 2015
  • Location:
  • Posts: 872
  • Post Rating Ratio: +3/-2
  • Gender: Male
Re: Simple Axe Menu
« Reply #3 on: January 14, 2015, 02:57:53 pm »
I am unsure if there was another tutorial available before on Omni for such menu, although I think you should make yours so that the code is commented, to explain what each part do. Also nice menu by the way. It reminds me my xLIB xLIB Revolution menu :P
Commenting the code is next on my to-do, then sending each button to the right Lbl. Maybe I'll do the labels with expressions.

Hey, it looks a lot like the mockup I did just before starting HBE on Axe!



And that's the same idea I had (a counter to move the bar). I was sure that was not too ugly. Thanks for make me sure of this choice.
Nice menu, how did you draw the menu items pictures? I chose to use the inverted one so that I could use just one buffer without redrawing the text.

Edit.
I had originally used for loops but they don't want to go backwards.
« Last Edit: January 14, 2015, 03:24:30 pm by CKH4 »
  • Calculators owned: TI-83+, TI-84+


Offline alberthrocks

  • New User
  • Join Date: Jan 2015
  • Location:
  • Posts: 16
  • Post Rating Ratio: +1/-0
Re: Simple Axe Menu
« Reply #4 on: January 14, 2015, 04:17:00 pm »
I thought I'd share something that I wrote a while ago, with Runer112.

Original post can be found here, post content follows:



One of the concepts I've been working on for Axe GUI Library is this other side of it. I wanted to try something new - offering GUI functions that integrate seemlessly inside the program. Or, if the developer happened to want more control, give them access to some drawing functions, and let the developer handle all the other code. This portion of Axe GUI Library is geared to game developers, but also to any developers wanting a GUI without the full blown GUI. (Mouseless is one aspect.)

That said, no worries - I'm still interested in the regular, window/mouse based Axe GUI Library! :) I'm just adding another side of it to cater to other developers as well.

So what do I have for today? I have the "advanced drawing routine" done and implemented for... MENUS! :D
This routine provides the drawing, all you need to do is provide the input! :)
I've attached BOTH the source and the compiled Axe binary for your convenience.
I strongly suggest opening the source 8Xp inside a PC source editor of some kind. It's very, very, long.
The routine of interest is MNU (line "Lbl MNU" all the way to "Return", as well as routines that are used in routine MNU).
Don't get the code? Thank Runer112 for that extreme optimization that made this routine possible! :D (The original one was very, very slow)

prgmAGMENUD is the binary, which is a significant menu demo program.
prgmAGMENUDS is the source of that program.

This routine can possibly be implemented into actual menus in the regular GUI! (Not sure if actual menubars->menus would work on a calc, but click-button-to-show-menu would work.) Of course, this routine needs more work, esp. to support no animation.

Enjoy! :D

Thanks Darl181 for the GIF recording! :D


Online xlibman

  • Omni founder & CW co-founder
  • Super User
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18735
  • Post Rating Ratio: +95/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • DJ Omnimaga music store
  • Gender: Male
Re: Simple Axe Menu
« Reply #5 on: January 14, 2015, 04:32:09 pm »
Ooh that looks nice as well. I like the double column layout actually :D
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline CKH4

  • Extravagant Sushi
  • Super User
  • Join Date: Jan 2015
  • Location:
  • Posts: 872
  • Post Rating Ratio: +3/-2
  • Gender: Male
Re: Simple Axe Menu
« Reply #6 on: January 14, 2015, 04:41:56 pm »
Oh, this is very cool. I'll try it later.
  • Calculators owned: TI-83+, TI-84+


Offline Duke "Tape" Eiyeron

  • Urist McEiyolobster
  • Super User
  • Join Date: Nov 2014
  • Location: (V)(-_(//));(V)
  • Posts: 1636
  • Post Rating Ratio: +11/-2
  • Fanciest Walrus of the oceans.
    • @@Eiyeron
    • Eiyeron
    • /u/Eiyeron
    • Eiyeron
    • Rétro-Actif : Rétro/Prog/Blog
  • Gender: Male
Re: Simple Axe Menu
« Reply #7 on: January 14, 2015, 05:52:26 pm »
I am unsure if there was another tutorial available before on Omni for such menu, although I think you should make yours so that the code is commented, to explain what each part do. Also nice menu by the way. It reminds me my xLIB xLIB Revolution menu :P
Commenting the code is next on my to-do, then sending each button to the right Lbl. Maybe I'll do the labels with expressions.

Hey, it looks a lot like the mockup I did just before starting HBE on Axe!



And that's the same idea I had (a counter to move the bar). I was sure that was not too ugly. Thanks for make me sure of this choice.
Nice menu, how did you draw the menu items pictures? I chose to use the inverted one so that I could use just one buffer without redrawing the text.

Edit.
I had originally used for loops but they don't want to go backwards.

I used a custom routine which scales sprites by drawing Rects.
  • Calculators owned: A lot.

Offline CKH4

  • Extravagant Sushi
  • Super User
  • Join Date: Jan 2015
  • Location:
  • Posts: 872
  • Post Rating Ratio: +3/-2
  • Gender: Male
Re: Simple Axe Menu
« Reply #8 on: January 14, 2015, 06:49:06 pm »
Ok cool, it's pretty cool.
  • Calculators owned: TI-83+, TI-84+


Offline Hayleia

  • Full User
  • Join Date: Nov 2014
  • Location:
  • Posts: 324
  • Post Rating Ratio: +12/-0
Re: Simple Axe Menu
« Reply #9 on: January 17, 2015, 07:29:46 am »
Your code isn't really what I'd call "readable", and I can tell that just at your third line. Yeah, the one with "Pic1". Because that doesn't tell me what's in the sprite. You could have used "→°LolSprite" (but with a descriptive name of course) instead.

I also think I see a lot of repetitions in your code, where you could at least have used a subroutine.

And last but not least, "easily changeable" applies to codes that either are really readable or don't contain any data. And this doesn't apply to yours, it has Text data, it knows the number of "buttons", etc, so when you'll want to change it, you'll have to read it all and not forget anything to change.

Here's what I use in Smash for example. OK, the code isn't exactly what I'd call readable :P
But the rest is readable, all labels and pointers have suggestive names. And it is easily changeable since there is no data in the menu code, all you have to do is change the data, add an entry or remove one, etc.
Don't use it, it lacks something you need to make it run. If you try it this way on your calc, it will most likely crash, except if you are lucky. But you can check in Smash's source code, that's really what I use (well, that's an old version thta changes a bit compared to the latest version but it will most likely be back in a new version).

Screenshot and code (in spoiler to save space):

(click to show/hide)

Online xlibman

  • Omni founder & CW co-founder
  • Super User
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18735
  • Post Rating Ratio: +95/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • DJ Omnimaga music store
  • Gender: Male
Re: Simple Axe Menu
« Reply #10 on: January 17, 2015, 07:41:40 am »
Off-topic: Hayleia, Protip: Chrome tags nested in spoiler tags makes code users cry. :P (due to SMF bug)

« Last Edit: January 17, 2015, 07:47:09 am by DJ Omnimaga »
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline Hayleia

  • Full User
  • Join Date: Nov 2014
  • Location:
  • Posts: 324
  • Post Rating Ratio: +12/-0
Re: Simple Axe Menu
« Reply #11 on: January 17, 2015, 07:49:34 am »
Yeah, I know (and I use FireFox so it doesn't bother me :P) but did you see how long the code was ? I thought it wouldn't be a good idea to post it outside of a spoiler.
Or would it be possible to have scrollable code ? I mean that the "window" with the code would have a max size and would have a scrollbar so we can still see all of it ?

Online xlibman

  • Omni founder & CW co-founder
  • Super User
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18735
  • Post Rating Ratio: +95/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • DJ Omnimaga music store
  • Gender: Male
Re: Simple Axe Menu
« Reply #12 on: January 17, 2015, 07:54:35 am »
I use
(click to show/hide)
in such case (click quote to see my post source). Nobbc isn't required but you might need to disable smileys

EDIT Also I tried to get rid of scrollbars and max width before in CODE tags' CSS, and I still had the issue, so it might be an internal bug or I'm missing something out on CSS3.
« Last Edit: January 17, 2015, 12:12:32 pm by DJ Omnimaga »
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline CKH4

  • Extravagant Sushi
  • Super User
  • Join Date: Jan 2015
  • Location:
  • Posts: 872
  • Post Rating Ratio: +3/-2
  • Gender: Male
Re: Simple Axe Menu
« Reply #13 on: January 17, 2015, 03:21:04 pm »
Hayleia:
I understand what your saying about it not being really readable. I plan to fix this with comments but for right now I want it to be easy enough for a ti basic programmer to get it (no extreme optimizations). In terms of changeable I meant most things were adaptable without changing more than 3 things. I'm going to add my to-do list to the main post but for now here it is:
1. Use a subroutine for drawing the rectangles.
2. Make minor optimizations.
3. Comment the code.

Also why is your username Hayleia? (I only ask because when I read it letter by letter I realized that I hadn't read it correctly before)

DJ O:
You may have to be more specific,
Code: [Select]
.spoiler .code {
  min-height: 256px;
}
Or use javascript to change it. I wrote a script (jquery) but I'm not quite fluent in javascript so I can't write one out again.
  • Calculators owned: TI-83+, TI-84+


Offline Hayleia

  • Full User
  • Join Date: Nov 2014
  • Location:
  • Posts: 324
  • Post Rating Ratio: +12/-0
Re: Simple Axe Menu
« Reply #14 on: January 17, 2015, 05:02:10 pm »
Hayleia:
I understand what your saying about it not being really readable. I plan to fix this with comments but for right now I want it to be easy enough for a ti basic programmer to get it (no extreme optimizations).
Well, changing your sprites names to "°ThatSprite" instead of "Pic1" is not something too hard, even for a beginner ;)
Same, you can use custom variable names. Not really needed when those variables are X and Y, but for example, MyX MyY EnemyX EnemyY are more readable than X Y U V.

Also why is your username Hayleia? (I only ask because when I read it letter by letter I realized that I hadn't read it correctly before)
Sekrett!! :P
Jk, the reason is so stupid I'll never say it. And you're not the first one to misread it :P

 


You can also use the following HTML or bulletin board code to share it on your page or forum signature!


Also do not forget to check our affiliates below.
Planet Casio TI-Planet Calc.news BroniesQC BosaikNet Velocity Games