Now let's play around with the font name.
You have now made your first complete mobile application! What's even more amazing is that this is a completed iPhone, iPad, and Android application. This two-line program will actually install and run on your iOS/Android device if you were to create a build. You have now seen what the basic workflow in Corona is like.
If you take a look at line 2 in your main.lua
file you will notice that setTextColor
alters the color of the text for Hello World!.
Colors are made up of three sets of RGB numbers representing the amount of red, green, and blue contained within a color. They are displayed with three numbers with values ranging from 0 to 255. For example, the color black would be ( 0,0,0 ), blue would be ( 0,0,255 ), and the color white ( 255,255,255 ).
Continue playing around with different color values to see the different results. You can see the alterations to the code in the simulator when you save your main.lua
file and re-launch Corona.
When you view the first line from the main.lua
file you will notice that newText()
is called by textObject
, a name that is then used to reference the display text. The newText()
function returns an object that will represent the text on the screen. newText
is part of the display library.
When you want to access the display property of newText
, type in display.newText
. The two numbers after Hello World!
control the horizontal and vertical positions of the text on the screen in pixels. The next item specifies the font. We used the name native.systemFont
, which by default refers to the standard font on the current device. For example, the iPhone's default font is Helvetica. You can use any standard font name such as Times New Roman
(used in the preceding example). The last number used is the font size.