From 5156ca3ca5a408752e82eb8e4e7dcc08d51798c8 Mon Sep 17 00:00:00 2001 From: Kenny Shields Date: Fri, 24 Jan 2014 22:48:42 -0500 Subject: [PATCH] Position closebuttons automatically --- objects/internal/closebutton.lua | 6 ++++++ skins/Blue/skin.lua | 3 --- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/objects/internal/closebutton.lua b/objects/internal/closebutton.lua index d42685f..1782980 100644 --- a/objects/internal/closebutton.lua +++ b/objects/internal/closebutton.lua @@ -18,6 +18,7 @@ function newobject:initialize() self.internal = true self.hover = false self.down = false + self.autoposition = true self.OnClick = function() end -- apply template properties to the object @@ -61,6 +62,11 @@ function newobject:update(dt) self.hover = true end + if self.autoposition then + self.staticx = self.parent.width - self.width - 4 + self.staticy = 4 + end + -- move to parent if there is a parent if parent ~= base then self.x = parent.x + self.staticx diff --git a/skins/Blue/skin.lua b/skins/Blue/skin.lua index e8acb6a..f2b791c 100644 --- a/skins/Blue/skin.lua +++ b/skins/Blue/skin.lua @@ -371,9 +371,6 @@ function skin.DrawCloseButton(object) love.graphics.draw(image, x, y) end - object:SetPos(parentwidth - 20, 4) - object:SetSize(16, 16) - end --[[---------------------------------------------------------