i'm currently trying to write a small and efficient GUI lib for LÖVE, and i'm struggling with something that i thought would be simple to do at first but ... it isn't
so basically i consider all my GUI elements to be boxes, with a specified width and height, border size, and border radius (i was inspired by CSS, maybe, :p).
what i want to to is drawing the borders inside the box, so i thought of a very simple script that (imo) would have done that :
Code: Select all
love.draw = function()
local x, y = 0, 0
local width, height = 100, 100
local border_width = 10
local border_radius = 10
-- draw the box
love.graphics.setColor({127,127,127})
love.graphics.rectangle( "fill", x, y, width, height, border_radius, border_radius)
-- draw the borders
love.graphics.setLineWidth(border_width)
love.graphics.setColor({255, 0, 0})
love.graphics.rectangle( "line", x, y, width, height, border_radius, border_radius)
end
Is there a flexible way to achieve that result ? If a guru visits this, i'd like to have tips about handling borders like css do (https://www.w3.org/TR/css3-background/# ... der-radius)
Thank you for your time and help