Version 0.9.5.1 - Alpha (see changelog.txt)

This commit is contained in:
Kenny Shields 2013-02-17 13:18:25 -05:00
parent b0bd3a33cc
commit d1826e7f22
15 changed files with 218 additions and 63 deletions

View File

@ -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) 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: SetIgnoreNewlines(bool)
[ADDED] a new text object method: GetIgnoreNewlines() [ADDED] a new text object method: GetIgnoreNewlines()
[ADDED] a new text image method: SetOrientation(orientation) [ADDED] a new image method: SetOrientation(orientation)
[ADDED] a new text image method: GetOrientation() [ADDED] a new image method: GetOrientation()
[ADDED] a new text image method: SetScaleX(scalex) [ADDED] a new image method: SetScaleX(scalex)
[ADDED] a new text image method: GetScaleX() [ADDED] a new image method: GetScaleX()
[ADDED] a new text image method: SetScaleY(scaley) [ADDED] a new image method: SetScaleY(scaley)
[ADDED] a new text image method: GetScaleY() [ADDED] a new image method: GetScaleY()
[ADDED] a new text image method: SetScale(scalex, scaley) [ADDED] a new image method: SetScale(scalex, scaley)
[ADDED] a new text image method: GetScale() [ADDED] a new image method: GetScale()
[ADDED] a new text image method: SetOffsetX(x) [ADDED] a new image method: SetOffsetX(x)
[ADDED] a new text image method: GetOffsetX() [ADDED] a new image method: GetOffsetX()
[ADDED] a new text image method: SetOffsetY(y) [ADDED] a new image method: SetOffsetY(y)
[ADDED] a new text image method: GetOffsetY() [ADDED] a new image method: GetOffsetY()
[ADDED] a new text image method: SetOffset(x, y) [ADDED] a new image method: SetOffset(x, y)
[ADDED] a new text image method: GetOffset() [ADDED] a new image method: GetOffset()
[ADDED] a new text image method: SetShearX(x) [ADDED] a new image method: SetShearX(x)
[ADDED] a new text image method: GetShearX() [ADDED] a new image method: GetShearX()
[ADDED] a new text image method: SetShearY(y) [ADDED] a new image method: SetShearY(y)
[ADDED] a new text image method: GetShearY() [ADDED] a new image method: GetShearY()
[ADDED] a new text image method: SetShear(x, y) [ADDED] a new image method: SetShear(x, y)
[ADDED] a new text image method: GetShear() [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] 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 [FIXED] text in a single line text input always being cleared when the enter key was pressed

View File

@ -600,7 +600,7 @@ function loveframes.debug.ExamplesMenu()
local progressbar1 = loveframes.Create("progressbar", frame1) local progressbar1 = loveframes.Create("progressbar", frame1)
progressbar1:SetPos(5, 30) progressbar1:SetPos(5, 30)
progressbar1:SetWidth(490) progressbar1:SetWidth(490)
progressbar1:SetLerpRate(1) progressbar1:SetLerpRate(10)
local button1 = loveframes.Create("button", frame1) local button1 = loveframes.Create("button", frame1)
button1:SetPos(5, 60) button1:SetPos(5, 60)
@ -628,6 +628,7 @@ function loveframes.debug.ExamplesMenu()
slider1:SetText("Progressbar lerp rate") slider1:SetText("Progressbar lerp rate")
slider1:SetMinMax(0, 50) slider1:SetMinMax(0, 50)
slider1:SetDecimals(0) slider1:SetDecimals(0)
slider1:SetValue(10)
slider1.OnValueChanged = function(object2, value) slider1.OnValueChanged = function(object2, value)
progressbar1:SetLerpRate(value) progressbar1:SetLerpRate(value)
end end
@ -747,7 +748,7 @@ function loveframes.debug.ExamplesMenu()
exampleslist:AddItem(textexample) exampleslist:AddItem(textexample)
------------------------------------ ------------------------------------
-- text input example -- textinput example
------------------------------------ ------------------------------------
local textinputexample = loveframes.Create("button") local textinputexample = loveframes.Create("button")
textinputexample:SetText("Text Input") textinputexample:SetText("Text Input")
@ -820,4 +821,6 @@ function loveframes.debug.SkinSelector()
skinslist:AddChoice(v.name) skinslist:AddChoice(v.name)
end end
skinslist:Sort()
end end

View File

@ -9,7 +9,7 @@ loveframes = {}
-- library info -- library info
loveframes.info = {} loveframes.info = {}
loveframes.info.author = "Kenny Shields" loveframes.info.author = "Kenny Shields"
loveframes.info.version = "0.9.5" loveframes.info.version = "0.9.5.1"
loveframes.info.stage = "Alpha" loveframes.info.stage = "Alpha"
-- library configurations -- library configurations

View File

