Stipulating directories with geyser setStyleSheet properties

User avatar
kevutian
Posts: 217
Joined: Fri Aug 20, 2010 8:18 pm
Location: United Kingdom
Contact:

Re: Stipulating directories with geyser setStyleSheet proper

Post by kevutian »

What I use:
Code: [show] | [select all] lua
function ui.loader()

	local separator = string.char(getMudletHomeDir():byte()) == "/" and "/" or "\\"
	local image_dir = (getMudletHomeDir() .. separator .. "ccc" .. separator .. "images" .. separator):gsub("\\","/")

	ui.labels.loader = Geyser.Label:new({
		name = "ui.labels.loader",
		x = "0%", y = "0%",
		width = "100%", height = "100%"
	}, ui.containers.main)

	ui.labels.loader:setStyleSheet([[
		border-image: url("]] .. image_dir .. [[loader.png");
	]])
end

User avatar
Akaya
Posts: 414
Joined: Thu Apr 19, 2012 1:36 am

Re: Stipulating directories with geyser setStyleSheet proper

Post by Akaya »

This is what I use in my GUI scripts to grab the image path. 'My Image Folder' is the name of the folder you put your images in (if any)
Code: [show] | [select all] lua
image_path = getMudletHomeDir():gsub("\\","/").."/My Image Folder/"
As for the stylesheet...
Code: [show] | [select all] lua
border-image: url("]].. image_path .. [[MyImageName.png");

Post Reply