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/AppGameKit Studio Showcase / [WIP][T1 & T2] MarbleX GUI Library

Author
Message
Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 6th Apr 2014 14:59 Edited at: 9th May 2014 16:36
Hi all,

I needed a very basic GUI library, but there didn't really seem to be any available for AppGameKit, so I wrote one. As I say, it's very basic, but...



Because I have reached the stage where I need it, I finally got around to creating a decent image set for the GUI. It's a hacked and modified version of this image, set up for my needs. It works really well, but there's a few things I'm not sure about. The sliders, for one, really need changing, because the slider itself is hard to see over the glowy blue bar. The checkboxes could use some work; when they're scaled up, they tend to get white edges. Here it is, anyway:



Again....very basic. I want to continue to expand this to a full GUI system, but right now this is all I need.

Among other things, I want to add more base elements, such as vertical sliders, radio buttons and dropdown boxes. In addition, I would like to add support for 'windows', where you can have an element be a parent of the window so it sticks to it and is clipped to the size the of the window. Also, windows should be allowed to be children of other windows.

I haven't actually tested it on mobile yet, but I'm 90% sure it will work.
Done! It definitely works on mobile devices

It WILL be available in Tier 2 as well, just as soon as I port the latest changes of my app over to T2.
Done! You now have a C++ tier 2 version in the download

Features:
- Buttons
- Checkboxes
- Sliders (which can optionally automatically add the current value to the end of their text)
- Listviews; a scrolling list containing other elements
- Really easy to use
- All elements support optional 'hover' image for mouseover
- Works on any platform, including mobile
- Can set and get positions of elements
- Can set and get sizes of element
- Can set visibility of elements
- Both Tier 1 and Tier 2 support

Changes:
[06/04/14] 0.1 - Public release
[07/04/14] 0.2 - Sliders are now positioned correctly; Added position- and size-getting commands for all elements; Added commands for setting font-related stuff; Other minor fixes
[09/04/14] 0.3 - Setting sliders' values now actually works; Added sounds to the elements (many thanks to Paronamixxe actually writing the code!); Added MX_DisableFrame(); MX_SetXXXVisible() no longer crashes if the element has no hover image; Added size-setting commands for all elements
[11/04/14] 0.4 - Wrote C++ version
[06/05/14] 0.5 - Added Listviews, including flinging, bounce at end-of-travel and limited drag beyond end-of-travel; Sliders should now be faster in terms of performance; Fixed sliders when not using a hover image; The position- and size-getting commands are now much more sensible, consistent and easy to use. They now each take into account any text positioning and size in all commands. Plus, there are now commands for getting the positions and sizes of each part of the elements, so you can get information on each sprite in a button, say, or just the text in a slider; Probably some other things that I've forgotten about
[07/05/14] 0.51 - Fixed some bugs with listviews, where positioning didn't adjust the sprite scissor and didn't keep the current scrolled distance correctly
[09/05/14] 0.6 - Added a command to find whether a user is currently touching (or clicking on) a listview; Corrected some incorrect "if" statements in the C++ version; Corrected listview damping to work properly at 60fps (rather than 120); Fixed listviews in the C++ version so you can actually drag them; Adjusted the "gui_checkbox.png" image in set_glowy so it's nicer when resized

Download:
Version 0.1 - 06/04/14 - Obsolete
Version 0.2 - 07/04/14 - Obsolete
Version 0.3 - 09/04/14 - Obsolete
Version 0.4 - 11/04/14 - Obsolete
Version 0.5 - 06/05/14 - Obsolete
Version 0.51 - 07/05/14 - Obsolete
Version 0.6 - 09/05/14 - Current

Attachments

Login to view attachments
Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 7th Apr 2014 23:17
Nice!

Clean, easy to use and saves us lot some coding time! Will definitely consider using this!

Keep us posted!

cheers

nope.

Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 8th Apr 2014 02:13
Quote: "Nice!

Clean, easy to use and saves us lot some coding time! Will definitely consider using this!"


Thanks!

Quote: "Keep us posted!"


Will do! In fact...

Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 8th Apr 2014 02:13
Update!

Changes:

[07/04/14] 0.2 - Sliders are now positioned correctly; Added position- and size-getting commands for all elements; Added commands for setting font-related stuff; Other minor fixes