@ -221,14 +221,21 @@ end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: SetPos(x, y) - func: SetPos(x, y, center)
- desc: sets the object's position - desc: sets the object's position
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function newobject:SetPos(x, y) function newobject:SetPos(x, y, center)
local base = loveframes.base local base = loveframes.base
local parent = self.parent 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 if parent == base then
self.x = x self.x = x
self.y = y self.y = y
@ -240,14 +247,19 @@ function newobject:SetPos(x, y)
end end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: SetX(x) - func: SetX(x, center)
- desc: sets the object's x position - desc: sets the object's x position
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function newobject:SetX(x) function newobject:SetX(x, center)
local base = loveframes.base local base = loveframes.base
local parent = self.parent local parent = self.parent
if center then
local width = self.width
x = x - width/2
end
if parent == base then if parent == base then
self.x = x self.x = x
else else
@ -257,14 +269,19 @@ function newobject:SetX(x)
end end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: SetY(y) - func: SetY(y, center)
- desc: sets the object's y position - desc: sets the object's y position
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function newobject:SetY(y) function newobject:SetY(y, center)
local base = loveframes.base local base = loveframes.base
local parent = self.parent local parent = self.parent
if center then
local height = self.height
y = y - height/2
end
if parent == base then if parent == base then
self.y = y self.y = y
else else

View File

@ -17,7 +17,7 @@ function newobject:initialize()
self.height = 100 self.height = 100
self.columnheight = 16 self.columnheight = 16
self.buttonscrollamount = 200 self.buttonscrollamount = 200
self.mousewheelscrollamount = 1000 self.mousewheelscrollamount = 1500
self.autoscroll = false self.autoscroll = false
self.dtscrolling = true self.dtscrolling = true
self.internal = false self.internal = false

View File

@ -25,7 +25,7 @@ function newobject:initialize()
self.extrawidth = 0 self.extrawidth = 0
self.extraheight = 0 self.extraheight = 0
self.buttonscrollamount = 200 self.buttonscrollamount = 200
self.mousewheelscrollamount = 1000 self.mousewheelscrollamount = 1500
self.internal = false self.internal = false
self.hbar = false self.hbar = false
self.vbar = false self.vbar = false

View File

@ -20,7 +20,8 @@ function newobject:initialize()
self.listpadding = 0 self.listpadding = 0
self.listspacing = 0 self.listspacing = 0
self.buttonscrollamount = 200 self.buttonscrollamount = 200
self.mousewheelscrollamount = 1000 self.mousewheelscrollamount = 1500
self.sortfunc = function(a, b) return a < b end
self.haslist = false self.haslist = false
self.dtscrolling = true self.dtscrolling = true
self.internal = false self.internal = false
@ -335,3 +336,40 @@ function newobject:GetDTScrolling()
return self.dtscrolling 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

View File

@ -21,6 +21,9 @@ function newobject:initialize()
self.min = 0 self.min = 0
self.value = 0 self.value = 0
self.decimals = 5 self.decimals = 5
self.scrollincrease = 1
self.scrolldecrease = 1
self.scrollable = true
self.internal = false self.internal = false
self.internals = {} self.internals = {}
self.OnValueChanged = nil self.OnValueChanged = nil
@ -72,10 +75,13 @@ function newobject:update(dt)
end end
if sliderbutton then if sliderbutton then
if self.slidetype == "horizontal" then local slidetype = self.slidetype
self.height = sliderbutton.height local buttonwidth = sliderbutton.width
elseif self.slidetype == "vertical" then local buttonheight = sliderbutton.height
self.width = sliderbutton.width if slidetype == "horizontal" then
self.height = buttonheight
elseif slidetype == "vertical" then
self.width = buttonwidth
end end
end end
@ -155,9 +161,12 @@ function newobject:mousepressed(x, y, button)
end end
local internals = self.internals local internals = self.internals
local hover = self.hover
local slidetype = self.slidetype
local scrollable = self.scrollable
if self.hover and button == "l" then if hover and button == "l" then
if self.slidetype == "horizontal" then if slidetype == "horizontal" then
local xpos = x - self.x local xpos = x - self.x
local button = internals[1] local button = internals[1]
local baseparent = self:GetBaseParent() local baseparent = self:GetBaseParent()
@ -169,7 +178,7 @@ function newobject:mousepressed(x, y, button)
button.dragging = true button.dragging = true
button.startx = button.staticx button.startx = button.staticx
button.clickx = x button.clickx = x
elseif self.slidetype == "vertical" then elseif slidetype == "vertical" then
local ypos = y - self.y local ypos = y - self.y
local button = internals[1] local button = internals[1]
local baseparent = self:GetBaseParent() local baseparent = self:GetBaseParent()
@ -182,8 +191,19 @@ function newobject:mousepressed(x, y, button)
button.starty = button.staticy button.starty = button.staticy
button.clicky = y button.clicky = y
end 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 end
for k, v in ipairs(internals) do for k, v in ipairs(internals) do
v:mousepressed(x, y, button) v:mousepressed(x, y, button)
end end
@ -231,7 +251,7 @@ function newobject:SetValue(value)
-- call OnValueChanged -- call OnValueChanged
if onvaluechanged then if onvaluechanged then
onvaluechanged(self) onvaluechanged(self, newval)
end end
end end
@ -407,3 +427,69 @@ function newobject:GetSlideType()
return self.slidetype return self.slidetype
end 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

