View Single Post
Old 11-09-2019, 05:02 AM   #2
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 2,989
Default

flags=1 centers the text between gfx.y and gfx.drawstr's right parameter. The bottom parameter must also be set for it to take effect.

Code:
-- https://i.imgur.com/Dht1Y7g.gif

local CENTER_H = 1
local CENTER_V = 4

function loop()
  gfx.x = 0
  gfx.drawstr("Hello World!", CENTER_H | CENTER_V, gfx.w, gfx.h)

  if gfx.getchar() >= 0 then
    reaper.defer(loop)
  end
end

gfx.init("", 400, 100)
gfx.setfont(1, "sans-serif", 24)
gfx.r, gfx.g, gfx.b = 1, 1, 1
loop()

Last edited by cfillion; 11-09-2019 at 05:37 AM.
cfillion is offline   Reply With Quote