-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreadme
44 lines (26 loc) · 1.32 KB
/
readme
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# tilebg.lua v1.0
For Corona SDK
***
This creates a function tileBG() which will tile an image on the background of the display. It detects your display content height and attempts to calculate the minimum number of tiles needed (based on the size of the provided background tile.)
# USAGE
1) Include the function in your code (probably main.lua)
require( "tilebg" )
2) Now you can begin to use the function in your code.
local bg = tileBG() add a new background, use the default settings
The function takes 3 optional arguments:
bgImageFile - the filename of the background image to tile
bgWidth - the width of the bgImagefile
bgHeight - the height of the bgImagefile
Default values
If the function is run without any arguments then it will use these values:
bgImageFile = tileBG.jpg
bgWidth = 100
bgHeight = 100
In other words, you can quickly use this code if you have an image file called tileBG.jpg in your project folder, which is 100x100 pixels in size.
Its best to store the background in a local object, as demoed above:
local bg = tileBG()
Doing this, you can then use an build in method to self-destruct the tiles:
bg.removeBG()
Thats all there is to it. There is a full demo on the github repo. To make things easier, the function logs everything it does to the console...
# CHANGELOG
1.0 - First release