phigros.tools

The device

phigrospp.texture(bytes)

A Texture2D of a png's or jpg's bytes.

local texture = phigrospp.texture(phigrospp.read(phigrospp.dir() .. "art.png"))
print(texture.width, texture.height) --> 1024	512
ParameterType
bytesstring

Returns Texture2D

phigrospp.share(text)

Android's share sheet for a text, the clipboard on iOS.

button("Share my RKS", function() phigrospp.share(("My RKS is %.2f"):format(rks())) end)
ParameterType
textstring

phigrospp.pick(...)

Android's file picker for mime types, from a button's function or a coroutine: waits and returns the file's bytes (32 MB at most) and name, nothing when the player backs out, nil and why when it can't be read.

button("Import a skin", function()
  local data, name = phigrospp.pick("application/zip", "application/octet-stream")
  if not data then return toast(name or "Nothing picked") end -- name is why it couldn't be read
  print(name, #data) --> skin.zip	2306842
end)
ParameterType
...stringmime types

Returns string? (data)

Returns string (name)

phigrospp.feature(name)

Whether the device has an Android hardware feature, false on iOS.

print(phigrospp.feature("android.hardware.telephony")) --> false on a tablet
ParameterType
namestring"android.hardware.telephony"

Returns boolean

phigrospp.frameRate(hz?)

Asks Android to keep the screen at this rate when idle, none for the fastest.

phigrospp.frameRate(120)
phigrospp.frameRate() -- the fastest the screen goes
ParameterType
hz?number

phigrospp.refreshRate()

The screen's rate now (Hz).

print(phigrospp.refreshRate()) --> 60.000003814697

Returns number

phigrospp.thermal()

Android's thermal status, 0 (none) to 6.

if phigrospp.thermal() >= 3 then toast("The device is hot") end

Returns integer

phigrospp.targetFrameRate()

The frame rate Unity aims for (Application.targetFrameRate can't be read on iOS).

print(phigrospp.targetFrameRate()) --> 240

Returns number

phigrospp.system()

The system and its version, "Android 14" or "iOS 17.5".

print(phigrospp.system()) --> Android 15

Returns string

phigrospp.platform

"android"|"ios"

phigrospp.busy()

Seconds Phigros++ ran on the game's thread since it started.

print(("%.1f s"):format(phigrospp.busy())) --> 147.7 s

Returns number

phigrospp.spent

table<string, number>

Seconds each mod's handlers and hooks took since load, by mod name.

phigrospp.hold(on, seconds, fn)

Runs fn once a finger stayed seconds where on says a point of the screen (pixels) is.

-- holding the pause button for half a second restarts the song
phigrospp.hold(function(x, y) return playing() and phigrospp.pauseButton(x, y) end, 0.5, phigrospp.restart)
ParameterType
onfun(x: number, y: number): boolean
secondsnumber
fnfun()