GUI

A place for developers to promote games they have created with Moai

GUI

Postby derickdong » Sun Dec 04, 2011 8:12 am

I've been working on a project for a while that needed a decent GUI, so I put one together. I wrote most of it a while back (against MOAI 0.7), and have been fixing/extending it as I went along. Its still fairly simple, and lacks a lot of the bells and whistles of more mature systems, but I figured some other people may find it useful.



I've only used and tested this on Windows (XP). Input handling for mobile devices isn't hooked up at all (although it shouldn't be difficult to add).



Currently, there is support for the following widgets:

- Button - your basic push button; also supports images

- Check Box - select and unselect

- Edit Box - accepts user keyboard input

- Image - static image

- Label - static text

- Progress Bar - displays a bar that indicates progress

- Radio Button - select and unselect; only one in the group can be selected at a time

- Scroll Bar - scroll through a list of items; horizontal and vertical

- Slider - selection of a numeric value by adjusting the slider; horizontal and vertical

- Text Box - a scrollable box of text

- Widget List - a list box; supports multiple selections and the ability to specify a column's widget type



Here's a link to the download:

http://code.google.com/p/moaig.....loads/list



Included in the download are several samples. If anyone has any suggestions/comments/problems, let me know.
derickdong
 
Posts: 63
Joined: Wed Nov 09, 2011 2:54 pm

GUI

Postby todd » Sun Dec 04, 2011 8:21 am

Wow! That's excellent Derick - thank you.
User avatar
todd
 
Posts: 262
Joined: Fri Mar 25, 2011 1:11 pm

GUI

Postby patrick » Sun Dec 04, 2011 1:49 pm

Nice work!

I see you went with the MIT license. Mind if we include this in our contrib folder?
User avatar
patrick
 
Posts: 589
Joined: Sat Apr 02, 2011 10:50 pm

GUI

Postby derickdong » Sun Dec 04, 2011 4:31 pm

Not at all. Is there anything I needed to do?
derickdong
 
Posts: 63
Joined: Wed Nov 09, 2011 2:54 pm

GUI

Postby ibisum » Mon Dec 05, 2011 12:38 am

Wow this is a really nice contribution to the moai scene .. Very useful!  Thank you very much for sharing it .. 
;
--
ibisum@gmail.com
Got a MOAI snippet? Please consider adding it to http://moaisnippets.info
User avatar
ibisum
 
Posts: 1003
Joined: Mon Oct 17, 2011 1:11 am
Location: Vienna, Austria

GUI

Postby patrick » Tue Dec 06, 2011 9:33 am

Nothing more to do. I'll just copy it in there as-is. Ping me if/when you want to update it. :)
User avatar
patrick
 
Posts: 589
Joined: Sat Apr 02, 2011 10:50 pm

GUI

Postby bonozogames » Fri Dec 16, 2011 12:47 pm

(I did not find any screen shots to review.)
User avatar
bonozogames
 
Posts: 170
Joined: Sat Nov 05, 2011 9:17 pm
Location: Tulsa, OK

GUI

Postby bonozogames » Sat Dec 31, 2011 11:50 am

Here's a screen shot of one of the samples ("variousfromlayout.lua")

http://s15.postimage.org/452mx.....oaigui.png
User avatar
bonozogames
 
Posts: 170
Joined: Sat Nov 05, 2011 9:17 pm
Location: Tulsa, OK

GUI

Postby Dwi » Tue Jan 03, 2012 10:39 pm

nice :) , otw try Cool
Trial n error :) suppose to be..
Dwi
 
Posts: 5
Joined: Wed Jan 04, 2012 6:35 am

Re: GUI

Postby applelifer » Fri Mar 16, 2012 9:02 am

Any plans to port this to iOS. I would really like it. Thanks! Moai is awesome!
applelifer
 
Posts: 5
Joined: Fri Mar 16, 2012 8:44 am

Re: GUI

Postby ibisum » Tue Mar 20, 2012 2:19 am

Just wondering if there has been any changes to this lately, particularly regarding the layer handling of events? When I tried to use this, it was in combination with the scene.lua library also published, but these two frameworks aren't compatible with each other due to the way layer events were being handled in each library. So, if there is a way to use scenes and the guilibrary, I'd love to hear it!
;
--
ibisum@gmail.com
Got a MOAI snippet? Please consider adding it to http://moaisnippets.info
User avatar
ibisum
 
Posts: 1003
Joined: Mon Oct 17, 2011 1:11 am
Location: Vienna, Austria

Re: GUI

Postby derickdong » Wed Mar 21, 2012 4:17 pm

applelifer wrote:Any plans to port this to iOS. I would really like it. Thanks! Moai is awesome!

Is there something specific that's not working on that platform? Unfortunately, I don't having anything that could run it, so you're going to have to give me more information about the issue(s) before I'm able to do anything. It was written using MOAI's Lua implementation, so it should run on anything MOAI supports. Unless you are referring to input handling for mobile devices, in which case, I haven't gotten around to adding anything.

ibisum wrote:Just wondering if there has been any changes to this lately, particularly regarding the layer handling of events? When I tried to use this, it was in combination with the scene.lua library also published, but these two frameworks aren't compatible with each other due to the way layer events were being handled in each library. So, if there is a way to use scenes and the guilibrary, I'd love to hear it!