Download in first post

Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 8th Apr 2014 15:13 Edited at: 8th Apr 2014 15:15
Just thought that I would share a little... I implemented this in my game and found that I was lacking some audio for the sliders and checkboxes that I was using... So I whacked in some quick code that lets you store two audio pieces in the settings for each slider and checkbox and play one when you hover and the other when you click. Thought that it would be a nice addition and needed it anyway for my project anyhow, here are the changes:

In the "MarbleX GUI.agc" file:


In the "MarbleX GUI Slider.agc" file:


And finally, in the "MarbleX GUI Checkbox.agc" file:


Nothing major, nothing advanced, yet adds some depth to the controls

Cheers

nope.

Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 9th Apr 2014 05:09
Quote: "Just thought that I would share a little... I implemented this in my game and found that I was lacking some audio for the sliders and checkboxes that I was using... So I whacked in some quick code that lets you store two audio pieces in the settings for each slider and checkbox and play one when you hover and the other when you click. Thought that it would be a nice addition and needed it anyway for my project anyhow, here are the changes:"


Awesome!! I hadn't thought once about audio for the GUI until now. If you don't mind, I think I'll take your code, modify it to fit better with my ways of coding (no unnecessary spaces, etc.) and include it with the official code

Thanks for sharing!

Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 9th Apr 2014 12:28 Edited at: 9th Apr 2014 14:24
Please do!

I just made it blatantly obvious where I had messed with your code!

I did make a slight alteration after posting the above, which was to not let the "hover" sound play while the slider was pressed and being moved around. This was due to that it would blurt out the sound literally all the time because the mouse would constantly reenter the sprite. Ill edit this post with it once I'm back on my pc!

Here's what I changed:
(just used the MX_Slider.pressed variable to check if the slider is pressed before playing the sound)

Quote: "Thanks for sharing! "

Anytime!

cheers

nope.

Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 9th Apr 2014 15:00 Edited at: 9th Apr 2014 15:10
Quote: "Please do!"


Thanks!

I know you were just dividing the code up When I said "unnecessary spaces" I meant this:

Quote: "PlaySound ( MX_Slider...hoversound )"


...would become this:

Quote: "playsound(MX_Slider...hoversound)"


(Yes, I did remove the [ i ] from the quote....turned everything italic!)

Also I normally only ever use capitals in C++ because most code there does and it's case-sensitive, but this time I'm writing the code this way because I want the library to use capitals in its C++ version and don't want to have to rewrite every single command

Quote: "I did make a slight alteration after posting the above, which was to not let the "hover" sound play while the slider was pressed and being moved around. This was due to that it would blurt out the sound literally all the time because the mouse would constantly reenter the sprite. Ill edit this post with it once I'm back on my pc!"


Ah, good thinking! I actually haven't gotten around to merging the code yet, so you've just solved a problem before I even knew about it

Just so you know, sometimes (a lot of the time, in fact) I can sound like a real git when I don't mean to. In reality I'm sitting in my chair in my bedroom (which happens to be a big blue bus) smiling and enjoying that fact that the internet has so many friendly and exceptionally helpful people I really do appreciate the work you added to mine

Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 9th Apr 2014 16:09
I understand why you dont want to write it like I did, although my brain did not like your very compact strutcure! I guess I might be a little too pendantic in my code haha!(I allways have LOTS of room around all commands and capitalize ever word)

Quote: "Ah, good thinking! I actually haven't gotten around to merging the code yet, so you've just solved a problem before I even knew about it

Just so you know, sometimes (a lot of the time, in fact) I can sound like a real git when I don't mean to. In reality I'm sitting in my chair in my bedroom (which happens to be a big blue bus) smiling and enjoying that fact that the internet has so many friendly and exceptionally helpful people I really do appreciate the work you added to mine "


A blue bus!? Im stuck here in my boring old bedroom... What am I doing wrong? Don't be so harsh on yourself! And anyway, always happy to help! Thats what I love about this community, so many friendly and helpful people!

cheers, and happy coding

nope.

Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 9th Apr 2014 17:16 Edited at: 5th May 2014 05:03
Quote: "although my brain did not like your very compact strutcure!"


Not many people like the way I write my code, but I do and that's all I care about!

Quote: "A blue bus!? Im stuck here in my boring old bedroom... What am I doing wrong?"


