Page 1 of 1

Help adding image to dialog box

Posted: Sat Apr 25, 2015 12:02 pm
by Overlord
Hello just a quick one when making dialog windows is there an easy way to add an image to spruce up the dialog?


i see this being used but i dont know how to use it. i have a simple PNG image and ive pointed the file="" to it still i cant see it in game.

local Image = require "engine.ui.Image"

image = Image.new{file="lore/"..l.image, auto_width=true, auto_height=true}

Re: Help adding image to dialog box

Posted: Sat Apr 25, 2015 12:16 pm
by Overlord
ok sorry figured it out if anyone interested its

--add this to the other locals at the top
local Image = require "engine.ui.Image"

--add this somewhere in init
self.image = Image.new{file="locationOfFile.png", auto_width=true, auto_height=true}

--add this to the bottom of the dialog file
function _M:innerDisplay(x, y, nb_keyframes)
if self.image then
self.image:display(x + self.iw - self.image.w, y + self.ih - self.image.h)
end
end

that seemed to work :)