Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Free Code - Simple drop down menu system

Author
Message
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 17th May 2012 16:21 Edited at: 17th May 2012 16:22
This is something I'm making for my own purposes but I thought I'd share.



If you want a simple "Windows" style drop down menu this will give you something quick and easy to use. You could easily edit it for your own uses I think.

The only real issue at the moment is that your game must be entirely "drawn" at the moment, why? There is no drawText() command so either my text is drawn behind the GUI or the GUI is drawn behind everything else. I will fix this at some point but it works for me at the moment and maybe someone will make a simple fix before I get around to needing it...

I hope it's useful anyway

Attachments

Login to view attachments
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 17th May 2012 16:21
Screenshot:

Attachments

Login to view attachments
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 17th May 2012 16:23 Edited at: 17th May 2012 16:26
You can set the colour of the menu and highlight. Also you can change the font. I haven't added changing the font colour yet but I will add that at some point.



Attachments

Login to view attachments
IronGiant
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 27th Feb 2012
Location: the great state of madness
Posted: 17th May 2012 16:51
Pretty cool Bax, thanks for giving out the code. It is just what We need, more Code , more Examples, and more Tutorials. To those watching and are well versed in AppGameKit, post more!. As number 5 said, "I need INPUT, More INPUT!", call me Johnny 5 .
Now wheres the code for that button that I click to post Facebook games?, collect Payment for ingame Items? and make a mill offa Suckerberg? lol, jk, and again, Thanks

It's Bird! , It's Plane!, No its a rocket powered Squirrel holding some acorns and a smile!
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 17th May 2012 17:43
Glad to help, I'll try to make it a bit nicer over time. Also I want to add more to it but I'll get around to that.

I'll be uploading some new tutorials soon to the AppGameKit site. Watch the news area for updates.

basjak
14
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 17th May 2012 17:46 Edited at: 17th May 2012 23:48
That's very cool.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 17th May 2012 18:05 Edited at: 17th May 2012 18:14
Definitely cool code.

A great starting point for a drop-down menu system.

Thank you!

EDIT: Wierd, no matter what value I set the menu_<rgb> globals to in main.agc, it defaults to the original colors. If I change them within the showMenu function, they work.

Cheers,
Ancient Lady
kamac
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 17th May 2012 18:17 Edited at: 17th May 2012 18:19
Here is what have I made day before.
Though, colors are messed up in this .gif.



Althrough, there are also normal buttons and list buttons. They're not on this .gif though.



Follow me on twitter! @kamac496
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 17th May 2012 18:21 Edited at: 17th May 2012 18:26
Quote: "Wierd, no matter what value I set the menu_<rgb> globals to in main.agc, it defaults to the original colors. If I change them within the showMenu function, they work."

Where in your code did you set it? It needs to be set after the menu is initialised.

Quote: "Here is what have I made day before.
Though, colors are messed up in this .gif."

Spookily similar

EDIT: If you have the "Michroma" font from the AppGameKit font sets it looks niiiice



Attachments

Login to view attachments
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 17th May 2012 18:36
I simply set menu_red to zero, changing the original line.

I just spotted the setMenuColor call after adding all the menu items. It was overwriting anything I did to the original global values. My bad for focusing in one area.

(Btw, the colors for the menu should be integer, not float, based on what the SetSpriteColor command is expecting.)

Cheers,
Ancient Lady
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 17th May 2012 18:43
Quote: "I just spotted the setMenuColor call after adding all the menu items. It was overwriting anything I did to the original global values. My bad for focusing in one area."

I thought that must be it.

Quote: "(Btw, the colors for the menu should be integer, not float, based on what the SetSpriteColor command is expecting.)"

Actually it shouldn't cause any problems in Tier 1, try setting it to 0.5 or some other float. I doubt it will cause any problems but it's easy enough to change it if it bothers you.

MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 17th May 2012 19:39
NICE!
will keep this one in mind thank you for sharing as always!

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 17th May 2012 19:58
Quote: "I doubt it will cause any problems but it's easy enough to change it if it bothers you."


You are absolutely correct. In Tier1 there is a lot of forgiveness between float and integer.

But I can't help noticing (and commenting) things like that. As anyone in my family would tell you, I am just a little obsessive compulsive. Monk is my absolute hero!