Haha Outside, a couple of days ago:



Inside, 5 minutes ago:



Yes, that is my brother's arm you can see at the left side. So what if I work 'til midnight when he's asleep. Bit surprised he didn't wake up when I turned the lights on, though... My computer is the far one. Obviously we have a normal house as well, the bus is for my brother and I only

Quote: "Don't be so harsh on yourself!"


Ok, I'll try!

Quote: "Thats what I love about this community, so many friendly and helpful people!"


Indeed!

Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 9th Apr 2014 17:22 Edited at: 9th Apr 2014 17:30
Update!

Changes:
[09/04/14] 0.3 - Setting sliders' values now actually works; Added sounds to the elements (many thanks to Paronamixxe actually writing the code!); Added MX_DisableFrame(); MX_SetXXXVisible() no longer crashes if the element has no hover image; Added size-setting commands for all elements

Download in first post Many thanks to Paronamixxe for inventing the sound code, saved me a lot of work (not to mention that tiny little fact that it didn't even occur to me to do that)! Hopefully my modified version will still work; I didn't have any sounds handy for testing

Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 9th Apr 2014 17:28 Edited at: 9th Apr 2014 17:29
Hahahahha! That looks awesome! Specially the weather... Southern Sweden is just cold and wet at the moment

taken like right now...




Anyway! Your welcome for the audio code... Now I'm off to write some AI... Wish me luck

cheers

nope.

Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 9th Apr 2014 17:33 Edited at: 9th Apr 2014 17:34
Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 11th Apr 2014 10:41
Update!

Changes:
[11/04/14] 0.4 - Wrote C++ version

Yes, you now have a C++ Tier 2 version in the download on the first post! Have fun finding bugs that I've invariably missed!

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 12th Apr 2014 03:57
Very cool! I just might be able to use this in a planned project (not to be started until 'Help YeeYee Get Home' gets published). Thank you.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 12th Apr 2014 12:13
Ohhhh, a T2 version, I will have to give this a try then

Say ONE stupid thing and it ends up as a forum signature forever. - Neuro Fuzzy
Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 12th Apr 2014 17:57 Edited at: 12th Apr 2014 18:08
Quote: "Very cool!"


Thanks!

Quote: "Ohhhh, a T2 version, I will have to give this a try then "


Hopefully it'll _just work_ for you

After some very simple tests I can say for sure it DOES work on mobile, just like that, no fixes needed

MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 17th Apr 2014 05:27
i love your bus ^^

--------------
Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 6th May 2014 04:04
Update!

Changes:
[06/05/14] 0.5 - Added Listviews, including flinging, bounce at end-of-travel and limited drag beyond end-of-travel; Sliders should now be faster in terms of performance; Fixed sliders when not using a hover image; The position- and size-getting commands are now much more sensible, consistent and easy to use. They now each take into account any text positioning and size in all commands. Plus, there are now commands for getting the positions and sizes of each part of the elements, so you can get information on each sprite in a button, say, or just the text in a slider; Probably some other things that I've forgotten about

So the biggest addition in this update is the Listviews. They're really cool. They let you add any kind of element (except, currently, other listviews) into the list, then use the mouse or a finger to drag the list up or down. When you reach the end of the list, the list is able to move past the end, but gets progressively harder to move. If you fling the list, it will fly along, slowing down until it stops or hits the end. If it hits the end, it bounces slightly. Lastly, the Listviews are nonblocking. This means all of the elements contained within can still be used even while the list is moving, as long as you can aim well enough with your finger

All in all, it's designed to act as much like most touchscreen lists as possible (fling, bounce, drag-past-ends, etc.). If you have any questions on how to use any of part of the GUI, just ask

Hope you like it, and as always, please report any bugs you can find!

Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 7th May 2014 09:09
Update!

Changes:
[07/05/14] 0.51 - Fixed some bugs with listviews, where positioning didn't adjust the sprite scissor and didn't keep the current scrolled distance correctly

Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 8th May 2014 00:29
Thank you for your hard work on this free library Clonkex.
Your work is awesome

[/url]
Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 8th May 2014 07:03
Quote: "Thank you for your hard work on this free library Clonkex.
Your work is awesome "


Thanks! That means a lot to me!

Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 8th May 2014 17:16
Niiiiiiiice Good work as always!

cheers

Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 9th May 2014 09:45
Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 9th May 2014 16:37 Edited at: 9th May 2014 16:39
Update!

Changes:
[09/05/14] 0.6 - Added a command to find whether a user is currently touching (or clicking on) a listview; Corrected some incorrect "if" statements in the C++ version; Corrected listview damping to work properly at 60fps (rather than 120); Fixed listviews in the C++ version so you can actually drag them; Adjusted the "gui_checkbox.png" image in set_glowy so it's nicer when resized

Note: When I say "corrected listview damping", I mean I corrected the default values to look best at 60fps. Ideally this should be time-based, but that's something for the future.

unlikely
12
Years of Service
User Offline
Joined: 5th Mar 2012
Location: Ohio, USA
Posted: 11th May 2014 18:06
Not sure how I just saw this now. Thanks for this, I will definitely be checking it out.


Oh, and I love your bus. Awesome.
Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 12th May 2014 17:44
FEATURE REQUEST/IDEA!

Textboxes.

That is all! haha

cheers

Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 12th May 2014 18:07
I have modified your code a little and implemented this feature for me, so there should also be no problem in that, but I would like to see custom button images. So each button could have an unique imageset

[/url]
Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 17th May 2014 16:59
Quote: "Not sure how I just saw this now. Thanks for this, I will definitely be checking it out.


Oh, and I love your bus. Awesome."


Thanks!

Quote: "FEATURE REQUEST/IDEA!

Textboxes."


I have been pondering the way I would add those, but right now I don't have the time to add things I don't need. As soon as my current project is finished I'll add a whole lot of new features to this lib

Quote: "I have modified your code a little and implemented this feature for me, so there should also be no problem in that, but I would like to see custom button images. So each button could have an unique imageset "


Yeah, should be super easy to implement, I just haven't had time for non-essential things so far Soon, my friend, soon

mr_d
DBPro Tool Maker
17
Years of Service
User Offline
Joined: 26th Mar 2007
Location: Somewhere In Australia
Posted: 24th Jun 2014 16:49
have a

Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 6th Jul 2014 10:42
Quote: " have a"


Thank you!! *crunch crunch cru- cough-cough* Ahem. Carrot went up my nose.

3d point in space
15
Years of Service
User Offline
Joined: 30th Jun 2009
Location: Idaho
Posted: 6th Jul 2014 19:43
looks like you don't live in a good place clonkex, I wish you the best. At least you have someone to party with lol, All my brothers and sisters live somewhere else. Going to a university is expensive, but if you get good grads you might get a scholarship to pay for it. Then you can live in a better place hopefully, if you go all the way for your masters degree.

I only have 9 credits left for my masters and I have a very high GPA, but I was lucky by joining the military and it paying for me to go to college. I don't know why people want you to have a masters degree before you work, but that is how the world works know.

Developer of Space Chips, pianobasic, zipzapzoom, and vet pinball apps. Developed the tiled map engine seen on the showcase. Veteran for the military.
Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 7th Jul 2014 02:56
Quote: "looks like you don't live in a good place clonkex, I wish you the best. At least you have someone to party with lol, All my brothers and sisters live somewhere else. Going to a university is expensive, but if you get good grads you might get a scholarship to pay for it. Then you can live in a better place hopefully, if you go all the way for your masters degree."


Haha, well... the bus may look a bit daggy on the inside, but it's right next to our lovely normal house with posh gardens (which are not so posh right now because it's Winter) and 20 acres of land. It's amazing having our own little "house" with TV, reverse cycle air con, fireplace, hardwired mains electricity, etc. I love where we live

Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 19th Aug 2014 12:32 Edited at: 19th Aug 2014 12:33
So yes, I AM going to spam most of the threads I have created recently with a message (don't panic, I rarely post anything, this is not a habit):

VOTE FOR RTA! The voting is down the bottom of the page and does not require a login.

Rush To Adventure is an awesome retro Zelda-style 2D platformer made with AppGameKit that's already doing really well on Android mobile devices and Ouya. It's created by Digital Awakening, who has put a huge amount of work into this game; it's well worth checking out and VOTING FOR. Go. Now. Vote for RTA!

Login to post a reply

Server time is: 2024-11-21 22:39:34
Your offset time is: 2024-11-21 22:39:34