I’m working on creating a visual novel engine. But, I’m having some problems with trying to align the text inside of an image. Any help would be appreciated.
local dialoguebox
t.drawdbox = function()
dialoguebox = display.newImageRect( “images/dialogue.png”, 1000, 200)
dialoguebox.x = display.contentCenterX
dialoguebox.y = display.contentHeight - dialoguebox.height/2
print(dialoguebox.y)
return dialoguebox
end
t.drawtext = function(dialoguebox)
local options =
{
text = “This is a test.”,
anchorX = 0,
anchorY = 1,
y = dialoguebox.y - dialoguebox.height/2,
x = 0,
width = 120, --required for multi-line and alignment
font = native.systemFont,
fontSize = 32
}
print(options.y)
local text = display.newText(options)
text:setFillColor(0.2,0.2,0.8)
return text
end
This is what I have but for some reason the actual text is slightly higher then the dialoguebox.