Page 1 of 1

simple image style for button...

Posted: Sun Nov 16, 2014 10:39 am
by noisy
I cant figure it out yet... how One adds picture to a gui button?

gui example:

Code: Select all

game.oninit(function()
   td_gui = game.player.gui.left.add{type='frame', name='statistics', caption='statistics', direction='vertical'}
	td_gui.add{type='button', name='turret', caption="turret", colspan=2}
	td_gui.add{type='button', name='laser', caption="laser", colspan=2}
end)

game.onevent(defines.events.onguiclick, function(event)
	if event.element.name == "turret" then
		game.player.insert({name="gun-turret", count="1"})
	end

	if event.element.name == "laser" then
		game.player.insert({name="laser-turret", count="1"})
	end
end)
i want those 2 buttons have corresponding images on them.. gun-turret and laser-turret.