PicoPicoGameEngine

Quick Links

Button Object

ppbutton

ppbutton()

bt = ppbutton(title)
bt : ppbutton object

title : string

b=ppbutton("START GAME")
b.bgcolor = ppgraph.blue

function start()
  if b:idle() then
    ppgame:start(gameloop)
  end
  b:draw()
end

function gameloop()
  ppgraph:print("GAME LOOP")
end

:draw()

bt:draw()
bt : ppbutton object

:size()

size = bt:size()
bt : ppbutton object

size : retangle object

:layout()

bt:layout(auto,cx,cy,[rx],[ry],[rw],[rh])
bt : ppbutton object

b=ppbutton("GAME START")
b:layout(true,true,true)

function start()
  b:idle()
  b:draw()
end

:aabb()

aabb = bt:aabb()
bt : ppbutton object

aabb : rectangle object

:drawbg()

bt:drawbg(rect)
bt : ppbutton object

rect : rectangle object

:idle()

touch = bt:idle()
touch = bt:idle(point_array)
bt : ppbutton object

point_array : point object array

touch : boolean

  • true
  • false

.bgcolor

bt.bgcolor = color
color = bt.bgcolor
bt : ppbutton object

color : color object

b=ppbutton("GAME START")
b:layout(true,true,true)
b.bgcolor = nil

function start()
  ppgraph:fill(
    ppscreen:size(),
    ppgraph.blue)
  b:idle()
  b:draw()
end

.selectcolor

bt.selectcolor = color
color = bt.selectcolor
bt : ppbutton object

color : color object

.color

bt.color = color
color = bt.color
bt : ppbutton object

color : color object

.autolayout
.centerx
.centery
.layoutarea

bt.autolayout = flag
flag = bt.autolayout
bt.centerx = flag
flag = bt.centerx
bt.centery = flag
flag = bt.centery
bt.layoutarea = area
area = bt.layoutarea
bt : ppbutton object

flag : boolean

area : rectangle object

.bg.tile

bt.bg.tile = tile
tile = bt.bg.tile
bt : ppbutton object

tile : number

pptex:default(
  pptex:load("sample.png"))
b=ppbutton("TITLE")
b.bg.tile = 17
b.bg.edge = 4
function start()
  b:idle()
  b:draw()
end

.bg.texture

bt.bg.texture = texture
texture = bt.bg.texture
bt : ppbutton object

texture : texture object

.bg.edge

bt.bg.edge = edge
edge = bt.bg.edge
bt : ppbutton object

edge : number