PicoPicoGameEngine

Quick Links

Font Object

ppfont

:loadTTF()

ppfont:loadTTF( ttffont, fontname, size)
ttffont : string

fontname : string

size : number

fn="MikachanPB.ttf"
nm32="mikachan32"
ppfont:loadTTF(fn,nm32,32)
nm64="mikachan64"
ppfont:loadTTF(fn,nm64,64)
g=ppgraph
function start()
  g:pos(0,0)
  ppfont:set(nm64)
  g:print("DotEDITOR")
  g:move(0,64)
  ppfont:set(nm32)
  g:print("PicoPicoGames")
end

:loadTexture()

ppfont:loadTexture(texture, fontname, width, height)
ppfont:loadTexture(imagefile, fontname, width, height)
texture : texture object

imagefile : string

fontname : string

width : number

height : number

fn="font8x8.png"
nm="8bit font"
ppfont:loadTexture(
  fn,nm,8,8,4,4)
g=ppgraph
function start()
  g:fill(ppscreen:size()
   ,g.blue)

  ppfont:set(nm)

  g:pos(0,0)
  g:print("ABCDEFG")

  g:move(0,32)
  g:print("あいうえお")

  g:tileSize(128,256)
  tx=ppfont:texture()
  g:put(0,64,1,tx)
  tx.size:pos(0,64)
  g:box(tx.size)
end

:set()

ppfont:set(fontname)
fontname : string

function start()
  ppfont:set("default")
  ppgraph:print("HELLO")
  ppgraph:move(0,ppfont:height())
  ppfont:set("mini")
  ppgraph:print("HELLO")
  ppgraph:move(0,ppfont:height())
  ppfont:set("half")
  ppgraph:print("HELLO")
end

:height()

height = ppfont:height()
height : number

:width()

width = ppfont:width(string)
string : string

width : number

:size()

size = ppfont:size(string)
string : string

size : rectangle object

g=ppgraph
function start()
  local s="HELLO WORLD"
  g:pos(
   g:layout(
    ppfont:size(s),true,true))
  g:print(s)
  local z=ppfont:size(s)
  g:box(z:pos(g:pos()))
end

:texture()

texture = ppfont:texture()
texture : texture object