The code below:
Code: Select all
pGame:add(gooi.newButton("btn_shot", "Shot", 0, 0, 80, 50):onRelease(function() shotBullet() end), "b-r")
pGame:add(gooi.newButton("btn_bomb", "Bomb", 0, 0, 80, 50):onRelease(function() shotBomb() end), "b-r")
pGame:add(gooi.newJoy("joy_1"), "b-l")
pGame:add(gooi.newLabel("lbl_score", "Score: 0"), "t-l")
pGame:add(gooi.newBar("bar_1"):setLength(pGame.w / 3):increase(1), "t-r")
pGame:add(gooi.newLabel("lbl_life", "Life:"), "t-r")
The default spacing between components is 3px, this can be changed in layout.lua:3, and this applies for both grid and game layout.
.love for this demo: Please note, to use this (without problems) on your cellphone or tablet you need to remove the love.mousepressed/released functions and add the touchpressed,released and moved callbacks (https://bitbucket.org/MartinFelis/love- ... /wiki/Home) like this:
Code: Select all
--function love.mousepressed(x, y, button) gooi.pressed() end
--function love.mousereleased(x, y, button) gooi.released() end
function love.touchpressed(id, x, y, pressure) gooi.pressed(id, x, y) end
function love.touchreleased(id, x, y, pressure) gooi.released(id, x, y) end
function love.touchmoved(id, x, y, pressure) gooi.moved(id, x, y) end