Being somewhat OC has helped a lot in programming over the years. But it doesn't help with my social skills. (I can hear my family say "What social skills?!")

I really do appreciate the code and advice that you share with us.

Cheers,
Ancient Lady
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 18th May 2012 10:51
Actually it's better practice to be that way in programming as I'm sure you know

I like to allow floats sometimes even when it's not necessary, if I have a value I want to change over time such as colour or alpha I tend to use a float so that transitions remain smooth. It might not be very noticeable but it has very little overhead.

I really appreciate your experience and comments too! I have no formal training and often learn a lot from throw away comments made by more experienced programmers. Focused comments like yours make me think a lot more about what I do.

Thanks again!

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 18th May 2012 16:47
Does using a float value like 120.5 actually produce a different color than 120?

If so, that is a very curious, and probably useful, capability.

But probably only works in Tier1. Pretty much any Tier2 compiler will complain about passing a float to something looking for an integer.

For someone with no formal training you do extremely well!

It also means you had no habits (good, bad or otherwise) learned from others to overcome.

Keep the great examples coming.

Cheers,
Ancient Lady
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 18th May 2012 16:53
Quote: "Does using a float value like 120.5 actually produce a different color than 120?"

No I don't think so.

Quote: "But probably only works in Tier1. Pretty much any Tier2 compiler will complain about passing a float to something looking for an integer."

Yes, I guess that's why it's better practice to stick to the correct type.

Quote: "For someone with no formal training you do extremely well!

It also means you had no habits (good, bad or otherwise) learned from others to overcome.

Keep the great examples coming. "

Thanks a lot I do work as a programmer using C# (currently) but my knowledge is all learned from books, the internet, great colleagues and a little vicarious knowledge from my deceased Dad. Throw some hands on experience too... I'll keep the examples coming while I think I have something useful to share

I don't think I do bad for a Blacksmith.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 19th May 2012 00:47
As an example, here is what I made the menu system for. It's a character animation system in the early stages. I won't make any wild promises but the idea is it will be possible to export an animated character that can also be turned into a box2d ragdoll at any stage.

This "Character Workshop" will be free and open source too



MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 19th May 2012 01:06
I had two words to say but unfortunately I cannot type them here >.<

AMAZING!

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 19th May 2012 03:09
Flipping OUTSTANDING!!!!

Cheers,
Ancient Lady
basjak
14
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 19th May 2012 03:22 Edited at: 19th May 2012 04:49
@baxslash: you don't have to promise anything but I promise I'll be waiting for it.

JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 19th May 2012 10:19
Excellent! Hurry up!

-- Jim
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 19th May 2012 11:01
Thanks guys

The good news is I need it for next weekend, I'm doing a hackathon with Rick from TGC and I want this tool to help make the game we have in mind.

I just hope I find time to get a basic version working!

It will work procedurally so that you can have smooth animation at any speed. I'll also be allowing various forms of interpolation between keyframes. Should be cool

bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 20th May 2012 18:57
Baxslash will your tool only export spritesheets or AppGameKit code so that intricate animations can be built programatically from the little legs and hands pieces?
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th May 2012 20:29
For now it will export animation data but later I'll add the option to make sprite sheets.

Grumpy Jedi
14
Years of Service
User Offline
Joined: 16th Jan 2010
Location:
Posted: 20th May 2012 21:21
That looks GREAT Baxslash, and very useful.

You sharing it with us is even better
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th May 2012 23:25
I'm really excited about how the animation system will work which is completely procedural. It will allow you to slow down or speed up animation smoothly. Once I add smoothed interpolation it will make it possible to make very natural animation easily. I want to integrate my own particle system too meaning you could add smoke to torches etc.

bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 20th May 2012 23:42
I'm looking at procedural animation systems right now as my next project will require a lot of animation and the right tool is vital, as spritesheets won't cut it.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 21st May 2012 00:37
[quoteI'm looking at procedural animation systems right now as my next project will require a lot of animation and the right tool is vital, as spritesheets won't cut it.[/quote]
Well hopefully I'll have something fairly useful by next weekend. If so I'll happily share it.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 21st May 2012 17:57
I've started a new thread for the character workshop with an early demo here: AGK Character Workshop

Login to post a reply

Server time is: 2024-11-23 14:11:03
Your offset time is: 2024-11-23 14:11:03