Re: Löve Frames - A GUI Library
Posted: Fri Apr 18, 2014 3:16 pm
From what I've seen ImageButton doesn't have the ability to use a different image for highlighted and pressed state ?
I guess I wanted the text to be drawn internally when I initially wrote the object, I'm not really sure though. Regardless, that code should probably be moved to the skin files to make text rendering easier to customize.ixjf wrote:Is there any specific reason why the text object's method "DrawText" is in the object file rather than in the skin?
Correct, though that kind of functionality would not be difficult to implement.Mercurialol wrote:From what I've seen ImageButton doesn't have the ability to use a different image for highlighted and pressed state ?
Code: Select all
if object.hover then
if love.mouse.isDown("l") == false and object:GetImage() ~= hover then object:SetImage(hover)
elseif object:GetImage() ~= clicked then object:SetImage(clicked)
end
elseif object:GetImage() ~= normal then object:SetImage(normal)
end
Good idea. I'll look into implementing that when I have some spare time.Abisso wrote:Speaking of ImageButton, it would be also very useful if we could set the size (scale) of the button itself.
Thank you for the kind words.Abisso wrote: And now that it can't be misjudged any more as a "captatio benevolentiae", let me spend at least a few words to thank you for your excellent work, Nikolai. Not only I would have never got this far without your Loveframes, but, to be frank, I wouldn't have probably even started. You offered an incredibly useful and versatile set of functions, and combined that with a good documentation and support here on the boards.
You have my utmost gratitude and profound respect for that.
I made this function for scaling images in different modes, there is:Nikolai Resokav wrote: Good idea. I'll look into implementing that when I have some spare time.
Code: Select all
imagen = function (typ, image, vx, vy, w, h)
local typ = typ:lower()
local width, height = image:getDimensions()
local scale, offset
if not(typ == "expand" or typ == "center") then
local scl
if h/height > w/width then
if typ == "fit" then scl = w/width elseif typ == "fill" then scl = h/height end
else
if typ == "fit" then scl = h/height elseif typ == "fill" then scl = w/width end
end
scale = {x = scl, y = scl}
offset = {
x = (w - width*scale.x) / 2;
y = (h - height*scale.y) / 2
}
elseif typ == "expand" then
scale = {
x = w/width;
y = h/height
}
offset = {x = 0, y = 0}
elseif typ == "center" then
scale = {x = 1, y = 1}
offset = {
x = (w - width) / 2;
y = (h - width) / 2
}
end
if not (offset and scale) then return end
return function(r, sx, sy, ox, oy, kx, ky)
local r, ox, oy, sx, sy, kx, ky = r or 0, ox or 0, oy or 0, sx or 1, sy or 1, kx or 0, ky or 0
love.graphics.draw(image, vx + offset.x, vy + offset.y, r, scale.x * sx, scale.y * sy, ox, oy, kx, ky)
end
end
As you can see, Loveframes' author writes in this thread very often (he's Nikolai Resokav). Last time he did (29th of April) he said:khamarr3524 wrote:Is this library still being maintained or planned to be updated to 0.9.1?
So, of course it's still maintained. As per the update, as far as I know there's no need to upgrade anything: the library should work out of the box with 0.9.1.Nikolai Resokav wrote:Good idea. I'll look into implementing that when I have some spare time.Abisso wrote:Speaking of ImageButton, it would be also very useful if we could set the size (scale) of the button itself.
AlexYeCu wrote:Any plans of making Android version?