mirror of
https://github.com/linux-man/LoveFrames.git
synced 2024-11-18 16:04:22 +00:00
Version 0.9.5.1 - Alpha (see changelog.txt)
This commit is contained in:
parent
b0bd3a33cc
commit
d1826e7f22
@ -1,3 +1,24 @@
|
||||
================================================
|
||||
Version 0.9.5.1 - Alpha (February 17 - 2013)
|
||||
================================================
|
||||
[ADDED] a new slider method: SetScrollable(bool)
|
||||
[ADDED] a new slider method: GetScrollable()
|
||||
[ADDED] a new slider method: SetScrollIncrease(increase)
|
||||
[ADDED] a new slider method: GetScrollIncrease()
|
||||
[ADDED] a new slider method: SetScrollDecrease(decrease)
|
||||
[ADDED] a new slider method: GetScrollDecrease()
|
||||
[ADDED] a new multichoice method: Sort(func)
|
||||
[ADDED] a new multichoice method: SetSortFunction(func)
|
||||
[ADDED] a new multichoice method: GetSortFunction()
|
||||
[ADDED] support for scrolling the slider object with the mouse wheel
|
||||
|
||||
[FIXED] the slider event callback "OnValueChanged" not passing the slider's new value in certain situations
|
||||
[FIXED] some typos in the changelog
|
||||
|
||||
[CHANGED] the default mouse wheel scroll amounts of the scrollable objects (list, columnlist, tabs, multichoice)
|
||||
[CHANGED] minor modifications to the default skins
|
||||
[CHANGED] objects can now be centered when using the base methods SetPos, SetX, and SetY (ex: object:SetPos(x, y, true) would center the object at the position specified by x and y)
|
||||
|
||||
================================================
|
||||
Version 0.9.5 - Alpha (February 11 - 2013)
|
||||
================================================
|
||||
@ -190,26 +211,26 @@ Version 0.9.4.2 - Alpha (November 5 - 2012)
|
||||
================================================
|
||||
[ADDED] a new text object method: SetIgnoreNewlines(bool)
|
||||
[ADDED] a new text object method: GetIgnoreNewlines()
|
||||
[ADDED] a new text image method: SetOrientation(orientation)
|
||||
[ADDED] a new text image method: GetOrientation()
|
||||
[ADDED] a new text image method: SetScaleX(scalex)
|
||||
[ADDED] a new text image method: GetScaleX()
|
||||
[ADDED] a new text image method: SetScaleY(scaley)
|
||||
[ADDED] a new text image method: GetScaleY()
|
||||
[ADDED] a new text image method: SetScale(scalex, scaley)
|
||||
[ADDED] a new text image method: GetScale()
|
||||
[ADDED] a new text image method: SetOffsetX(x)
|
||||
[ADDED] a new text image method: GetOffsetX()
|
||||
[ADDED] a new text image method: SetOffsetY(y)
|
||||
[ADDED] a new text image method: GetOffsetY()
|
||||
[ADDED] a new text image method: SetOffset(x, y)
|
||||
[ADDED] a new text image method: GetOffset()
|
||||
[ADDED] a new text image method: SetShearX(x)
|
||||
[ADDED] a new text image method: GetShearX()
|
||||
[ADDED] a new text image method: SetShearY(y)
|
||||
[ADDED] a new text image method: GetShearY()
|
||||
[ADDED] a new text image method: SetShear(x, y)
|
||||
[ADDED] a new text image method: GetShear()
|
||||
[ADDED] a new image method: SetOrientation(orientation)
|
||||
[ADDED] a new image method: GetOrientation()
|
||||
[ADDED] a new image method: SetScaleX(scalex)
|
||||
[ADDED] a new image method: GetScaleX()
|
||||
[ADDED] a new image method: SetScaleY(scaley)
|
||||
[ADDED] a new image method: GetScaleY()
|
||||
[ADDED] a new image method: SetScale(scalex, scaley)
|
||||
[ADDED] a new image method: GetScale()
|
||||
[ADDED] a new image method: SetOffsetX(x)
|
||||
[ADDED] a new image method: GetOffsetX()
|
||||
[ADDED] a new image method: SetOffsetY(y)
|
||||
[ADDED] a new image method: GetOffsetY()
|
||||
[ADDED] a new image method: SetOffset(x, y)
|
||||
[ADDED] a new image method: GetOffset()
|
||||
[ADDED] a new image method: SetShearX(x)
|
||||
[ADDED] a new image method: GetShearX()
|
||||
[ADDED] a new image method: SetShearY(y)
|
||||
[ADDED] a new image method: GetShearY()
|
||||
[ADDED] a new image method: SetShear(x, y)
|
||||
[ADDED] a new image method: GetShear()
|
||||
|
||||
[FIXED] an error that occurred after pressing enter on a multiline text input while all of it's text was selected
|
||||
[FIXED] text in a single line text input always being cleared when the enter key was pressed
|
||||
|
@ -600,7 +600,7 @@ function loveframes.debug.ExamplesMenu()
|
||||
local progressbar1 = loveframes.Create("progressbar", frame1)
|
||||
progressbar1:SetPos(5, 30)
|
||||
progressbar1:SetWidth(490)
|
||||
progressbar1:SetLerpRate(1)
|
||||
progressbar1:SetLerpRate(10)
|
||||
|
||||
local button1 = loveframes.Create("button", frame1)
|
||||
button1:SetPos(5, 60)
|
||||
@ -628,6 +628,7 @@ function loveframes.debug.ExamplesMenu()
|
||||
slider1:SetText("Progressbar lerp rate")
|
||||
slider1:SetMinMax(0, 50)
|
||||
slider1:SetDecimals(0)
|
||||
slider1:SetValue(10)
|
||||
slider1.OnValueChanged = function(object2, value)
|
||||
progressbar1:SetLerpRate(value)
|
||||
end
|
||||
@ -747,7 +748,7 @@ function loveframes.debug.ExamplesMenu()
|
||||
exampleslist:AddItem(textexample)
|
||||
|
||||
------------------------------------
|
||||
-- text input example
|
||||
-- textinput example
|
||||
------------------------------------
|
||||
local textinputexample = loveframes.Create("button")
|
||||
textinputexample:SetText("Text Input")
|
||||
@ -820,4 +821,6 @@ function loveframes.debug.SkinSelector()
|
||||
skinslist:AddChoice(v.name)
|
||||
end
|
||||
|
||||
skinslist:Sort()
|
||||
|
||||
end
|
2
init.lua
2
init.lua
@ -9,7 +9,7 @@ loveframes = {}
|
||||
-- library info
|
||||
loveframes.info = {}
|
||||
loveframes.info.author = "Kenny Shields"
|
||||
loveframes.info.version = "0.9.5"
|
||||
loveframes.info.version = "0.9.5.1"
|
||||
loveframes.info.stage = "Alpha"
|
||||
|
||||
-- library configurations
|
||||
|
@ -221,14 +221,21 @@ end
|
||||
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetPos(x, y)
|
||||
- func: SetPos(x, y, center)
|
||||
- desc: sets the object's position
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetPos(x, y)
|
||||
function newobject:SetPos(x, y, center)
|
||||
|
||||
local base = loveframes.base
|
||||
local parent = self.parent
|
||||
|
||||
if center then
|
||||
local width = self.width
|
||||
local height = self.height
|
||||
x = x - width/2
|
||||
y = y - height/2
|
||||
end
|
||||
|
||||
if parent == base then
|
||||
self.x = x
|
||||
self.y = y
|
||||
@ -240,14 +247,19 @@ function newobject:SetPos(x, y)
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetX(x)
|
||||
- func: SetX(x, center)
|
||||
- desc: sets the object's x position
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetX(x)
|
||||
function newobject:SetX(x, center)
|
||||
|
||||
local base = loveframes.base
|
||||
local parent = self.parent
|
||||
|
||||
if center then
|
||||
local width = self.width
|
||||
x = x - width/2
|
||||
end
|
||||
|
||||
if parent == base then
|
||||
self.x = x
|
||||
else
|
||||
@ -257,14 +269,19 @@ function newobject:SetX(x)
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetY(y)
|
||||
- func: SetY(y, center)
|
||||
- desc: sets the object's y position
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetY(y)
|
||||
function newobject:SetY(y, center)
|
||||
|
||||
local base = loveframes.base
|
||||
local parent = self.parent
|
||||
|
||||
if center then
|
||||
local height = self.height
|
||||
y = y - height/2
|
||||
end
|
||||
|
||||
if parent == base then
|
||||
self.y = y
|
||||
else
|
||||
|
@ -17,7 +17,7 @@ function newobject:initialize()
|
||||
self.height = 100
|
||||
self.columnheight = 16
|
||||
self.buttonscrollamount = 200
|
||||
self.mousewheelscrollamount = 1000
|
||||
self.mousewheelscrollamount = 1500
|
||||
self.autoscroll = false
|
||||
self.dtscrolling = true
|
||||
self.internal = false
|
||||
|
@ -25,7 +25,7 @@ function newobject:initialize()
|
||||
self.extrawidth = 0
|
||||
self.extraheight = 0
|
||||
self.buttonscrollamount = 200
|
||||
self.mousewheelscrollamount = 1000
|
||||
self.mousewheelscrollamount = 1500
|
||||
self.internal = false
|
||||
self.hbar = false
|
||||
self.vbar = false
|
||||
|
@ -20,7 +20,8 @@ function newobject:initialize()
|
||||
self.listpadding = 0
|
||||
self.listspacing = 0
|
||||
self.buttonscrollamount = 200
|
||||
self.mousewheelscrollamount = 1000
|
||||
self.mousewheelscrollamount = 1500
|
||||
self.sortfunc = function(a, b) return a < b end
|
||||
self.haslist = false
|
||||
self.dtscrolling = true
|
||||
self.internal = false
|
||||
@ -334,4 +335,41 @@ function newobject:GetDTScrolling()
|
||||
|
||||
return self.dtscrolling
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: Sort(func)
|
||||
- desc: sorts the object's choices
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:Sort(func)
|
||||
|
||||
local default = self.sortfunc
|
||||
|
||||
if func then
|
||||
table.sort(self.choices, func)
|
||||
else
|
||||
table.sort(self.choices, default)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetSortFunction(func)
|
||||
- desc: sets the object's default sort function
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetSortFunction(func)
|
||||
|
||||
self.sortfunc = func
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: GetSortFunction(func)
|
||||
- desc: gets the object's default sort function
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:GetSortFunction()
|
||||
|
||||
return self.sortfunc
|
||||
|
||||
end
|
||||
|
@ -21,6 +21,9 @@ function newobject:initialize()
|
||||
self.min = 0
|
||||
self.value = 0
|
||||
self.decimals = 5
|
||||
self.scrollincrease = 1
|
||||
self.scrolldecrease = 1
|
||||
self.scrollable = true
|
||||
self.internal = false
|
||||
self.internals = {}
|
||||
self.OnValueChanged = nil
|
||||
@ -72,10 +75,13 @@ function newobject:update(dt)
|
||||
end
|
||||
|
||||
if sliderbutton then
|
||||
if self.slidetype == "horizontal" then
|
||||
self.height = sliderbutton.height
|
||||
elseif self.slidetype == "vertical" then
|
||||
self.width = sliderbutton.width
|
||||
local slidetype = self.slidetype
|
||||
local buttonwidth = sliderbutton.width
|
||||
local buttonheight = sliderbutton.height
|
||||
if slidetype == "horizontal" then
|
||||
self.height = buttonheight
|
||||
elseif slidetype == "vertical" then
|
||||
self.width = buttonwidth
|
||||
end
|
||||
end
|
||||
|
||||
@ -155,9 +161,12 @@ function newobject:mousepressed(x, y, button)
|
||||
end
|
||||
|
||||
local internals = self.internals
|
||||
local hover = self.hover
|
||||
local slidetype = self.slidetype
|
||||
local scrollable = self.scrollable
|
||||
|
||||
if self.hover and button == "l" then
|
||||
if self.slidetype == "horizontal" then
|
||||
if hover and button == "l" then
|
||||
if slidetype == "horizontal" then
|
||||
local xpos = x - self.x
|
||||
local button = internals[1]
|
||||
local baseparent = self:GetBaseParent()
|
||||
@ -169,7 +178,7 @@ function newobject:mousepressed(x, y, button)
|
||||
button.dragging = true
|
||||
button.startx = button.staticx
|
||||
button.clickx = x
|
||||
elseif self.slidetype == "vertical" then
|
||||
elseif slidetype == "vertical" then
|
||||
local ypos = y - self.y
|
||||
local button = internals[1]
|
||||
local baseparent = self:GetBaseParent()
|
||||
@ -182,7 +191,18 @@ function newobject:mousepressed(x, y, button)
|
||||
button.starty = button.staticy
|
||||
button.clicky = y
|
||||
end
|
||||
elseif hover and scrollable and button == "wu" then
|
||||
local value = self.value
|
||||
local increase = self.scrollincrease
|
||||
local newvalue = value + increase
|
||||
self:SetValue(newvalue)
|
||||
elseif hover and scrollable and button == "wd" then
|
||||
local value = self.value
|
||||
local decrease = self.scrolldecrease
|
||||
local newvalue = value - decrease
|
||||
self:SetValue(newvalue)
|
||||
end
|
||||
|
||||
|
||||
for k, v in ipairs(internals) do
|
||||
v:mousepressed(x, y, button)
|
||||
@ -231,7 +251,7 @@ function newobject:SetValue(value)
|
||||
|
||||
-- call OnValueChanged
|
||||
if onvaluechanged then
|
||||
onvaluechanged(self)
|
||||
onvaluechanged(self, newval)
|
||||
end
|
||||
|
||||
end
|
||||
@ -406,4 +426,70 @@ function newobject:GetSlideType()
|
||||
|
||||
return self.slidetype
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetScrollable(bool)
|
||||
- desc: sets whether or not the object can be scrolled
|
||||
via the mouse wheel
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetScrollable(bool)
|
||||
|
||||
self.scrollable = bool
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: GetScrollable()
|
||||
- desc: gets whether or not the object can be scrolled
|
||||
via the mouse wheel
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:GetScrollable()
|
||||
|
||||
return self.scrollable
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetScrollIncrease(increase)
|
||||
- desc: sets the amount to increase the object's value
|
||||
by when scrolling with the mouse wheel
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetScrollIncrease(increase)
|
||||
|
||||
self.scrollincrease = increase
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: GetScrollIncrease()
|
||||
- desc: gets the amount to increase the object's value
|
||||
by when scrolling with the mouse wheel
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:GetScrollIncrease()
|
||||
|
||||
return self.scrollincrease
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetScrollDecrease(decrease)
|
||||
- desc: sets the amount to decrease the object's value
|
||||
by when scrolling with the mouse wheel
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetScrollDecrease(decrease)
|
||||
|
||||
self.scrolldecrease = decrease
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: GetScrollDecrease()
|
||||
- desc: gets the amount to decrease the object's value
|
||||
by when scrolling with the mouse wheel
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:GetScrollDecrease()
|
||||
|
||||
return self.scrolldecrease
|
||||
|
||||
end
|
@ -24,7 +24,7 @@ function newobject:initialize()
|
||||
self.tabheight = 25
|
||||
self.previoustabheight = 25
|
||||
self.buttonscrollamount = 200
|
||||
self.mousewheelscrollamount = 5
|
||||
self.mousewheelscrollamount = 1500
|
||||
self.autosize = true
|
||||
self.dtscrolling = true
|
||||
self.internal = false
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
## Information
|
||||
|
||||
Love Frames is a GUI library for [LOVE](https://love2d.org/). For information on installation and usage, please visit the [wiki](http://nikolairesokav.com/documents/?page=loveframes/main). A demo of the library can be found at: http://nikolairesokav.com/projects/loveframes/
|
||||
Love Frames is a GUI library for [LÖVE](https://love2d.org/). For information on installation and usage, please visit the [wiki](http://nikolairesokav.com/documents/?page=loveframes/main). A demo of the library can be found at: http://nikolairesokav.com/projects/loveframes/
|
||||
|
||||
## License
|
||||
|
||||
|
@ -32,7 +32,7 @@ function loveframes.skins.Register(skin)
|
||||
loveframes.util.Error("Could not register skin: Invalid or missing author data.")
|
||||
end
|
||||
|
||||
if version == "" or version == nil then
|
||||
if version == "" or not version then
|
||||
loveframes.util.Error("Could not register skin: Invalid or missing version data.")
|
||||
end
|
||||
|
||||
@ -48,12 +48,10 @@ function loveframes.skins.Register(skin)
|
||||
loveframes.skins.available[name].dir = dir
|
||||
loveframes.skins.available[name].images = {}
|
||||
|
||||
if #images > 0 and indeximages == true then
|
||||
|
||||
if #images > 0 and indeximages then
|
||||
for k, v in ipairs(images) do
|
||||
loveframes.skins.available[name].images[v.name .. "." .. v.extension] = love.graphics.newImage(v.fullpath)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -334,7 +334,6 @@ function skin.DrawCloseButton(object)
|
||||
|
||||
local x = object:GetX()
|
||||
local y = object:GetY()
|
||||
local staticx = object:GetStaticX()
|
||||
local width = object:GetWidth()
|
||||
local height = object:GetHeight()
|
||||
local parentwidth = object.parent:GetWidth()
|
||||
@ -361,9 +360,8 @@ function skin.DrawCloseButton(object)
|
||||
love.graphics.draw(image, x, y)
|
||||
end
|
||||
|
||||
if staticx ~= (parentwidth - 20) then
|
||||
object:SetPos(parentwidth - 20, 4)
|
||||
end
|
||||
object:SetPos(parentwidth - 20, 4)
|
||||
object:SetSize(16, 16)
|
||||
|
||||
end
|
||||
|
||||
|
@ -363,7 +363,6 @@ function skin.DrawCloseButton(object)
|
||||
|
||||
local x = object:GetX()
|
||||
local y = object:GetY()
|
||||
local staticx = object:GetStaticX()
|
||||
local parent = object.parent
|
||||
local parentwidth = parent:GetWidth()
|
||||
local hover = object:GetHover()
|
||||
@ -389,9 +388,8 @@ function skin.DrawCloseButton(object)
|
||||
love.graphics.draw(image, x, y)
|
||||
end
|
||||
|
||||
if staticx ~= (parentwidth - 20) then
|
||||
object:SetPos(parentwidth - 20, 4)
|
||||
end
|
||||
object:SetPos(parentwidth - 20, 4)
|
||||
object:SetSize(16, 16)
|
||||
|
||||
end
|
||||
|
||||
|
@ -334,7 +334,6 @@ function skin.DrawCloseButton(object)
|
||||
|
||||
local x = object:GetX()
|
||||
local y = object:GetY()
|
||||
local staticx = object:GetStaticX()
|
||||
local width = object:GetWidth()
|
||||
local height = object:GetHeight()
|
||||
local parentwidth = object.parent:GetWidth()
|
||||
@ -361,9 +360,8 @@ function skin.DrawCloseButton(object)
|
||||
love.graphics.draw(image, x, y)
|
||||
end
|
||||
|
||||
if staticx ~= (parentwidth - 20) then
|
||||
object:SetPos(parentwidth - 20, 4)
|
||||
end
|
||||
object:SetPos(parentwidth - 20, 4)
|
||||
object:SetSize(16, 16)
|
||||
|
||||
end
|
||||
|
||||
|
@ -363,7 +363,6 @@ function skin.DrawCloseButton(object)
|
||||
|
||||
local x = object:GetX()
|
||||
local y = object:GetY()
|
||||
local staticx = object:GetStaticX()
|
||||
local parent = object.parent
|
||||
local parentwidth = parent:GetWidth()
|
||||
local hover = object:GetHover()
|
||||
@ -389,9 +388,8 @@ function skin.DrawCloseButton(object)
|
||||
love.graphics.draw(image, x, y)
|
||||
end
|
||||
|
||||
if staticx ~= (parentwidth - 20) then
|
||||
object:SetPos(parentwidth - 20, 4)
|
||||
end
|
||||
object:SetPos(parentwidth - 20, 4)
|
||||
object:SetSize(16, 16)
|
||||
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user