-
Notifications
You must be signed in to change notification settings - Fork 3
Using all the libraries
#Using the whole set of Libraries
If after reading through all the features this library provides you have come here then that is Awesome!
Using this library as a set instead of as separated libraries is way easier. You just need to require material-love
inside love.load
(it needs access to the LÖVE modules)
local m
love.load = function ()
m = require "material-love"
end
Now you have access to all the modules inside material-love
To use shadows you can just call m.shadow
in your love.draw
function:
love.draw = function ()
m.shadow.draw(x,y,w,h,center,pad,depth)
end
The PatchObject is stored in m.shadow.patch
for you to access it methods and properties.
For more info on the parameters of the shadows check the Shadows page
The FAB draw function is mapped to the m.fab
function so it is pretty simple to use it too
love.draw = function ()
love.graphics.setColor(color)
m.fab(x,y,r,depth)
end
For more info on the parameters and why you should set the color to your desired color first, check the FAB page
The color module is available through the m.color
space, and all the functions are also exposed
m.color ("red","A200")
m.color.main ("cyan")
m.color.mono ("white","divider")
m.color.variations ("brown")
m.color.background ("dark")
m.color.list ()
For more info on each of this functions check the Colors page
You can create Ripple objects through the m.ripple
table with the appropriate functions
m.ripple.box(x,y,w,h,r,g,b,a,tim)
m.ripple.circle(x,y,ra,r,g,b,a,tim)
m.ripple.custom(f,fr,r,g,b,a,tim)
Also if for some reason you dont want to use the objects methods you can:
- Update them through the
m.ripple.update
function - Draw them through the
m.ripple.draw
function - Start a ripple on them through the
m.ripple.start
function - Fade the active ripple on them through the
m.ripple.fade
function
For info on each of this functions check the Ripples page
Accessing the roundrect
function is simple, it is in the m.roundrect
variable, the arguments are the same and the return value too.
Use it as you would do with roundrect
love.load = function ()
m = require "material-love"
p = m.roundrect(x,y,w,h,xr,yr,precission,{true,true,true,true})
end
love.draw = function ()
love.graphics.polygon("fill",unpack(p))
love.graphics.polygon("line",unpack(p))
end
For more info check the RoundedRectangle page.
The Roboto fonts are accessible through the m.roboto
table, though you can also use it as a function as you the normal roboto
table
love.graphics.setFont(m.roboto "body2")
love.graphics.setFont(m.roboto.title)
For more info check the Roboto page
Icons and DrawIcons are merged into a single table, called m.icons
with just two functions:
-
m.icons.get
which acts asicons
-
m.icons.draw
which acts asdrawicon
For access to the icon table we provide m.icons.table
which is a deep-copy of the icons table without the metatable.
Check the pages for DrawIcons and Icons for more info on these functions.
The Nine Patch library can be found on the m.nine
table. Using it is the same as using the nine.lua
file
local PatchImage = love.graphics.newImage("material-love/images/ninepatch.png")
m.nine.convert(PatchImage,"ninepatch",true)
local PatchTable = love.filesystem.load("ninepatch.lua")()()
PatchObject = m.nine.process(PatchTable)
m.nine.draw(PatchObject,x,y,w,h,center,pad,image)
For more info on these functions check the Nine Patch page which explains them in detail
I hope this can be useful to you, if you have doubts dont doubt to ask me, you can use the Issue Tracker (check the Guidelines), the LÖVE forums (which I check periodically) and you can send me a mail (you can find my e-mail here)