PicoPicoGameEngine

Quick Links

Source Code

g=ppgraph

ppfont:set("half")

obj={}

function create(col)
  local o
  o=ppoffscreen.new()
  o:create(100,100)
  o:fill(o:size(),col)
  local t
  t=g:layout(
    o:size(),true,true)
  o:pos(t)
  table.insert(obj,1,o)
  return o
end

o0=create(g.cyan)

c=o0:size()/2
c.x=c.width
c.y=c.height

d=pprect()
d:pos(o0:pos())
d:move(-2,-2)
d:size(4,4)

a=o0:aabb()

o1=create(g.green)
o1:scale(2,2)

o2=create(g.blue)
o2:scale(4,4)

p=ppoffscreen.new()
p:create(4,4)
p:fill(p:size(),g.red)
t=g:layout(p:size(),true,true)
p:pos(t)

function start()
  pv=c+p:pos()-t
  q=o0:rotate()
  q=q+0.01

  for i,o in ipairs(obj)
  do
    o:pivot(pv)
    o:rotate(q)
    o:draw()
  end

  p:drag(pptouch())
  p:draw()
  g:fill(d)
  g:box(a)
  g:pos(p:pos())
  g:move(0,4)
  h="pivot("..pv.x..","..pv.y
  h=h..")"
  g:print(h)
  g:pos(a)
  g:move(0,a.height)
  g:print("size 100x100")
end