Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

[Lua] How to create 2d UI Elements?
Started by iverson334308400 Oct 03 2019 04:20 PM

6 replies to this topic
help
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

iverson334308400

[GLOBAL: userInfoPane.html]
iverson334308400
  • Observer

  • 6 posts
  • Corona SDK

So, I have experience with Lua but normally I'm provided with a workspace to create UI work and then be able to reference them via script. I'm not sure how I can "Create" UI work out of code alone. Could someone give me some examples or tell me how? 

I'd also like to know how I could add Images. I've seen many people just do "something.png" and be able to load in the image. How does it work? 

I'm fairly new so all help would be appreciated! Thank you.

 

Right now, I can only print stuff in the output console, If you're curious, I'm making a "Login" ui so I need to be able to create textbox if possible. Also it would be nice if someone provided all the objects I could create.



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,207 posts
  • Enterprise

Are you just using Lua or are you using Corona?  This is a very important question, because almost every computer language doesn't have built-in UI features other than prompting for input from a terminal console and printing the results. You always need something more than just the language to do this. 

 

Corona is a framework that gives you the API's (function calls) that you need to put images on the screen, show text boxes, react to input, etc. Lua is the language, Corona is the API Library/Framework/Engine that does the heavy lifting.

 

FWIW, these forums are for people using Corona to build mobile, desktop, TV and HTML5 apps. Corona uses Lua as it's core language, but all the tools you're asking about is done with Corona APIs.

 

Rob



[TOPIC: post.html]
#3

sporkfin

[GLOBAL: userInfoPane.html]
sporkfin
  • Contributor

  • 596 posts
  • Corona SDK

@iverson  Check out some of the sample projects that come in the Corona folder.  You might find what you are looking for there and it's a great way to learn Corona.



[TOPIC: post.html]
#4

iverson334308400

[GLOBAL: userInfoPane.html]
iverson334308400
  • Observer

  • 6 posts
  • Corona SDK

@Rob Miracle, yes I am using Corona as the platform. I'm just not sure how to do it. When I installed corona, I got a bunch of dll files, I would love examples of people using Corona to create UI elements. 

@sporkfin thanks I'll check it out later, I'm currently as school.

Also is there a database for the API's corona provides?



[TOPIC: post.html]
#5

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,207 posts
  • Enterprise

Have you gone through our Getting Started Guide yet? http://docs.coronalabs.com/guide/programming/index.html

 

Corona has built-in support for SQLite with regards to databases.

 

Rob



[TOPIC: post.html]
#6

iverson334308400

[GLOBAL: userInfoPane.html]
iverson334308400
  • Observer

  • 6 posts
  • Corona SDK

@Rob Miracle, how would I be able to create textboxs for logins or how would I be able to make like a google login etc?



[TOPIC: post.html]
#7

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,207 posts
  • Enterprise

There is a sample project here: https://github.com/coronalabs-samples/business-app-sample that has some simple form setups as well as database usage (in addition to a bunch of other stuff). In the SampleApps folder that ships with Corona there is a whole section on Interface things from text boxes to buttons and tableViews, etc. The link above is a complete working app, the samples are a little more "show off this particular API or set of APIs". At that same site is a fully functional Weather app that shows how to use a lot of interface elements.

 

We just published a guest tutorial this week on the blog about using Google and Apple to do sign ins. You can also use the Facebook plugin to set up a Facebook login. There are also a couple of plugins (PlayFab, GameSparks) that provide social media type login activities as well.

But if you want to setup your own username/password system, not only will you need a form to log them in, you will need a form to let them create an account. You will need server API endpoints (perhaps created in PHP, Node.js, .NET etc.) to handle the sign in and registration (unless you're using a service like PlayFab). You will have to become an expert on Internet security, password encryption, authorization tokens, etc. because you don't want your user database to be hacked. 

 

Is this scary? Yes. 

 

Since you haven't said what kind of multiplayer game you're wanting to make (a simple turn based game like Words with Friends) or a complex multi-player RPG, it's really hard to advise you on the route you should take,

 

But I can say this, don't bite off more than you can chew. Since you're just learning Corona and Lua, take the time and build a bunch of small simple games and don't jump straight to the harder complex game. It can wait until your skills are ready.

 

Rob




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: help