summaryrefslogtreecommitdiffhomepage
path: root/not
diff options
context:
space:
mode:
Diffstat (limited to 'not')
-rw-r--r--not/Selector.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/not/Selector.lua b/not/Selector.lua
index 9083b24..1c13e76 100644
--- a/not/Selector.lua
+++ b/not/Selector.lua
@@ -74,6 +74,10 @@ function Selector:isUnique ()
return true
end
+function Selector:getText ()
+ return tostring(self:getSelected())
+end
+
function Selector:focus ()
self.focused = true
return true
@@ -83,4 +87,23 @@ function Selector:blur ()
self.focused = false
end
+-- TODO: Temporary function to determine quad to use. Will be obsolete when BoxElement will be done. See also `not/Element@getSize`.
+function Selector:getShapeString ()
+ if self.shape == Selector.SHAPE_PORTRAIT then
+ return "portrait"
+ end
+ if self.shape == Selector.SHAPE_PANORAMA then
+ return "panorama"
+ end
+end
+
+function Selector:draw (scale)
+ local x, y = self:getPosition()
+ local w, h = self:getSize()
+ love.graphics.setColor(255, 255, 255, 255)
+ love.graphics.draw(self.atlas, self.quads[self:getShapeString()].normal, x*scale, y*scale, 0, scale, scale)
+ love.graphics.setFont(Font)
+ love.graphics.printf(self:getText(), (x-w)*scale, (y+h+1)*scale, w*3, "center", 0, scale, scale)
+end
+
return Selector