PicoPicoGameEngine

Quick Links

Offscreen Object

ppoffscreen

Subclass of ppsprite.

.new()

image = ppoffscreen.new()
image_array = ppoffscreen.new(n)
image : ppoffscreen object

n : number

image_array : object

o=ppoffscreen.new()
o:create(100,100)
o:fill({10,10,32,32},ppgraph.red)
o:box({0,0,100,100},ppgraph.red)
o:circle({50,50},30,ppgraph.yellow)
o:paint({1,1},ppgraph.cyan)
o:paint({50,50},ppgraph.blue)
function start()
  o:draw()
end

:create()

image:create(width, heigth, [texture option])
image : ppoffscreen object

width : number

heigth : number

[texture option] : object

{
  linear=[Bilinear filter flag],
  wrap_s=[edge type string],
  wrap_t=[edge type string]
}

These are edge type strings.

  • linear
  • repeat
  • clamp_to_edge

See OpenGL GL_CLAMP_TO_EDGE, GL_LINEAR and GL_REPEAT.

:bind()

image:bind()
image : ppoffscreen object

o=ppoffscreen.new()
o:create(100,100)
o:fill(
  {10,10,32,32},ppgraph.red)
o:box(
  {0,0,100,100},ppgraph.red)
o:circle(
  {50,50},30,ppgraph.yellow)
o:paint(
  {1,1},ppgraph.cyan)
o:paint(
  {50,50},ppgraph.blue)
o:hflip()
o:bind()

s=ppsprite.new()
s:texture(o:texture())
s:tile(1)
s:tileSize(100,100)

function start()
  s:draw()
end

:lock()
:unlock()

image:lock()
image : ppoffscreen object

image:unlock([hold])
image : ppoffscreen object

[hold] : boolean/optional

pptex:default(
  pptex:load("sample.png"))
o=ppoffscreen.new()
o:create(100,100)
o:circle(
  {50,50},30,ppgraph.yellow)

o:lock()
ppgraph:put(34,34,2)
o:unlock()

o:paint(
  {50,10},ppgraph.yellow)
o:hflip()
o:bind()

s=ppsprite.new()
s:texture(o:texture())
s:tile(1)
s:tileSize(100,100)
s:scale(2)

function start()
  s:draw()
end

:pixel()

image:pixel(x,y,color)
image:pixel({x,y},color)
image:pixel(pos,color)
color = image:pixel(x,y)
color = image:pixel({x,y})
color = image:pixel(pos)
image : ppoffscreen object

x : number

y : number

pos : point object

color : color object

:line()

image:line(x1,y1,x2,y2,[color])
image:line({x1,y1},{x2,y2},[color])
image:line(pos1,pos2,[color])
image : ppoffscreen object

x1 : number

y1 : number

x2 : number

y2 : number

pos1 : point object

pos2 : point object

[color] : color object

:box()

image:box(x1,y1,x2,y2,[color])
image:box({x1,y1},{x2,y2},[color])
image:box(pos1,pos2,[color])
image : ppoffscreen object

x1 : number

y1 : number

x2 : number

y2 : number

pos1 : point object

pos2 : point object

[color] : color object

:fill()

image:fill(x1,y1,x2,y2,[color])
image:fill({x1,y1},{x2,y2},[color])
image:fill(pos1,pos2,[color])
image : ppoffscreen object

x1 : number

y1 : number

x2 : number

y2 : number

pos1 : point object

pos2 : point object

[color] : color object

:clear()

image:clear([color])
image : ppoffscreen object

[color] : color object/optional

:paint()

image:paint(x,y,[color])
image:paint({x,y},[color])
image:paint(pos,[color])
image : ppoffscreen object

x : number

y : number

pos : point object

[color] : color object/optional

:circle()

image:circle(x,y,r,[color],[start],[end])
image:circle({x,y},r,[color],[start],[end])
image:circle(pos,r,[color],[start],[end])
image : ppoffscreen object

x : number

y : number

pos : point object

r : number

[color] : color object/optional

[start] : number/optional

[end] : number/optional

:texture()

texture = image:texture()
image : ppoffscreen object

texture : texture object

:hflip()

image:hflip()
image : ppoffscreen object

:vflip()

image:vflip()
image : ppoffscreen object