VWarp is an SRB2 Lua library to allow for easy warping of HUD elements (scaling, moving).
Create a VWarp
object:
local VWarp = dofile("VWarp")
-- within a HUD hook
local warpv = VWarp(v, {
-- x/yscale set how much to stretch the element (default FU,FU (no scaling))
xscale = FU*2,
yscale = FU/2,
-- x/yorigin set what point to scale the element around (default 0,0 (upper left))
xorigin = 160*FU,
yorigin = 100*FU,
-- x/yoffset determine how much the element is shifted, independent of scale (default 0,0 (no movement))
xoffset = 130*FU,
yoffset = -50*FU
})
Then use it like you would v
:
warpv.drawString(20, 120, "Wow, it's a\x83 string!")
warpv.draw(30, 160, warpv.cachePatch("CHAOS4"))
(see Lua/test-readmedemo.lua for full code demo)