Widget Confused

Hi all, 

I’m very confused regarding widgets, are they something to be downloaded from the corona site? Is it something that I make, or maybe a png pic I upload?

Sorry for my ignorance when it comes to coding I’m easily confused.

Appreciate any help, 

Thanks

widget.* is a Corona lib for making GUI parts like buttons, scrollable windows, etc.

It is just one of many, many,… many ways to make GUI parts.

Among the many demos/samples that come with Corona, there is a Widget demo.

Run Simulator -> Click Samples -> Run Sample ‘WidgetDemo’ Under Interface examples group. 

Are you asking how to customize widget art?  If so, read the API docs (link above) and you should find the info you need for the widgets you are using.

Hi, I’m back and sorry to say that I’m not having any luck with how to use the corona widgets.  I signed up with github, but there are only 2 old pages for lua widgets, I didn’t see any type of buttons that could be used.  

I want to put a button on the menu screen that you click to go to the game level screen. If I add the corona widget library to my code, how can I see what the button looks like before I add it?

I really want to learn lua, but it slow going for me.

Thanks

  1. You don’t need the widget code from GitHub.

  2. Have you read the API docs yet?  This is not a Lua thing.

Button Widget API Docs:

https://docs.coronalabs.com/api/library/widget/newButton.html

  1. For example, making a push button is straight forward. A  two-image button can be made following these instructions:

https://docs.coronalabs.com/api/library/widget/newButton.html#image

  1. If this still confusing I think you may need to get a mentor and/or get/pay someone to make you some examples you can follow.

If nobody reading this volunteers to help you,  I could be convinced to do a level 1 hit to make a video showing you how to make a two-image button and also provide a working example based on the video.

Also, you could just NOT use widget.* if you find it too confusing.

SSK has a perfectly good button library (push, radio, and toggle):

https://roaminggamer.github.io/RGDocs/pages/SSK2/libraries/easy_interfaces/

One more note.  There are a bunch of examples you can get your hands on that show how to make buttons like you’re describing, many of which are free.  Just look at how these games work:

https://docs.coronalabs.com/guide/programming/index.html

Leads here:

https://github.com/coronalabs-samples/CoronaCannon/

Has a main menu: 

https://github.com/coronalabs-samples/CoronaCannon/blob/master/scenes/menu.lua

self.playButton = widget.newButton( { defaultFile = 'images/buttons/play.png', overFile = 'images/buttons/play-over.png', width = 380, height = 200, x = 400 - 190, y = -200 - 100, onRelease = function() sounds.play('tap') composer.gotoScene('scenes.level\_select', {time = 500, effect = 'slideLeft'}) end }) group:insert(self.playButton)

The images referred  to are here:

https://github.com/coronalabs-samples/CoronaCannon/blob/master/images/buttons/play.png

https://github.com/coronalabs-samples/CoronaCannon/blob/master/images/buttons/play-over.png

play.png play-over.png

Just download the project and walk through the code and look at the button assets.  I think this will become clear then.

Hi, I’m back again I’ve been practicing working with widgets and I’m happy to say it’s finally making more sense.  I’m a slow learner always have been, but I wanted to thank you for going to extra mile to help me.

Thanks again and Happy Holidays!

widget.* is a Corona lib for making GUI parts like buttons, scrollable windows, etc.

It is just one of many, many,… many ways to make GUI parts.

Among the many demos/samples that come with Corona, there is a Widget demo.

Run Simulator -> Click Samples -> Run Sample ‘WidgetDemo’ Under Interface examples group. 

Are you asking how to customize widget art?  If so, read the API docs (link above) and you should find the info you need for the widgets you are using.

Hi, I’m back and sorry to say that I’m not having any luck with how to use the corona widgets.  I signed up with github, but there are only 2 old pages for lua widgets, I didn’t see any type of buttons that could be used.  

I want to put a button on the menu screen that you click to go to the game level screen. If I add the corona widget library to my code, how can I see what the button looks like before I add it?

I really want to learn lua, but it slow going for me.

Thanks

  1. You don’t need the widget code from GitHub.

  2. Have you read the API docs yet?  This is not a Lua thing.

Button Widget API Docs:

https://docs.coronalabs.com/api/library/widget/newButton.html

  1. For example, making a push button is straight forward. A  two-image button can be made following these instructions:

https://docs.coronalabs.com/api/library/widget/newButton.html#image

  1. If this still confusing I think you may need to get a mentor and/or get/pay someone to make you some examples you can follow.

If nobody reading this volunteers to help you,  I could be convinced to do a level 1 hit to make a video showing you how to make a two-image button and also provide a working example based on the video.

Also, you could just NOT use widget.* if you find it too confusing.

SSK has a perfectly good button library (push, radio, and toggle):

https://roaminggamer.github.io/RGDocs/pages/SSK2/libraries/easy_interfaces/

One more note.  There are a bunch of examples you can get your hands on that show how to make buttons like you’re describing, many of which are free.  Just look at how these games work:

https://docs.coronalabs.com/guide/programming/index.html

Leads here:

https://github.com/coronalabs-samples/CoronaCannon/

Has a main menu: 

https://github.com/coronalabs-samples/CoronaCannon/blob/master/scenes/menu.lua

self.playButton = widget.newButton( { defaultFile = 'images/buttons/play.png', overFile = 'images/buttons/play-over.png', width = 380, height = 200, x = 400 - 190, y = -200 - 100, onRelease = function() sounds.play('tap') composer.gotoScene('scenes.level\_select', {time = 500, effect = 'slideLeft'}) end }) group:insert(self.playButton)

The images referred  to are here:

https://github.com/coronalabs-samples/CoronaCannon/blob/master/images/buttons/play.png

https://github.com/coronalabs-samples/CoronaCannon/blob/master/images/buttons/play-over.png

play.png play-over.png

Just download the project and walk through the code and look at the button assets.  I think this will become clear then.

Hi, I’m back again I’ve been practicing working with widgets and I’m happy to say it’s finally making more sense.  I’m a slow learner always have been, but I wanted to thank you for going to extra mile to help me.

Thanks again and Happy Holidays!