Help adding image to dialog box

If you have a module that you'd like comments on or would like to know how to create your very own module, post here

Moderator: Moderator

Post Reply
Message
Author
Overlord
Yeek
Posts: 10
Joined: Sun Mar 03, 2013 3:07 pm

Help adding image to dialog box

#1 Post 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}

Overlord
Yeek
Posts: 10
Joined: Sun Mar 03, 2013 3:07 pm

Re: Help adding image to dialog box

#2 Post 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 :)

Post Reply