ToME: the Tales of Maj'Eyal
http://forums.te4.org/

Help adding image to dialog box
http://forums.te4.org/viewtopic.php?f=40&t=44312
Page 1 of 1

Author:  Overlord [ Sat Apr 25, 2015 12:02 pm ]
Post subject:  Help adding image to dialog box

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}

Author:  Overlord [ Sat Apr 25, 2015 12:16 pm ]
Post subject:  Re: Help adding image to dialog box

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 :)

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/