View File

@ -24,7 +24,7 @@ function newobject:initialize()
self.tabheight = 25 self.tabheight = 25
self.previoustabheight = 25 self.previoustabheight = 25
self.buttonscrollamount = 200 self.buttonscrollamount = 200
self.mousewheelscrollamount = 5 self.mousewheelscrollamount = 1500
self.autosize = true self.autosize = true
self.dtscrolling = true self.dtscrolling = true
self.internal = false self.internal = false

View File

@ -2,7 +2,7 @@
## Information ## 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 ## License

View File

@ -32,7 +32,7 @@ function loveframes.skins.Register(skin)
loveframes.util.Error("Could not register skin: Invalid or missing author data.") loveframes.util.Error("Could not register skin: Invalid or missing author data.")
end 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.") loveframes.util.Error("Could not register skin: Invalid or missing version data.")
end end
@ -48,12 +48,10 @@ function loveframes.skins.Register(skin)
loveframes.skins.available[name].dir = dir loveframes.skins.available[name].dir = dir
loveframes.skins.available[name].images = {} 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 for k, v in ipairs(images) do
loveframes.skins.available[name].images[v.name .. "." .. v.extension] = love.graphics.newImage(v.fullpath) loveframes.skins.available[name].images[v.name .. "." .. v.extension] = love.graphics.newImage(v.fullpath)
end end
end end
end end

View File

@ -334,7 +334,6 @@ function skin.DrawCloseButton(object)
local x = object:GetX() local x = object:GetX()
local y = object:GetY() local y = object:GetY()
local staticx = object:GetStaticX()
local width = object:GetWidth() local width = object:GetWidth()
local height = object:GetHeight() local height = object:GetHeight()
local parentwidth = object.parent:GetWidth() local parentwidth = object.parent:GetWidth()
@ -361,9 +360,8 @@ function skin.DrawCloseButton(object)
love.graphics.draw(image, x, y) love.graphics.draw(image, x, y)
end end
if staticx ~= (parentwidth - 20) then
object:SetPos(parentwidth - 20, 4) object:SetPos(parentwidth - 20, 4)
end object:SetSize(16, 16)
end end

View File

@ -363,7 +363,6 @@ function skin.DrawCloseButton(object)
local x = object:GetX() local x = object:GetX()
local y = object:GetY() local y = object:GetY()
local staticx = object:GetStaticX()
local parent = object.parent local parent = object.parent
local parentwidth = parent:GetWidth() local parentwidth = parent:GetWidth()
local hover = object:GetHover() local hover = object:GetHover()
@ -389,9 +388,8 @@ function skin.DrawCloseButton(object)
love.graphics.draw(image, x, y) love.graphics.draw(image, x, y)
end end
if staticx ~= (parentwidth - 20) then
object:SetPos(parentwidth - 20, 4) object:SetPos(parentwidth - 20, 4)
end object:SetSize(16, 16)
end end

View File

@ -334,7 +334,6 @@ function skin.DrawCloseButton(object)
local x = object:GetX() local x = object:GetX()
local y = object:GetY() local y = object:GetY()
local staticx = object:GetStaticX()
local width = object:GetWidth() local width = object:GetWidth()
local height = object:GetHeight() local height = object:GetHeight()
local parentwidth = object.parent:GetWidth() local parentwidth = object.parent:GetWidth()
@ -361,9 +360,8 @@ function skin.DrawCloseButton(object)
love.graphics.draw(image, x, y) love.graphics.draw(image, x, y)
end end
if staticx ~= (parentwidth - 20) then
object:SetPos(parentwidth - 20, 4) object:SetPos(parentwidth - 20, 4)
end object:SetSize(16, 16)
end end

View File

@ -363,7 +363,6 @@ function skin.DrawCloseButton(object)
local x = object:GetX() local x = object:GetX()
local y = object:GetY() local y = object:GetY()
local staticx = object:GetStaticX()
local parent = object.parent local parent = object.parent
local parentwidth = parent:GetWidth() local parentwidth = parent:GetWidth()
local hover = object:GetHover() local hover = object:GetHover()
@ -389,9 +388,8 @@ function skin.DrawCloseButton(object)
love.graphics.draw(image, x, y) love.graphics.draw(image, x, y)
end end
if staticx ~= (parentwidth - 20) then
object:SetPos(parentwidth - 20, 4) object:SetPos(parentwidth - 20, 4)
end object:SetSize(16, 16)
end end