GUI Label Issue
GUI Label Issue
GUI labels are cut off and only extend to the proper length after you save the game and then load it... but if you start a new game again, the label's horizontal size gets trimmed again. Is there anyway around this or a bug?
Factorio Modder
Solar Expansion
Solar Expansion
Re: GUI Label Issue
This is a bug (thank you for the report), Do you have some simple piece of code that shows it?
(My labels are working correctly, but I'm probably using it differently)
(My labels are working correctly, but I'm probably using it differently)
Re: GUI Label Issue
This is code to display a digital clock for a new mod I'm working on... contained within my "control.lua":kovarex wrote:This is a bug (thank you for the report), Do you have some simple piece of code that shows it?
(My labels are working correctly, but I'm probably using it differently)
Code: Select all
require "defines"
game.oninit(function()
game.player.gui.left.add{
type="label",
name="label_time",
caption="time"
}
end)
game.onevent(defines.events, function(event)
if event.name == defines.events.ontick then
game.player.gui.left.label_time.font = {
color = {r=1, g=1, b=1},
bold = true
}
-- format time
local time = game.getdaytime()
time = time + 0.5
if time > 1 then
time = time - 1
end
-- format hour
local hour = math.floor(time * 24)
local meridiem = "AM"
if hour > 12 then
hour = hour - 12
meridiem = "PM"
end
-- format minute
--local minute = math.floor(60 * ((time * 24) - (time * 24)))
local minute = math.floor(60 * ((time * 24) - math.floor(time * 24)))
if minute < 10 then
minute = "0" .. minute
end
-- display time
game.player.gui.left.label_time.caption =
hour .. ":" .. minute .. " " .. meridiem
end
end)
Factorio Modder
Solar Expansion
Solar Expansion