I haven't worked with this scene.lua library to which you are referring. I'm going to guess the situation is:
1. Create a scene - a layer is added
2. Create the gui - a layer is added
3. At some point later you're creating a second scene, which adds a third layer, on top of the gui's layer. This prevents the gui from properly receiving events.

With the way MOAI is designed, I believe a GUI system must always be the top layer. Otherwise, events will be caught by any layers above it. Unfortunately, MOAI currently doesn't have a way to remove a specific layer from the layer rendering stack. I -think- MOAILayerBridge2D could be used to fix this, as it looks like it was intended for HUD elements. However, from what I've seen, MOAILayerBridge2D only deals with rendering, and not input handling. I could be wrong, though, as I haven't really delved into its functionality.

A possibility (although hardly ideal) would be to maintain an intermediate layer stack. This would be how you would want the layers ordered, and the stack you would deal with. Whenever a change to it is made, all the layers would be popped off MOAI's layer stack, and the layers would be pushed back on according to the intermediate stack.
derickdong
 
Posts: 63
Joined: Wed Nov 09, 2011 2:54 pm

Re: GUI

Postby Mud » Thu Mar 22, 2012 11:55 am

derickdong wrote:Is there something specific that's not working on that platform? Unfortunately, I don't having anything that could run it, so you're going to have to give me more information about the issue(s) before I'm able to do anything. It was written using MOAI's Lua implementation, so it should run on anything MOAI supports. Unless you are referring to input handling for mobile devices, in which case, I haven't gotten around to adding anything.


I tried it on my iPad. I mapped touch events into the same code as your mouse listener, but there was some kind of coordinate translation issue. I could sometimes get buttons/sliders/etc. to react by touching radically wrong positions on the screen. :) I took a few guesses at what translation was required and gave up.

P.S. You can pick up an iPad 1 for under $200. ;)
Mud
 
Posts: 57
Joined: Sun Jan 29, 2012 9:54 pm

Re: GUI

Postby ibisum » Fri Mar 23, 2012 2:28 am

Also, there was the layer/partition bug in MOAI found recently that might have had some effect on this issue, no?
;
--
ibisum@gmail.com
Got a MOAI snippet? Please consider adding it to http://moaisnippets.info
User avatar
ibisum
 
Posts: 1003
Joined: Mon Oct 17, 2011 1:11 am
Location: Vienna, Austria

Re: GUI

Postby Jubaz » Thu Apr 19, 2012 8:41 pm

Hi! I'm newbie on Lua and MOAI. I tried to run some of the examples and got this error:
I'm getting this error: PANIC: unprotected error in call to Lua API (.\gui\text.lua:58: attempt to call method 'getScale' (a nil value))

Do you know what's happening?
Jubaz
 
Posts: 9
Joined: Wed Apr 18, 2012 11:08 am

Re: GUI

Postby anddrewscott » Thu Apr 19, 2012 11:30 pm

Text:getScale() was removed in the latest version.
Remove that line and it should work fine by using the default font size.
anddrewscott
 
Posts: 153
Joined: Fri Sep 02, 2011 7:39 am

Re: GUI

Postby Jubaz » Fri Apr 20, 2012 9:25 am

Ahh, thanks.
But I got the same error on the line: self._textBox:setStringColor(1, #self._string, r, g, b, a)
I removed this line, but the components were not displaying correctly.
Jubaz
 
Posts: 9
Joined: Wed Apr 18, 2012 11:08 am

Re: GUI

Postby derickdong » Fri Apr 20, 2012 11:40 am

As stated in the original post, this was written against version 0.7. There have been a number of changes to MOAI since then, particularly in v1.0. I've recently updated to the newest version, and have most of the gui code working again. One of the main problems I'm having is how MOAI deals with decks when they don't have an assigned texture. Previously, they wouldn't be rendered. Now, they are rendered, and seem to use whatever texture state information was last used.

I haven't really been looking at it too much lately, as I was waiting to see how things were going to pan out with v1.0. Now that it looks to be more or less stable, I'll try to go back to it when I get a chance.
derickdong
 
Posts: 63
Joined: Wed Nov 09, 2011 2:54 pm

Re: GUI

Postby Jubaz » Fri Apr 20, 2012 11:57 am

Oh, nice.
Thank you, Derick.
Tell us here if you fix them, please. These components would be very useful. :)
Jubaz
 
Posts: 9
Joined: Wed Apr 18, 2012 11:08 am

Re: GUI

Postby ibisum » Sat Apr 21, 2012 4:33 am

derickdong, I am currently working on getting the moaigui stuff caught up with moai-1.0, but it seems you've already done this work? Is there some way we can sync our work through a repo and thus bring the moaigui stuff up to scratch with the 1.0 release together? I am using this framework rather extensively for some of my MOAI projects, and getting everything brought up to functional on moai-1.0 is a pretty high priority for me - so I'd be happy to work on whatever is needed. Heck, its my day job at this point. ;)

Edit, just wanted to say that the repo in your google code site is empty .. maybe you can set up a 1.0-fixing branch and we can work together?
;
--
ibisum@gmail.com
Got a MOAI snippet? Please consider adding it to http://moaisnippets.info
User avatar
ibisum
 
Posts: 1003
Joined: Mon Oct 17, 2011 1:11 am
Location: Vienna, Austria

Next

Return to Made With Moai

Who is online

Users browsing this forum: No registered users and 0 guests

x