2013-02-11 21:15:40 +00:00
|
|
|
--[[------------------------------------------------
|
|
|
|
-- Love Frames - A GUI library for LOVE --
|
2014-01-14 11:29:11 +00:00
|
|
|
-- Copyright (c) 2012-2014 Kenny Shields --
|
2013-02-11 21:15:40 +00:00
|
|
|
--]]------------------------------------------------
|
|
|
|
|
|
|
|
-- skin table
|
|
|
|
local skin = {}
|
|
|
|
|
|
|
|
-- skin info (you always need this in a skin)
|
|
|
|
skin.name = "Blue"
|
|
|
|
skin.author = "Nikolai Resokav"
|
|
|
|
skin.version = "1.0"
|
|
|
|
|
|
|
|
local smallfont = love.graphics.newFont(10)
|
|
|
|
local imagebuttonfont = love.graphics.newFont(15)
|
|
|
|
local bordercolor = {143, 143, 143, 255}
|
|
|
|
|
2013-11-09 14:30:08 +00:00
|
|
|
-- add skin directives to this table
|
|
|
|
skin.directives = {}
|
|
|
|
|
2013-02-11 21:15:40 +00:00
|
|
|
-- controls
|
|
|
|
skin.controls = {}
|
|
|
|
|
|
|
|
-- frame
|
|
|
|
skin.controls.frame_body_color = {232, 232, 232, 255}
|
|
|
|
skin.controls.frame_name_color = {255, 255, 255, 255}
|
|
|
|
skin.controls.frame_name_font = smallfont
|
|
|
|
|
|
|
|
-- button
|
|
|
|
skin.controls.button_text_down_color = {255, 255, 255, 255}
|
|
|
|
skin.controls.button_text_nohover_color = {0, 0, 0, 200}
|
|
|
|
skin.controls.button_text_hover_color = {255, 255, 255, 255}
|
|
|
|
skin.controls.button_text_nonclickable_color = {0, 0, 0, 100}
|
|
|
|
skin.controls.button_text_font = smallfont
|
|
|
|
|
2013-02-24 16:59:03 +00:00
|
|
|
-- imagebutton
|
2013-02-11 21:15:40 +00:00
|
|
|
skin.controls.imagebutton_text_down_color = {255, 255, 255, 255}
|
|
|
|
skin.controls.imagebutton_text_nohover_color = {255, 255, 255, 200}
|
|
|
|
skin.controls.imagebutton_text_hover_color = {255, 255, 255, 255}
|
|
|
|
skin.controls.imagebutton_text_font = imagebuttonfont
|
|
|
|
|
2013-02-24 16:59:03 +00:00
|
|
|
-- closebutton
|
2013-02-11 21:15:40 +00:00
|
|
|
skin.controls.closebutton_body_down_color = {255, 255, 255, 255}
|
|
|
|
skin.controls.closebutton_body_nohover_color = {255, 255, 255, 255}
|
|
|
|
skin.controls.closebutton_body_hover_color = {255, 255, 255, 255}
|
|
|
|
|
2013-02-24 16:59:03 +00:00
|
|
|
-- progressbar
|
2013-02-11 21:15:40 +00:00
|
|
|
skin.controls.progressbar_body_color = {255, 255, 255, 255}
|
|
|
|
skin.controls.progressbar_text_color = {0, 0, 0, 255}
|
|
|
|
skin.controls.progressbar_text_font = smallfont
|
|
|
|
|
|
|
|
-- list
|
|
|
|
skin.controls.list_body_color = {232, 232, 232, 255}
|
|
|
|
|
|
|
|
-- scrollarea
|
2013-08-15 02:09:22 +00:00
|
|
|
skin.controls.scrollarea_body_color = {220, 220, 220, 255}
|
2013-02-11 21:15:40 +00:00
|
|
|
|
|
|
|
-- scrollbody
|
|
|
|
skin.controls.scrollbody_body_color = {0, 0, 0, 0}
|
|
|
|
|
|
|
|
-- panel
|
|
|
|
skin.controls.panel_body_color = {232, 232, 232, 255}
|
|
|
|
|
2013-02-24 16:59:03 +00:00
|
|
|
-- tabpanel
|
2013-02-11 21:15:40 +00:00
|
|
|
skin.controls.tabpanel_body_color = {232, 232, 232, 255}
|
|
|
|
|
2013-02-24 16:59:03 +00:00
|
|
|
-- tabbutton
|
2013-02-11 21:15:40 +00:00
|
|
|
skin.controls.tab_text_nohover_color = {0, 0, 0, 200}
|
|
|
|
skin.controls.tab_text_hover_color = {255, 255, 255, 255}
|
|
|
|
skin.controls.tab_text_font = smallfont
|
|
|
|
|
|
|
|
-- multichoice
|
|
|
|
skin.controls.multichoice_body_color = {240, 240, 240, 255}
|
|
|
|
skin.controls.multichoice_text_color = {0, 0, 0, 255}
|
|
|
|
skin.controls.multichoice_text_font = smallfont
|
|
|
|
|
|
|
|
-- multichoicelist
|
|
|
|
skin.controls.multichoicelist_body_color = {240, 240, 240, 200}
|
|
|
|
|
|
|
|
-- multichoicerow
|
|
|
|
skin.controls.multichoicerow_body_nohover_color = {240, 240, 240, 255}
|
|
|
|
skin.controls.multichoicerow_body_hover_color = {51, 204, 255, 255}
|
|
|
|
skin.controls.multichoicerow_text_nohover_color = {0, 0, 0, 150}
|
|
|
|
skin.controls.multichoicerow_text_hover_color = {255, 255, 255, 255}
|
|
|
|
skin.controls.multichoicerow_text_font = smallfont
|
|
|
|
|
|
|
|
-- tooltip
|
|
|
|
skin.controls.tooltip_body_color = {255, 255, 255, 255}
|
|
|
|
|
2013-02-24 16:59:03 +00:00
|
|
|
-- textinput
|
2013-08-15 02:09:22 +00:00
|
|
|
skin.controls.textinput_body_color = {250, 250, 250, 255}
|
2013-02-11 21:15:40 +00:00
|
|
|
skin.controls.textinput_indicator_color = {0, 0, 0, 255}
|
|
|
|
skin.controls.textinput_text_normal_color = {0, 0, 0, 255}
|
2013-11-06 22:50:26 +00:00
|
|
|
skin.controls.textinput_text_placeholder_color = {127, 127, 127, 255}
|
2013-02-11 21:15:40 +00:00
|
|
|
skin.controls.textinput_text_selected_color = {255, 255, 255, 255}
|
|
|
|
skin.controls.textinput_highlight_bar_color = {51, 204, 255, 255}
|
|
|
|
|
|
|
|
-- slider
|
|
|
|
skin.controls.slider_bar_outline_color = {220, 220, 220, 255}
|
|
|
|
|
|
|
|
-- checkbox
|
|
|
|
skin.controls.checkbox_body_color = {255, 255, 255, 255}
|
|
|
|
skin.controls.checkbox_check_color = {128, 204, 255, 255}
|
|
|
|
skin.controls.checkbox_text_font = smallfont
|
|
|
|
|
|
|
|
-- collapsiblecategory
|
2013-12-26 18:30:35 +00:00
|
|
|
skin.controls.collapsiblecategory_text_color = {255, 255, 255, 255}
|
2013-02-11 21:15:40 +00:00
|
|
|
|
|
|
|
-- columnlist
|
|
|
|
skin.controls.columnlist_body_color = {232, 232, 232, 255}
|
|
|
|
|
|
|
|
-- columlistarea
|
|
|
|
skin.controls.columnlistarea_body_color = {232, 232, 232, 255}
|
|
|
|
|
|
|
|
-- columnlistheader
|
|
|
|
skin.controls.columnlistheader_text_down_color = {255, 255, 255, 255}
|
|
|
|
skin.controls.columnlistheader_text_nohover_color = {0, 0, 0, 200}
|
|
|
|
skin.controls.columnlistheader_text_hover_color = {255, 255, 255, 255}
|
|
|
|
skin.controls.columnlistheader_text_font = smallfont
|
|
|
|
|
|
|
|
-- columnlistrow
|
2013-06-10 16:34:01 +00:00
|
|
|
skin.controls.columnlistrow_body1_color = {245, 245, 245, 255}
|
|
|
|
skin.controls.columnlistrow_body2_color = {255, 255, 255, 255}
|
|
|
|
skin.controls.columnlistrow_body_selected_color = {26, 198, 255, 255}
|
|
|
|
skin.controls.columnlistrow_body_hover_color = {102, 217, 255, 255}
|
2013-02-11 21:15:40 +00:00
|
|
|
skin.controls.columnlistrow_text_color = {100, 100, 100, 255}
|
2013-06-10 16:34:01 +00:00
|
|
|
skin.controls.columnlistrow_text_hover_color = {255, 255, 255, 255}
|
|
|
|
skin.controls.columnlistrow_text_selected_color = {255, 255, 255, 255}
|
2013-02-11 21:15:40 +00:00
|
|
|
|
|
|
|
-- modalbackground
|
|
|
|
skin.controls.modalbackground_body_color = {255, 255, 255, 100}
|
|
|
|
|
|
|
|
-- linenumberspanel
|
2013-08-15 02:09:22 +00:00
|
|
|
skin.controls.linenumberspanel_text_color = {170, 170, 170, 255}
|
|
|
|
skin.controls.linenumberspanel_body_color = {235, 235, 235, 255}
|
2013-02-11 21:15:40 +00:00
|
|
|
|
2013-12-26 18:30:35 +00:00
|
|
|
-- grid
|
|
|
|
skin.controls.grid_body_color = {230, 230, 230, 255}
|
|
|
|
|
2013-11-25 13:06:41 +00:00
|
|
|
-- form
|
|
|
|
skin.controls.form_text_color = {0, 0, 0, 255}
|
|
|
|
skin.controls.form_text_font = smallfont
|
|
|
|
|
2013-12-26 18:30:35 +00:00
|
|
|
-- menu
|
|
|
|
skin.controls.menu_body_color = {255, 255, 255, 255}
|
|
|
|
|
|
|
|
-- menuoption
|
|
|
|
skin.controls.menuoption_body_hover_color = {51, 204, 255, 255}
|
|
|
|
skin.controls.menuoption_text_hover_color = {255, 255, 255, 255}
|
|
|
|
skin.controls.menuoption_text_color = {180, 180, 180, 255}
|
|
|
|
|
2013-02-11 21:15:40 +00:00
|
|
|
--[[---------------------------------------------------------
|
2013-11-25 13:06:41 +00:00
|
|
|
- func: OutlinedRectangle(x, y, width, height, ovt, ovb, ovl, ovr)
|
2013-02-11 21:15:40 +00:00
|
|
|
- desc: creates and outlined rectangle
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.OutlinedRectangle(x, y, width, height, ovt, ovb, ovl, ovr)
|
|
|
|
|
|
|
|
local ovt = ovt or false
|
|
|
|
local ovb = ovb or false
|
|
|
|
local ovl = ovl or false
|
|
|
|
local ovr = ovr or false
|
|
|
|
|
|
|
|
-- top
|
|
|
|
if not ovt then
|
|
|
|
love.graphics.rectangle("fill", x, y, width, 1)
|
|
|
|
end
|
|
|
|
|
|
|
|
-- bottom
|
|
|
|
if not ovb then
|
|
|
|
love.graphics.rectangle("fill", x, y + height - 1, width, 1)
|
|
|
|
end
|
|
|
|
|
|
|
|
-- left
|
|
|
|
if not ovl then
|
|
|
|
love.graphics.rectangle("fill", x, y, 1, height)
|
|
|
|
end
|
|
|
|
|
|
|
|
-- right
|
|
|
|
if not ovr then
|
|
|
|
love.graphics.rectangle("fill", x + width - 1, y, 1, height)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: DrawFrame(object)
|
|
|
|
- desc: draws the frame object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawFrame(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local hover = object:GetHover()
|
|
|
|
local name = object:GetName()
|
2013-05-05 23:51:20 +00:00
|
|
|
local icon = object:GetIcon()
|
2013-02-11 21:15:40 +00:00
|
|
|
local bodycolor = skin.controls.frame_body_color
|
|
|
|
local topcolor = skin.controls.frame_top_color
|
|
|
|
local namecolor = skin.controls.frame_name_color
|
|
|
|
local font = skin.controls.frame_name_font
|
2013-08-15 02:09:22 +00:00
|
|
|
local topbarimage = skin.images["frame-topbar.png"]
|
|
|
|
local topbarimage_width = topbarimage:getWidth()
|
|
|
|
local topbarimage_height = topbarimage:getHeight()
|
|
|
|
local topbarimage_scalex = width/topbarimage_width
|
|
|
|
local topbarimage_scaley = 25/topbarimage_height
|
|
|
|
local bodyimage = skin.images["frame-body.png"]
|
|
|
|
local bodyimage_width = bodyimage:getWidth()
|
|
|
|
local bodyimage_height = bodyimage:getHeight()
|
|
|
|
local bodyimage_scalex = width/bodyimage_width
|
|
|
|
local bodyimage_scaley = height/bodyimage_height
|
2013-02-24 16:59:03 +00:00
|
|
|
|
2013-02-11 21:15:40 +00:00
|
|
|
-- frame body
|
2013-08-15 02:09:22 +00:00
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(bodyimage, x, y, 0, bodyimage_scalex, bodyimage_scaley)
|
2013-02-11 21:15:40 +00:00
|
|
|
|
|
|
|
-- frame top bar
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
2013-08-15 02:09:22 +00:00
|
|
|
love.graphics.draw(topbarimage, x, y, 0, topbarimage_scalex, topbarimage_scaley)
|
2013-02-11 21:15:40 +00:00
|
|
|
|
|
|
|
-- frame name section
|
|
|
|
love.graphics.setFont(font)
|
2013-05-05 23:51:20 +00:00
|
|
|
|
|
|
|
if icon then
|
|
|
|
local iconwidth = icon:getWidth()
|
|
|
|
local iconheight = icon:getHeight()
|
|
|
|
icon:setFilter("nearest", "nearest")
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(icon, x + 5, y + 5)
|
|
|
|
love.graphics.setColor(namecolor)
|
|
|
|
love.graphics.print(name, x + iconwidth + 10, y + 5)
|
|
|
|
else
|
|
|
|
love.graphics.setColor(namecolor)
|
|
|
|
love.graphics.print(name, x + 5, y + 5)
|
|
|
|
end
|
2013-02-11 21:15:40 +00:00
|
|
|
|
|
|
|
-- frame border
|
|
|
|
love.graphics.setColor(bordercolor)
|
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
|
2013-12-26 18:30:35 +00:00
|
|
|
love.graphics.setColor(255, 255, 255, 70)
|
|
|
|
skin.OutlinedRectangle(x + 1, y + 1, width - 2, 24)
|
|
|
|
|
|
|
|
love.graphics.setColor(220, 220, 220, 255)
|
|
|
|
skin.OutlinedRectangle(x + 1, y + 25, width - 2, height - 26)
|
|
|
|
|
2013-02-11 21:15:40 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: DrawButton(object)
|
|
|
|
- desc: draws the button object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawButton(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local hover = object:GetHover()
|
|
|
|
local text = object:GetText()
|
|
|
|
local font = skin.controls.button_text_font
|
|
|
|
local twidth = font:getWidth(object.text)
|
|
|
|
local theight = font:getHeight(object.text)
|
|
|
|
local down = object.down
|
|
|
|
local enabled = object:GetEnabled()
|
|
|
|
local clickable = object:GetClickable()
|
|
|
|
local textdowncolor = skin.controls.button_text_down_color
|
|
|
|
local texthovercolor = skin.controls.button_text_hover_color
|
|
|
|
local textnohovercolor = skin.controls.button_text_nohover_color
|
|
|
|
local textnonclickablecolor = skin.controls.button_text_nonclickable_color
|
|
|
|
|
|
|
|
if not enabled or not clickable then
|
2013-02-24 16:59:03 +00:00
|
|
|
local image = skin.images["button-unclickable.png"]
|
|
|
|
local imageheight = image:getHeight()
|
|
|
|
local scaley = height/imageheight
|
2013-02-11 21:15:40 +00:00
|
|
|
-- button body
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, x, y, 0, width, scaley)
|
2013-02-11 21:15:40 +00:00
|
|
|
-- button text
|
|
|
|
love.graphics.setFont(font)
|
|
|
|
love.graphics.setColor(textnonclickablecolor)
|
|
|
|
love.graphics.print(text, x + width/2 - twidth/2, y + height/2 - theight/2)
|
|
|
|
-- button border
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(bordercolor)
|
2013-02-11 21:15:40 +00:00
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
return
|
|
|
|
end
|
2013-02-24 16:59:03 +00:00
|
|
|
|
2013-02-11 21:15:40 +00:00
|
|
|
if down then
|
2013-02-24 16:59:03 +00:00
|
|
|
local image = skin.images["button-down.png"]
|
|
|
|
local imageheight = image:getHeight()
|
|
|
|
local scaley = height/imageheight
|
2013-02-11 21:15:40 +00:00
|
|
|
-- button body
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, x, y, 0, width, scaley)
|
2013-02-11 21:15:40 +00:00
|
|
|
-- button text
|
|
|
|
love.graphics.setFont(font)
|
|
|
|
love.graphics.setColor(textdowncolor)
|
|
|
|
love.graphics.print(text, x + width/2 - twidth/2, y + height/2 - theight/2)
|
|
|
|
-- button border
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(bordercolor)
|
2013-02-11 21:15:40 +00:00
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
elseif hover then
|
2013-02-24 16:59:03 +00:00
|
|
|
local image = skin.images["button-hover.png"]
|
|
|
|
local imageheight = image:getHeight()
|
|
|
|
local scaley = height/imageheight
|
2013-02-11 21:15:40 +00:00
|
|
|
-- button body
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, x, y, 0, width, scaley)
|
2013-02-11 21:15:40 +00:00
|
|
|
-- button text
|
|
|
|
love.graphics.setFont(font)
|
|
|
|
love.graphics.setColor(texthovercolor)
|
|
|
|
love.graphics.print(text, x + width/2 - twidth/2, y + height/2 - theight/2)
|
|
|
|
-- button border
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(bordercolor)
|
2013-02-11 21:15:40 +00:00
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
2013-02-24 16:59:03 +00:00
|
|
|
else
|
|
|
|
local image = skin.images["button-nohover.png"]
|
|
|
|
local imageheight = image:getHeight()
|
|
|
|
local scaley = height/imageheight
|
2013-02-11 21:15:40 +00:00
|
|
|
-- button body
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, x, y, 0, width, scaley)
|
2013-02-11 21:15:40 +00:00
|
|
|
-- button text
|
|
|
|
love.graphics.setFont(font)
|
|
|
|
love.graphics.setColor(textnohovercolor)
|
|
|
|
love.graphics.print(text, x + width/2 - twidth/2, y + height/2 - theight/2)
|
|
|
|
-- button border
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(bordercolor)
|
2013-02-11 21:15:40 +00:00
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
end
|
2013-12-26 18:30:35 +00:00
|
|
|
|
|
|
|
love.graphics.setColor(255, 255, 255, 150)
|
|
|
|
skin.OutlinedRectangle(x + 1, y + 1, width - 2, height - 2)
|
2013-02-11 21:15:40 +00:00
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: DrawCloseButton(object)
|
|
|
|
- desc: draws the close button object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawCloseButton(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local parent = object.parent
|
|
|
|
local parentwidth = parent:GetWidth()
|
|
|
|
local hover = object:GetHover()
|
|
|
|
local down = object.down
|
|
|
|
local image = skin.images["close.png"]
|
|
|
|
local bodydowncolor = skin.controls.closebutton_body_down_color
|
|
|
|
local bodyhovercolor = skin.controls.closebutton_body_hover_color
|
|
|
|
local bodynohovercolor = skin.controls.closebutton_body_nohover_color
|
|
|
|
|
|
|
|
image:setFilter("nearest", "nearest")
|
|
|
|
|
|
|
|
if down then
|
|
|
|
-- button body
|
|
|
|
love.graphics.setColor(bodydowncolor)
|
|
|
|
love.graphics.draw(image, x, y)
|
|
|
|
elseif hover then
|
|
|
|
-- button body
|
|
|
|
love.graphics.setColor(bodyhovercolor)
|
|
|
|
love.graphics.draw(image, x, y)
|
|
|
|
else
|
|
|
|
-- button body
|
|
|
|
love.graphics.setColor(bodynohovercolor)
|
|
|
|
love.graphics.draw(image, x, y)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: DrawImage(object)
|
|
|
|
- desc: draws the image object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawImage(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local orientation = object:GetOrientation()
|
|
|
|
local scalex = object:GetScaleX()
|
|
|
|
local scaley = object:GetScaleY()
|
|
|
|
local offsetx = object:GetOffsetX()
|
|
|
|
local offsety = object:GetOffsetY()
|
|
|
|
local shearx = object:GetShearX()
|
|
|
|
local sheary = object:GetShearY()
|
|
|
|
local image = object.image
|
|
|
|
local color = object.imagecolor
|
|
|
|
|
|
|
|
if color then
|
|
|
|
love.graphics.setColor(color)
|
|
|
|
love.graphics.draw(image, x, y, orientation, scalex, scaley, offsetx, offsety, shearx, sheary)
|
|
|
|
else
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, x, y, orientation, scalex, scaley, offsetx, offsety, shearx, sheary)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: DrawImageButton(object)
|
|
|
|
- desc: draws the image button object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawImageButton(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local text = object:GetText()
|
|
|
|
local hover = object:GetHover()
|
|
|
|
local image = object:GetImage()
|
|
|
|
local down = object.down
|
|
|
|
local font = skin.controls.imagebutton_text_font
|
|
|
|
local twidth = font:getWidth(object.text)
|
|
|
|
local theight = font:getHeight(object.text)
|
|
|
|
local textdowncolor = skin.controls.imagebutton_text_down_color
|
|
|
|
local texthovercolor = skin.controls.imagebutton_text_hover_color
|
|
|
|
local textnohovercolor = skin.controls.imagebutton_text_nohover_color
|
|
|
|
|
|
|
|
if down then
|
|
|
|
if image then
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, x + 1, y + 1)
|
|
|
|
end
|
|
|
|
love.graphics.setFont(font)
|
|
|
|
love.graphics.setColor(0, 0, 0, 255)
|
|
|
|
love.graphics.print(text, x + width/2 - twidth/2 + 1, y + height - theight - 5 + 1)
|
|
|
|
love.graphics.setColor(textdowncolor)
|
|
|
|
love.graphics.print(text, x + width/2 - twidth/2 + 1, y + height - theight - 6 + 1)
|
|
|
|
elseif hover then
|
|
|
|
if image then
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, x, y)
|
|
|
|
end
|
|
|
|
love.graphics.setFont(font)
|
|
|
|
love.graphics.setColor(0, 0, 0, 255)
|
|
|
|
love.graphics.print(text, x + width/2 - twidth/2, y + height - theight - 5)
|
|
|
|
love.graphics.setColor(texthovercolor)
|
|
|
|
love.graphics.print(text, x + width/2 - twidth/2, y + height - theight - 6)
|
|
|
|
else
|
|
|
|
if image then
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, x, y)
|
|
|
|
end
|
|
|
|
love.graphics.setFont(font)
|
|
|
|
love.graphics.setColor(0, 0, 0, 255)
|
|
|
|
love.graphics.print(text, x + width/2 - twidth/2, y + height - theight - 5)
|
|
|
|
love.graphics.setColor(textnohovercolor)
|
|
|
|
love.graphics.print(text, x + width/2 - twidth/2, y + height - theight - 6)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: DrawProgressBar(object)
|
|
|
|
- desc: draws the progress bar object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawProgressBar(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local value = object:GetValue()
|
|
|
|
local max = object:GetMax()
|
2013-11-25 23:16:59 +00:00
|
|
|
local text = object:GetText()
|
2013-02-11 21:15:40 +00:00
|
|
|
local barwidth = object:GetBarWidth()
|
|
|
|
local font = skin.controls.progressbar_text_font
|
|
|
|
local twidth = font:getWidth(text)
|
|
|
|
local theight = font:getHeight("a")
|
|
|
|
local bodycolor = skin.controls.progressbar_body_color
|
|
|
|
local barcolor = skin.controls.progressbar_bar_color
|
|
|
|
local textcolor = skin.controls.progressbar_text_color
|
2013-02-24 16:59:03 +00:00
|
|
|
local image = skin.images["progressbar.png"]
|
|
|
|
local imageheight = image:getHeight()
|
|
|
|
local scaley = height/imageheight
|
|
|
|
|
2013-02-11 21:15:40 +00:00
|
|
|
-- progress bar body
|
|
|
|
love.graphics.setColor(bodycolor)
|
|
|
|
love.graphics.rectangle("fill", x, y, width, height)
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, x, y, 0, barwidth, scaley)
|
2013-02-11 21:15:40 +00:00
|
|
|
love.graphics.setFont(font)
|
|
|
|
love.graphics.setColor(textcolor)
|
|
|
|
love.graphics.print(text, x + width/2 - twidth/2, y + height/2 - theight/2)
|
|
|
|
|
|
|
|
-- progress bar border
|
|
|
|
love.graphics.setColor(bordercolor)
|
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
2013-11-25 23:16:59 +00:00
|
|
|
|
|
|
|
object:SetText(value .. "/" ..max)
|
|
|
|
|
2013-02-11 21:15:40 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: DrawScrollArea(object)
|
|
|
|
- desc: draws the scroll area object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawScrollArea(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local bartype = object:GetBarType()
|
|
|
|
local bodycolor = skin.controls.scrollarea_body_color
|
|
|
|
|
|
|
|
love.graphics.setColor(bodycolor)
|
|
|
|
love.graphics.rectangle("fill", x, y, width, height)
|
|
|
|
love.graphics.setColor(bordercolor)
|
|
|
|
|
|
|
|
if bartype == "vertical" then
|
2013-12-26 18:30:35 +00:00
|
|
|
--skin.OutlinedRectangle(x, y, width, height, true, true)
|
2013-02-11 21:15:40 +00:00
|
|
|
elseif bartype == "horizontal" then
|
2013-12-26 18:30:35 +00:00
|
|
|
--skin.OutlinedRectangle(x, y, width, height, false, false, true, true)
|
2013-02-11 21:15:40 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: DrawScrollBar(object)
|
|
|
|
- desc: draws the scroll bar object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawScrollBar(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local dragging = object:IsDragging()
|
|
|
|
local hover = object:GetHover()
|
|
|
|
local bartype = object:GetBarType()
|
|
|
|
local bodydowncolor = skin.controls.scrollbar_body_down_color
|
|
|
|
local bodyhovercolor = skin.controls.scrollbar_body_hover_color
|
|
|
|
local bodynohvercolor = skin.controls.scrollbar_body_nohover_color
|
|
|
|
|
|
|
|
if dragging then
|
2013-02-24 16:59:03 +00:00
|
|
|
local image = skin.images["button-down.png"]
|
|
|
|
local imageheight = image:getHeight()
|
|
|
|
local scaley = height/imageheight
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, x, y, 0, width, scaley)
|
|
|
|
love.graphics.setColor(bordercolor)
|
2013-02-11 21:15:40 +00:00
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
elseif hover then
|
2013-02-24 16:59:03 +00:00
|
|
|
local image = skin.images["button-hover.png"]
|
|
|
|
local imageheight = image:getHeight()
|
|
|
|
local scaley = height/imageheight
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, x, y, 0, width, scaley)
|
|
|
|
love.graphics.setColor(bordercolor)
|
2013-02-11 21:15:40 +00:00
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
else
|
2013-02-24 16:59:03 +00:00
|
|
|
local image = skin.images["button-nohover.png"]
|
|
|
|
local imageheight = image:getHeight()
|
|
|
|
local scaley = height/imageheight
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, x, y, 0, width, scaley)
|
|
|
|
love.graphics.setColor(bordercolor)
|
2013-02-11 21:15:40 +00:00
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: DrawScrollBody(object)
|
|
|
|
- desc: draws the scroll body object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawScrollBody(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local bodycolor = skin.controls.scrollbody_body_color
|
|
|
|
|
|
|
|
love.graphics.setColor(bodycolor)
|
|
|
|
love.graphics.rectangle("fill", x, y, width, height)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: DrawPanel(object)
|
|
|
|
- desc: draws the panel object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawPanel(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local bodycolor = skin.controls.panel_body_color
|
|
|
|
|
|
|
|
love.graphics.setColor(bodycolor)
|
|
|
|
love.graphics.rectangle("fill", x, y, width, height)
|
2013-12-26 18:30:35 +00:00
|
|
|
|
|
|
|
love.graphics.setColor(255, 255, 255, 200)
|
|
|
|
skin.OutlinedRectangle(x + 1, y + 1, width - 2, height - 2)
|
|
|
|
|
2013-02-11 21:15:40 +00:00
|
|
|
love.graphics.setColor(bordercolor)
|
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: DrawList(object)
|
|
|
|
- desc: draws the list object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawList(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local bodycolor = skin.controls.list_body_color
|
|
|
|
|
|
|
|
love.graphics.setColor(bodycolor)
|
|
|
|
love.graphics.rectangle("fill", x, y, width, height)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: DrawList(object)
|
2013-03-23 19:50:44 +00:00
|
|
|
- desc: used to draw over the object and its children
|
2013-02-11 21:15:40 +00:00
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawOverList(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(bordercolor)
|
2013-02-11 21:15:40 +00:00
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: DrawTabPanel(object)
|
|
|
|
- desc: draws the tab panel object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawTabPanel(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local buttonheight = object:GetHeightOfButtons()
|
|
|
|
local bodycolor = skin.controls.tabpanel_body_color
|
|
|
|
|
|
|
|
love.graphics.setColor(bodycolor)
|
|
|
|
love.graphics.rectangle("fill", x, y + buttonheight, width, height - buttonheight)
|
|
|
|
love.graphics.setColor(bordercolor)
|
|
|
|
skin.OutlinedRectangle(x, y + buttonheight - 1, width, height - buttonheight + 2)
|
|
|
|
|
|
|
|
object:SetScrollButtonSize(15, buttonheight)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2013-12-14 16:29:59 +00:00
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: DrawOverTabPanel(object)
|
|
|
|
- desc: draws over the tab panel object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawOverTabPanel(object)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2013-02-11 21:15:40 +00:00
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: DrawTabButton(object)
|
|
|
|
- desc: draws the tab button object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawTabButton(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local hover = object:GetHover()
|
|
|
|
local text = object:GetText()
|
|
|
|
local image = object:GetImage()
|
|
|
|
local tabnumber = object:GetTabNumber()
|
|
|
|
local parent = object:GetParent()
|
|
|
|
local ptabnumber = parent:GetTabNumber()
|
|
|
|
local font = skin.controls.tab_text_font
|
|
|
|
local twidth = font:getWidth(object.text)
|
|
|
|
local theight = font:getHeight(object.text)
|
|
|
|
local imagewidth = 0
|
|
|
|
local imageheight = 0
|
|
|
|
local texthovercolor = skin.controls.button_text_hover_color
|
|
|
|
local textnohovercolor = skin.controls.button_text_nohover_color
|
|
|
|
|
|
|
|
if image then
|
|
|
|
image:setFilter("nearest", "nearest")
|
|
|
|
imagewidth = image:getWidth()
|
|
|
|
imageheight = image:getHeight()
|
|
|
|
object.width = imagewidth + 15 + twidth
|
|
|
|
if imageheight > theight then
|
|
|
|
parent:SetTabHeight(imageheight + 5)
|
|
|
|
object.height = imageheight + 5
|
|
|
|
else
|
2013-05-05 23:51:20 +00:00
|
|
|
object.height = parent.tabheight
|
2013-02-11 21:15:40 +00:00
|
|
|
end
|
|
|
|
else
|
|
|
|
object.width = 10 + twidth
|
2013-05-05 23:51:20 +00:00
|
|
|
object.height = parent.tabheight
|
2013-02-11 21:15:40 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
|
|
|
|
if tabnumber == ptabnumber then
|
|
|
|
-- button body
|
2013-02-24 16:59:03 +00:00
|
|
|
local gradient = skin.images["button-hover.png"]
|
|
|
|
local gradientheight = gradient:getHeight()
|
|
|
|
local scaley = height/gradientheight
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(gradient, x, y, 0, width, scaley)
|
2013-02-11 21:15:40 +00:00
|
|
|
-- button border
|
|
|
|
love.graphics.setColor(bordercolor)
|
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
if image then
|
|
|
|
-- button image
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, x + 5, y + height/2 - imageheight/2)
|
|
|
|
-- button text
|
|
|
|
love.graphics.setFont(font)
|
|
|
|
love.graphics.setColor(texthovercolor)
|
|
|
|
love.graphics.print(text, x + imagewidth + 10, y + height/2 - theight/2)
|
|
|
|
else
|
|
|
|
-- button text
|
|
|
|
love.graphics.setFont(font)
|
|
|
|
love.graphics.setColor(texthovercolor)
|
|
|
|
love.graphics.print(text, x + 5, y + height/2 - theight/2)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
-- button body
|
2013-02-24 16:59:03 +00:00
|
|
|
local gradient = skin.images["button-nohover.png"]
|
|
|
|
local gradientheight = gradient:getHeight()
|
|
|
|
local scaley = height/gradientheight
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(gradient, x, y, 0, width, scaley)
|
2013-02-11 21:15:40 +00:00
|
|
|
-- button border
|
|
|
|
love.graphics.setColor(bordercolor)
|
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
if image then
|
|
|
|
-- button image
|
|
|
|
love.graphics.setColor(255, 255, 255, 150)
|
|
|
|
love.graphics.draw(image, x + 5, y + height/2 - imageheight/2)
|
|
|
|
-- button text
|
|
|
|
love.graphics.setFont(font)
|
|
|
|
love.graphics.setColor(textnohovercolor)
|
|
|
|
love.graphics.print(text, x + imagewidth + 10, y + height/2 - theight/2)
|
|
|
|
else
|
|
|
|
-- button text
|
|
|
|
love.graphics.setFont(font)
|
|
|
|
love.graphics.setColor(textnohovercolor)
|
|
|
|
love.graphics.print(text, x + 5, y + height/2 - theight/2)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: DrawMultiChoice(object)
|
|
|
|
- desc: draws the multi choice object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawMultiChoice(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local text = object:GetText()
|
|
|
|
local choice = object:GetChoice()
|
|
|
|
local image = skin.images["multichoice-arrow.png"]
|
|
|
|
local font = skin.controls.multichoice_text_font
|
|
|
|
local theight = font:getHeight("a")
|
|
|
|
local bodycolor = skin.controls.multichoice_body_color
|
|
|
|
local textcolor = skin.controls.multichoice_text_color
|
|
|
|
|
|
|
|
image:setFilter("nearest", "nearest")
|
|
|
|
|
|
|
|
love.graphics.setColor(bodycolor)
|
|
|
|
love.graphics.rectangle("fill", x + 1, y + 1, width - 2, height - 2)
|
|
|
|
|
|
|
|
love.graphics.setColor(textcolor)
|
|
|
|
love.graphics.setFont(font)
|
|
|
|
|
|
|
|
if choice == "" then
|
|
|
|
love.graphics.print(text, x + 5, y + height/2 - theight/2)
|
|
|
|
else
|
|
|
|
love.graphics.print(choice, x + 5, y + height/2 - theight/2)
|
|
|
|
end
|
|
|
|
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, x + width - 20, y + 5)
|
|
|
|
|
|
|
|
love.graphics.setColor(bordercolor)
|
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: DrawMultiChoiceList(object)
|
|
|
|
- desc: draws the multi choice list object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawMultiChoiceList(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local bodycolor = skin.controls.multichoicelist_body_color
|
|
|
|
|
|
|
|
love.graphics.setColor(bodycolor)
|
|
|
|
love.graphics.rectangle("fill", x, y, width, height)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: DrawOverMultiChoiceList(object)
|
|
|
|
- desc: draws over the multi choice list object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawOverMultiChoiceList(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
|
|
|
|
love.graphics.setColor(bordercolor)
|
|
|
|
skin.OutlinedRectangle(x, y - 1, width, height + 1)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: DrawMultiChoiceRow(object)
|
|
|
|
- desc: draws the multi choice row object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawMultiChoiceRow(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local text = object:GetText()
|
|
|
|
local font = skin.controls.multichoicerow_text_font
|
|
|
|
local bodyhovecolor = skin.controls.multichoicerow_body_hover_color
|
|
|
|
local texthovercolor = skin.controls.multichoicerow_text_hover_color
|
|
|
|
local bodynohovercolor = skin.controls.multichoicerow_body_nohover_color
|
|
|
|
local textnohovercolor = skin.controls.multichoicerow_text_nohover_color
|
|
|
|
|
|
|
|
love.graphics.setFont(font)
|
|
|
|
|
|
|
|
if object.hover then
|
|
|
|
love.graphics.setColor(bodyhovecolor)
|
|
|
|
love.graphics.rectangle("fill", x, y, width, height)
|
|
|
|
love.graphics.setColor(texthovercolor)
|
|
|
|
love.graphics.print(text, x + 5, y + 5)
|
|
|
|
else
|
|
|
|
love.graphics.setColor(bodynohovercolor)
|
|
|
|
love.graphics.rectangle("fill", x, y, width, height)
|
|
|
|
love.graphics.setColor(textnohovercolor)
|
|
|
|
love.graphics.print(text, x + 5, y + 5)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: DrawToolTip(object)
|
|
|
|
- desc: draws the tool tip object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawToolTip(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local bodycolor = skin.controls.tooltip_body_color
|
|
|
|
|
|
|
|
love.graphics.setColor(bodycolor)
|
|
|
|
love.graphics.rectangle("fill", x, y, width, height)
|
|
|
|
love.graphics.setColor(bordercolor)
|
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: DrawText(object)
|
|
|
|
- desc: draws the text object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawText(object)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: DrawTextInput(object)
|
|
|
|
- desc: draws the text input object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawTextInput(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local font = object:GetFont()
|
|
|
|
local focus = object:GetFocus()
|
|
|
|
local showindicator = object:GetIndicatorVisibility()
|
|
|
|
local alltextselected = object:IsAllTextSelected()
|
|
|
|
local textx = object:GetTextX()
|
|
|
|
local texty = object:GetTextY()
|
|
|
|
local text = object:GetText()
|
|
|
|
local multiline = object:GetMultiLine()
|
|
|
|
local lines = object:GetLines()
|
2013-11-07 23:24:23 +00:00
|
|
|
local placeholder = object:GetPlaceholderText()
|
2013-02-11 21:15:40 +00:00
|
|
|
local offsetx = object:GetOffsetX()
|
|
|
|
local offsety = object:GetOffsetY()
|
|
|
|
local indicatorx = object:GetIndicatorX()
|
|
|
|
local indicatory = object:GetIndicatorY()
|
|
|
|
local vbar = object:HasVerticalScrollBar()
|
|
|
|
local hbar = object:HasHorizontalScrollBar()
|
|
|
|
local linenumbers = object:GetLineNumbersEnabled()
|
|
|
|
local itemwidth = object:GetItemWidth()
|
2013-10-21 16:25:50 +00:00
|
|
|
local masked = object:GetMasked()
|
2013-02-11 21:15:40 +00:00
|
|
|
local theight = font:getHeight("a")
|
|
|
|
local bodycolor = skin.controls.textinput_body_color
|
|
|
|
local textnormalcolor = skin.controls.textinput_text_normal_color
|
2013-11-06 22:50:26 +00:00
|
|
|
local textplaceholdercolor = skin.controls.textinput_text_placeholder_color
|
2013-02-11 21:15:40 +00:00
|
|
|
local textselectedcolor = skin.controls.textinput_text_selected_color
|
|
|
|
local highlightbarcolor = skin.controls.textinput_highlight_bar_color
|
|
|
|
local indicatorcolor = skin.controls.textinput_indicator_color
|
|
|
|
|
|
|
|
love.graphics.setColor(bodycolor)
|
|
|
|
love.graphics.rectangle("fill", x, y, width, height)
|
|
|
|
|
|
|
|
if alltextselected then
|
|
|
|
local bary = 0
|
|
|
|
if multiline then
|
|
|
|
for i=1, #lines do
|
2013-10-21 16:25:50 +00:00
|
|
|
local str = lines[i]
|
|
|
|
if masked then
|
|
|
|
str = str:gsub(".", "*")
|
|
|
|
end
|
|
|
|
local twidth = font:getWidth(str)
|
2013-02-24 16:59:03 +00:00
|
|
|
if twidth == 0 then
|
|
|
|
twidth = 5
|
|
|
|
end
|
2013-02-11 21:15:40 +00:00
|
|
|
love.graphics.setColor(highlightbarcolor)
|
|
|
|
love.graphics.rectangle("fill", textx, texty + bary, twidth, theight)
|
|
|
|
bary = bary + theight
|
|
|
|
end
|
|
|
|
else
|
2013-10-21 16:25:50 +00:00
|
|
|
local twidth = 0
|
|
|
|
if masked then
|
|
|
|
local maskchar = object:GetMaskChar()
|
|
|
|
twidth = font:getWidth(text:gsub(".", maskchar))
|
|
|
|
else
|
|
|
|
twidth = font:getWidth(text)
|
|
|
|
end
|
2013-02-11 21:15:40 +00:00
|
|
|
love.graphics.setColor(highlightbarcolor)
|
|
|
|
love.graphics.rectangle("fill", textx, texty, twidth, theight)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if showindicator and focus then
|
|
|
|
love.graphics.setColor(indicatorcolor)
|
|
|
|
love.graphics.rectangle("fill", indicatorx, indicatory, 1, theight)
|
|
|
|
end
|
|
|
|
|
|
|
|
if not multiline then
|
|
|
|
object:SetTextOffsetY(height/2 - theight/2)
|
|
|
|
if offsetx ~= 0 then
|
|
|
|
object:SetTextOffsetX(0)
|
|
|
|
else
|
|
|
|
object:SetTextOffsetX(5)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
if vbar then
|
|
|
|
if offsety ~= 0 then
|
|
|
|
if hbar then
|
|
|
|
object:SetTextOffsetY(5)
|
|
|
|
else
|
|
|
|
object:SetTextOffsetY(-5)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
object:SetTextOffsetY(5)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
object:SetTextOffsetY(5)
|
|
|
|
end
|
|
|
|
|
|
|
|
if hbar then
|
|
|
|
if offsety ~= 0 then
|
|
|
|
if linenumbers then
|
|
|
|
local panel = object:GetLineNumbersPanel()
|
|
|
|
if vbar then
|
|
|
|
object:SetTextOffsetX(5)
|
|
|
|
else
|
|
|
|
object:SetTextOffsetX(-5)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
if vbar then
|
|
|
|
object:SetTextOffsetX(5)
|
|
|
|
else
|
|
|
|
object:SetTextOffsetX(-5)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
object:SetTextOffsetX(5)
|
|
|
|
end
|
|
|
|
else
|
|
|
|
object:SetTextOffsetX(5)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
textx = object:GetTextX()
|
|
|
|
texty = object:GetTextY()
|
|
|
|
|
|
|
|
love.graphics.setFont(font)
|
|
|
|
|
|
|
|
if alltextselected then
|
|
|
|
love.graphics.setColor(textselectedcolor)
|
2013-11-06 22:50:26 +00:00
|
|
|
elseif #lines == 1 and lines[1] == "" then
|
|
|
|
love.graphics.setColor(textplaceholdercolor)
|
2013-02-11 21:15:40 +00:00
|
|
|
else
|
|
|
|
love.graphics.setColor(textnormalcolor)
|
|
|
|
end
|
|
|
|
|
2013-10-21 16:25:50 +00:00
|
|
|
local str = ""
|
2013-02-11 21:15:40 +00:00
|
|
|
if multiline then
|
|
|
|
for i=1, #lines do
|
2013-10-21 16:25:50 +00:00
|
|
|
str = lines[i]
|
|
|
|
if masked then
|
|
|
|
local maskchar = object:GetMaskChar()
|
|
|
|
str = str:gsub(".", maskchar)
|
|
|
|
end
|
2013-11-07 23:24:23 +00:00
|
|
|
love.graphics.print(#str > 0 and str or (#lines == 1 and placeholder or ""), textx, texty + theight * i - theight)
|
2013-02-11 21:15:40 +00:00
|
|
|
end
|
|
|
|
else
|
2013-10-21 16:25:50 +00:00
|
|
|
str = lines[1]
|
|
|
|
if masked then
|
|
|
|
local maskchar = object:GetMaskChar()
|
|
|
|
str = str:gsub(".", maskchar)
|
|
|
|
end
|
2013-11-06 22:50:26 +00:00
|
|
|
love.graphics.print(#str > 0 and str or placeholder, textx, texty)
|
2013-02-11 21:15:40 +00:00
|
|
|
end
|
2013-10-21 16:25:50 +00:00
|
|
|
|
2013-12-26 18:30:35 +00:00
|
|
|
love.graphics.setColor(230, 230, 230, 255)
|
|
|
|
skin.OutlinedRectangle(x + 1, y + 1, width - 2, height - 2)
|
|
|
|
|
2013-02-11 21:15:40 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: DrawOverTextInput(object)
|
|
|
|
- desc: draws over the text input object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawOverTextInput(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
|
|
|
|
love.graphics.setColor(bordercolor)
|
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: DrawScrollButton(object)
|
|
|
|
- desc: draws the scroll button object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawScrollButton(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local hover = object:GetHover()
|
|
|
|
local scrolltype = object:GetScrollType()
|
|
|
|
local down = object.down
|
|
|
|
local bodydowncolor = skin.controls.button_body_down_color
|
|
|
|
local bodyhovercolor = skin.controls.button_body_hover_color
|
|
|
|
local bodynohovercolor = skin.controls.button_body_nohover_color
|
|
|
|
|
|
|
|
if down then
|
|
|
|
-- button body
|
2013-02-24 16:59:03 +00:00
|
|
|
local image = skin.images["button-down.png"]
|
|
|
|
local imageheight = image:getHeight()
|
|
|
|
local scaley = height/imageheight
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, x, y, 0, width, scaley)
|
2013-02-11 21:15:40 +00:00
|
|
|
-- button border
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(bordercolor)
|
2013-02-11 21:15:40 +00:00
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
|
|
|
|
elseif hover then
|
|
|
|
-- button body
|
2013-02-24 16:59:03 +00:00
|
|
|
local image = skin.images["button-hover.png"]
|
|
|
|
local imageheight = image:getHeight()
|
|
|
|
local scaley = height/imageheight
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, x, y, 0, width, scaley)
|
2013-02-11 21:15:40 +00:00
|
|
|
-- button border
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(bordercolor)
|
2013-02-11 21:15:40 +00:00
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
else
|
|
|
|
-- button body
|
2013-02-24 16:59:03 +00:00
|
|
|
local image = skin.images["button-nohover.png"]
|
|
|
|
local imageheight = image:getHeight()
|
|
|
|
local scaley = height/imageheight
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, x, y, 0, width, scaley)
|
2013-02-11 21:15:40 +00:00
|
|
|
-- button border
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(bordercolor)
|
2013-02-11 21:15:40 +00:00
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
end
|
|
|
|
|
|
|
|
if scrolltype == "up" then
|
|
|
|
local image = skin.images["arrow-up.png"]
|
|
|
|
local imagewidth = image:getWidth()
|
|
|
|
local imageheight = image:getHeight()
|
|
|
|
image:setFilter("nearest", "nearest")
|
|
|
|
if hover then
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
else
|
|
|
|
love.graphics.setColor(255, 255, 255, 150)
|
|
|
|
end
|
|
|
|
love.graphics.draw(image, x + width/2 - imagewidth/2, y + height/2 - imageheight/2)
|
|
|
|
elseif scrolltype == "down" then
|
|
|
|
local image = skin.images["arrow-down.png"]
|
|
|
|
local imagewidth = image:getWidth()
|
|
|
|
local imageheight = image:getHeight()
|
|
|
|
image:setFilter("nearest", "nearest")
|
|
|
|
if hover then
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
else
|
|
|
|
love.graphics.setColor(255, 255, 255, 150)
|
|
|
|
end
|
|
|
|
love.graphics.draw(image, x + width/2 - imagewidth/2, y + height/2 - imageheight/2)
|
|
|
|
elseif scrolltype == "left" then
|
|
|
|
local image = skin.images["arrow-left.png"]
|
|
|
|
local imagewidth = image:getWidth()
|
|
|
|
local imageheight = image:getHeight()
|
|
|
|
image:setFilter("nearest", "nearest")
|
|
|
|
if hover then
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
else
|
|
|
|
love.graphics.setColor(255, 255, 255, 150)
|
|
|
|
end
|
|
|
|
love.graphics.draw(image, x + width/2 - imagewidth/2, y + height/2 - imageheight/2)
|
|
|
|
elseif scrolltype == "right" then
|
|
|
|
local image = skin.images["arrow-right.png"]
|
|
|
|
local imagewidth = image:getWidth()
|
|
|
|
local imageheight = image:getHeight()
|
|
|
|
image:setFilter("nearest", "nearest")
|
|
|
|
if hover then
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
else
|
|
|
|
love.graphics.setColor(255, 255, 255, 150)
|
|
|
|
end
|
|
|
|
love.graphics.draw(image, x + width/2 - imagewidth/2, y + height/2 - imageheight/2)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: skin.DrawSlider(object)
|
|
|
|
- desc: draws the slider object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawSlider(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local slidtype = object:GetSlideType()
|
|
|
|
local baroutlinecolor = skin.controls.slider_bar_outline_color
|
|
|
|
|
|
|
|
if slidtype == "horizontal" then
|
|
|
|
love.graphics.setColor(baroutlinecolor)
|
|
|
|
love.graphics.rectangle("fill", x, y + height/2 - 5, width, 10)
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(bordercolor)
|
2013-02-11 21:15:40 +00:00
|
|
|
love.graphics.rectangle("fill", x + 5, y + height/2, width - 10, 1)
|
|
|
|
elseif slidtype == "vertical" then
|
|
|
|
love.graphics.setColor(baroutlinecolor)
|
|
|
|
love.graphics.rectangle("fill", x + width/2 - 5, y, 10, height)
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(bordercolor)
|
2013-02-11 21:15:40 +00:00
|
|
|
love.graphics.rectangle("fill", x + width/2, y + 5, 1, height - 10)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: skin.DrawSliderButton(object)
|
|
|
|
- desc: draws the slider button object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawSliderButton(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local hover = object:GetHover()
|
|
|
|
local down = object.down
|
2013-02-24 16:59:03 +00:00
|
|
|
local parent = object:GetParent()
|
|
|
|
local enabled = parent:GetEnabled()
|
2013-02-11 21:15:40 +00:00
|
|
|
local bodydowncolor = skin.controls.button_body_down_color
|
|
|
|
local bodyhovercolor = skin.controls.button_body_hover_color
|
|
|
|
local bodynohvercolor = skin.controls.button_body_nohover_color
|
2013-02-24 16:59:03 +00:00
|
|
|
|
|
|
|
if not enabled then
|
|
|
|
local image = skin.images["button-unclickable.png"]
|
|
|
|
local imageheight = image:getHeight()
|
|
|
|
local scaley = height/imageheight
|
|
|
|
-- button body
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, x, y, 0, width, scaley)
|
|
|
|
-- button border
|
|
|
|
love.graphics.setColor(bordercolor)
|
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
return
|
|
|
|
end
|
2013-02-11 21:15:40 +00:00
|
|
|
|
|
|
|
if down then
|
|
|
|
-- button body
|
2013-02-24 16:59:03 +00:00
|
|
|
local image = skin.images["button-down.png"]
|
|
|
|
local imageheight = image:getHeight()
|
|
|
|
local scaley = height/imageheight
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, x, y, 0, width, scaley)
|
2013-02-11 21:15:40 +00:00
|
|
|
-- button border
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(bordercolor)
|
2013-02-11 21:15:40 +00:00
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
elseif hover then
|
|
|
|
-- button body
|
2013-02-24 16:59:03 +00:00
|
|
|
local image = skin.images["button-hover.png"]
|
|
|
|
local imageheight = image:getHeight()
|
|
|
|
local scaley = height/imageheight
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, x, y, 0, width, scaley)
|
2013-02-11 21:15:40 +00:00
|
|
|
-- button border
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(bordercolor)
|
2013-02-11 21:15:40 +00:00
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
else
|
|
|
|
-- button body
|
2013-02-24 16:59:03 +00:00
|
|
|
local image = skin.images["button-nohover.png"]
|
|
|
|
local imageheight = image:getHeight()
|
|
|
|
local scaley = height/imageheight
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, x, y, 0, width, scaley)
|
2013-02-11 21:15:40 +00:00
|
|
|
-- button border
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(bordercolor)
|
2013-02-11 21:15:40 +00:00
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: skin.DrawCheckBox(object)
|
|
|
|
- desc: draws the check box object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawCheckBox(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetBoxWidth()
|
|
|
|
local height = object:GetBoxHeight()
|
|
|
|
local checked = object:GetChecked()
|
|
|
|
local hover = object:GetHover()
|
|
|
|
local bodycolor = skin.controls.checkbox_body_color
|
|
|
|
local checkcolor = skin.controls.checkbox_check_color
|
|
|
|
|
|
|
|
love.graphics.setColor(bodycolor)
|
|
|
|
love.graphics.rectangle("fill", x, y, width, height)
|
|
|
|
|
|
|
|
love.graphics.setColor(bordercolor)
|
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
|
|
|
|
if checked then
|
|
|
|
love.graphics.setColor(checkcolor)
|
|
|
|
love.graphics.rectangle("fill", x + 4, y + 4, width - 8, height - 8)
|
|
|
|
end
|
|
|
|
|
|
|
|
if hover then
|
|
|
|
love.graphics.setColor(bordercolor)
|
|
|
|
skin.OutlinedRectangle(x + 4, y + 4, width - 8, height - 8)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: skin.DrawCollapsibleCategory(object)
|
|
|
|
- desc: draws the collapsible category object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawCollapsibleCategory(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local text = object:GetText()
|
2013-08-15 02:09:22 +00:00
|
|
|
local open = object:GetOpen()
|
2013-02-11 21:15:40 +00:00
|
|
|
local textcolor = skin.controls.collapsiblecategory_text_color
|
|
|
|
local font = smallfont
|
2013-02-24 16:59:03 +00:00
|
|
|
local image = skin.images["button-nohover.png"]
|
2013-12-26 18:30:35 +00:00
|
|
|
local topbarimage = skin.images["frame-topbar.png"]
|
|
|
|
local topbarimage_width = topbarimage:getWidth()
|
|
|
|
local topbarimage_height = topbarimage:getHeight()
|
|
|
|
local topbarimage_scalex = width/topbarimage_width
|
|
|
|
local topbarimage_scaley = 25/topbarimage_height
|
2013-02-24 16:59:03 +00:00
|
|
|
local imageheight = image:getHeight()
|
|
|
|
local scaley = height/imageheight
|
2013-02-11 21:15:40 +00:00
|
|
|
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, x, y, 0, width, scaley)
|
2013-02-11 21:15:40 +00:00
|
|
|
|
2013-12-26 18:30:35 +00:00
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(topbarimage, x, y, 0, topbarimage_scalex, topbarimage_scaley)
|
2013-02-11 21:15:40 +00:00
|
|
|
|
|
|
|
love.graphics.setColor(bordercolor)
|
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
|
2013-08-15 02:09:22 +00:00
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
if open then
|
|
|
|
local icon = skin.images["collapse.png"]
|
2013-08-15 19:28:18 +00:00
|
|
|
icon:setFilter("nearest", "nearest")
|
|
|
|
love.graphics.draw(icon, x + width - 21, y + 5)
|
2013-12-26 18:30:35 +00:00
|
|
|
love.graphics.setColor(255, 255, 255, 70)
|
|
|
|
skin.OutlinedRectangle(x + 1, y + 1, width - 2, 24)
|
2013-08-15 02:09:22 +00:00
|
|
|
else
|
|
|
|
local icon = skin.images["expand.png"]
|
2013-08-15 19:28:18 +00:00
|
|
|
icon:setFilter("nearest", "nearest")
|
|
|
|
love.graphics.draw(icon, x + width - 21, y + 5)
|
2013-12-26 18:30:35 +00:00
|
|
|
love.graphics.setColor(255, 255, 255, 70)
|
|
|
|
skin.OutlinedRectangle(x + 1, y + 1, width - 2, 23)
|
2013-08-15 02:09:22 +00:00
|
|
|
end
|
|
|
|
|
2013-12-26 18:30:35 +00:00
|
|
|
love.graphics.setFont(font)
|
|
|
|
love.graphics.setColor(textcolor)
|
|
|
|
love.graphics.print(text, x + 5, y + 5)
|
|
|
|
|
2013-02-11 21:15:40 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: skin.DrawColumnList(object)
|
|
|
|
- desc: draws the column list object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawColumnList(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local bodycolor = skin.controls.columnlist_body_color
|
|
|
|
|
|
|
|
love.graphics.setColor(bodycolor)
|
|
|
|
love.graphics.rectangle("fill", x, y, width, height)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: skin.DrawColumnListHeader(object)
|
|
|
|
- desc: draws the column list header object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawColumnListHeader(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local hover = object:GetHover()
|
|
|
|
local name = object:GetName()
|
|
|
|
local down = object.down
|
|
|
|
local font = skin.controls.columnlistheader_text_font
|
|
|
|
local twidth = font:getWidth(object.name)
|
|
|
|
local theight = font:getHeight(object.name)
|
|
|
|
local bodydowncolor = skin.controls.columnlistheader_body_down_color
|
|
|
|
local textdowncolor = skin.controls.columnlistheader_text_down_color
|
|
|
|
local bodyhovercolor = skin.controls.columnlistheader_body_hover_color
|
|
|
|
local textdowncolor = skin.controls.columnlistheader_text_hover_color
|
|
|
|
local nohovercolor = skin.controls.columnlistheader_body_nohover_color
|
|
|
|
local textnohovercolor = skin.controls.columnlistheader_text_nohover_color
|
|
|
|
|
|
|
|
if down then
|
2013-02-24 16:59:03 +00:00
|
|
|
local image = skin.images["button-down.png"]
|
|
|
|
local imageheight = image:getHeight()
|
|
|
|
local scaley = height/imageheight
|
2013-02-11 21:15:40 +00:00
|
|
|
-- header body
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, x, y, 0, width, scaley)
|
2013-02-11 21:15:40 +00:00
|
|
|
-- header name
|
|
|
|
love.graphics.setFont(font)
|
|
|
|
love.graphics.setColor(textdowncolor)
|
|
|
|
love.graphics.print(name, x + width/2 - twidth/2, y + height/2 - theight/2)
|
|
|
|
-- header border
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(bordercolor)
|
2013-02-11 21:15:40 +00:00
|
|
|
skin.OutlinedRectangle(x, y, width, height, false, false, false, true)
|
|
|
|
elseif hover then
|
2013-02-24 16:59:03 +00:00
|
|
|
local image = skin.images["button-hover.png"]
|
|
|
|
local imageheight = image:getHeight()
|
|
|
|
local scaley = height/imageheight
|
2013-02-11 21:15:40 +00:00
|
|
|
-- header body
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, x, y, 0, width, scaley)
|
2013-02-11 21:15:40 +00:00
|
|
|
-- header name
|
|
|
|
love.graphics.setFont(font)
|
|
|
|
love.graphics.setColor(textdowncolor)
|
|
|
|
love.graphics.print(name, x + width/2 - twidth/2, y + height/2 - theight/2)
|
|
|
|
-- header border
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(bordercolor)
|
2013-02-11 21:15:40 +00:00
|
|
|
skin.OutlinedRectangle(x, y, width, height, false, false, false, true)
|
|
|
|
else
|
2013-02-24 16:59:03 +00:00
|
|
|
local image = skin.images["button-nohover.png"]
|
|
|
|
local imageheight = image:getHeight()
|
|
|
|
local scaley = height/imageheight
|
2013-02-11 21:15:40 +00:00
|
|
|
-- header body
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, x, y, 0, width, scaley)
|
2013-02-11 21:15:40 +00:00
|
|
|
-- header name
|
|
|
|
love.graphics.setFont(font)
|
|
|
|
love.graphics.setColor(textnohovercolor)
|
|
|
|
love.graphics.print(name, x + width/2 - twidth/2, y + height/2 - theight/2)
|
|
|
|
-- header border
|
2013-02-24 16:59:03 +00:00
|
|
|
love.graphics.setColor(bordercolor)
|
2013-02-11 21:15:40 +00:00
|
|
|
skin.OutlinedRectangle(x, y, width, height, false, false, false, true)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: skin.DrawColumnListArea(object)
|
|
|
|
- desc: draws the column list area object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawColumnListArea(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local bodycolor = skin.controls.columnlistarea_body_color
|
|
|
|
|
|
|
|
love.graphics.setColor(bodycolor)
|
|
|
|
love.graphics.rectangle("fill", x, y, width, height)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: skin.DrawOverColumnListArea(object)
|
|
|
|
- desc: draws over the column list area object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawOverColumnListArea(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
|
|
|
|
love.graphics.setColor(bordercolor)
|
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: skin.DrawColumnListRow(object)
|
|
|
|
- desc: draws the column list row object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawColumnListRow(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local colorindex = object:GetColorIndex()
|
|
|
|
local font = object:GetFont()
|
|
|
|
local columndata = object:GetColumnData()
|
|
|
|
local textx = object:GetTextX()
|
|
|
|
local texty = object:GetTextY()
|
|
|
|
local parent = object:GetParent()
|
|
|
|
local cwidth, cheight = parent:GetParent():GetColumnSize()
|
|
|
|
local theight = font:getHeight("a")
|
2013-06-10 16:34:01 +00:00
|
|
|
local hover = object:GetHover()
|
|
|
|
local selected = object:GetSelected()
|
2013-02-11 21:15:40 +00:00
|
|
|
local body1color = skin.controls.columnlistrow_body1_color
|
|
|
|
local body2color = skin.controls.columnlistrow_body2_color
|
2013-06-10 16:34:01 +00:00
|
|
|
local bodyhovercolor = skin.controls.columnlistrow_body_hover_color
|
|
|
|
local bodyselectedcolor = skin.controls.columnlistrow_body_selected_color
|
2013-02-11 21:15:40 +00:00
|
|
|
local textcolor = skin.controls.columnlistrow_text_color
|
2013-06-10 16:34:01 +00:00
|
|
|
local texthovercolor = skin.controls.columnlistrow_text_hover_color
|
|
|
|
local textselectedcolor = skin.controls.columnlistrow_text_selected_color
|
2013-02-11 21:15:40 +00:00
|
|
|
|
|
|
|
object:SetTextPos(5, height/2 - theight/2)
|
|
|
|
|
2013-06-10 16:34:01 +00:00
|
|
|
if selected then
|
|
|
|
love.graphics.setColor(bodyselectedcolor)
|
|
|
|
love.graphics.rectangle("fill", x, y, width, height)
|
|
|
|
elseif hover then
|
|
|
|
love.graphics.setColor(bodyhovercolor)
|
|
|
|
love.graphics.rectangle("fill", x, y, width, height)
|
|
|
|
elseif colorindex == 1 then
|
2013-02-11 21:15:40 +00:00
|
|
|
love.graphics.setColor(body1color)
|
2013-12-26 18:30:35 +00:00
|
|
|
love.graphics.rectangle("fill", x, y, width, height)
|
2013-02-11 21:15:40 +00:00
|
|
|
else
|
|
|
|
love.graphics.setColor(body2color)
|
|
|
|
love.graphics.rectangle("fill", x, y, width, height)
|
|
|
|
end
|
|
|
|
|
|
|
|
for k, v in ipairs(columndata) do
|
|
|
|
love.graphics.setFont(font)
|
2013-06-10 16:34:01 +00:00
|
|
|
if selected then
|
|
|
|
love.graphics.setColor(textselectedcolor)
|
|
|
|
elseif hover then
|
|
|
|
love.graphics.setColor(texthovercolor)
|
|
|
|
else
|
|
|
|
love.graphics.setColor(textcolor)
|
|
|
|
end
|
2013-08-12 13:48:51 +00:00
|
|
|
local text = v
|
|
|
|
love.graphics.print(text, x + textx, y + texty)
|
2013-02-11 21:15:40 +00:00
|
|
|
x = x + cwidth
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: skin.DrawModalBackground(object)
|
|
|
|
- desc: draws the modal background object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawModalBackground(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local bodycolor = skin.controls.modalbackground_body_color
|
|
|
|
|
|
|
|
love.graphics.setColor(bodycolor)
|
|
|
|
love.graphics.rectangle("fill", x, y, width, height)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: skin.DrawLineNumbersPanel(object)
|
|
|
|
- desc: draws the line numbers panel object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawLineNumbersPanel(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-02-11 21:15:40 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local offsety = object:GetOffsetY()
|
|
|
|
local parent = object:GetParent()
|
|
|
|
local lines = parent:GetLines()
|
|
|
|
local font = parent:GetFont()
|
|
|
|
local theight = font:getHeight("a")
|
|
|
|
local textcolor = skin.controls.linenumberspanel_text_color
|
2013-05-05 23:51:20 +00:00
|
|
|
local bodycolor = skin.controls.linenumberspanel_body_color
|
2013-02-11 21:15:40 +00:00
|
|
|
local mody = y
|
|
|
|
|
|
|
|
object:SetWidth(10 + font:getWidth(#lines))
|
|
|
|
love.graphics.setFont(font)
|
|
|
|
|
2013-05-05 23:51:20 +00:00
|
|
|
love.graphics.setColor(bodycolor)
|
2013-02-11 21:15:40 +00:00
|
|
|
love.graphics.rectangle("fill", x, y, width, height)
|
|
|
|
|
|
|
|
love.graphics.setColor(bordercolor)
|
2013-08-15 02:09:22 +00:00
|
|
|
--skin.OutlinedRectangle(x, y, width, height, true, true, true, false)
|
2013-02-11 21:15:40 +00:00
|
|
|
|
|
|
|
for i=1, #lines do
|
|
|
|
love.graphics.setColor(textcolor)
|
2013-05-05 23:51:20 +00:00
|
|
|
love.graphics.print(i, x + 5, mody - offsety)
|
2013-02-11 21:15:40 +00:00
|
|
|
mody = mody + theight
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: skin.DrawNumberBox(object)
|
|
|
|
- desc: draws the numberbox object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawNumberBox(object)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2013-05-05 23:51:20 +00:00
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: skin.DrawGrid(object)
|
|
|
|
- desc: draws the grid object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawGrid(object)
|
|
|
|
|
2013-08-12 13:48:51 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-05-05 23:51:20 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
2013-12-26 18:30:35 +00:00
|
|
|
local bodycolor = skin.controls.grid_body_color
|
2013-05-05 23:51:20 +00:00
|
|
|
|
|
|
|
love.graphics.setColor(bordercolor)
|
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
|
|
|
|
local cx = x
|
|
|
|
local cy = y
|
|
|
|
local cw = object.cellwidth + (object.cellpadding * 2)
|
|
|
|
local ch = object.cellheight + (object.cellpadding * 2)
|
|
|
|
|
|
|
|
for i=1, object.rows do
|
|
|
|
for n=1, object.columns do
|
|
|
|
local ovt = false
|
|
|
|
local ovl = false
|
|
|
|
if i > 1 then
|
|
|
|
ovt = true
|
|
|
|
end
|
|
|
|
if n > 1 then
|
|
|
|
ovl = true
|
|
|
|
end
|
2013-12-26 18:30:35 +00:00
|
|
|
love.graphics.setColor(bodycolor)
|
|
|
|
love.graphics.rectangle("fill", cx, cy, cw, ch)
|
|
|
|
love.graphics.setColor(bordercolor)
|
2013-05-05 23:51:20 +00:00
|
|
|
skin.OutlinedRectangle(cx, cy, cw, ch, ovt, false, ovl, false)
|
|
|
|
cx = cx + cw
|
|
|
|
end
|
|
|
|
cx = x
|
|
|
|
cy = cy + ch
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2013-11-25 13:06:41 +00:00
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: skin.DrawForm(object)
|
|
|
|
- desc: draws the form object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawForm(object)
|
|
|
|
|
2013-12-26 18:30:35 +00:00
|
|
|
local skin = object:GetSkin()
|
2013-11-25 13:06:41 +00:00
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local topmargin = object.topmargin
|
|
|
|
local name = object.name
|
|
|
|
local font = skin.controls.form_text_font
|
|
|
|
local textcolor = skin.controls.form_text_color
|
|
|
|
local twidth = font:getWidth(name)
|
|
|
|
|
|
|
|
love.graphics.setFont(font)
|
|
|
|
love.graphics.setColor(textcolor)
|
|
|
|
love.graphics.print(name, x + 7, y)
|
|
|
|
|
|
|
|
love.graphics.setColor(bordercolor)
|
|
|
|
love.graphics.rectangle("fill", x, y + 7, 5, 1)
|
|
|
|
love.graphics.rectangle("fill", x + twidth + 9, y + 7, width - (twidth + 9), 1)
|
|
|
|
love.graphics.rectangle("fill", x, y + height, width, 1)
|
|
|
|
love.graphics.rectangle("fill", x, y + 7, 1, height - 7)
|
|
|
|
love.graphics.rectangle("fill", x + width - 1, y + 7, 1, height - 7)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2013-12-26 18:30:35 +00:00
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: skin.DrawMenu(object)
|
|
|
|
- desc: draws the menu object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawMenu(object)
|
|
|
|
|
|
|
|
local skin = object:GetSkin()
|
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local bodycolor = skin.controls.menu_body_color
|
|
|
|
|
|
|
|
love.graphics.setColor(bodycolor)
|
|
|
|
love.graphics.rectangle("fill", x, y, width, height)
|
|
|
|
|
|
|
|
love.graphics.setColor(bordercolor)
|
|
|
|
skin.OutlinedRectangle(x, y, width, height)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
--[[---------------------------------------------------------
|
|
|
|
- func: skin.DrawMenuOption(object)
|
|
|
|
- desc: draws the menuoption object
|
|
|
|
--]]---------------------------------------------------------
|
|
|
|
function skin.DrawMenuOption(object)
|
|
|
|
|
|
|
|
local skin = object:GetSkin()
|
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
local hover = object:GetHover()
|
|
|
|
local text = object:GetText()
|
|
|
|
local icon = object:GetIcon()
|
|
|
|
local option_type = object.option_type
|
|
|
|
local body_hover_color = skin.controls.menuoption_body_hover_color
|
|
|
|
local text_hover_color = skin.controls.menuoption_text_hover_color
|
|
|
|
local text_color = skin.controls.menuoption_text_color
|
|
|
|
local twidth = smallfont:getWidth(text)
|
|
|
|
|
|
|
|
|
|
|
|
if option_type == "divider" then
|
|
|
|
love.graphics.setColor(200, 200, 200, 255)
|
|
|
|
love.graphics.rectangle("fill", x + 4, y + 2, width - 8, 1)
|
|
|
|
object.contentheight = 10
|
|
|
|
else
|
|
|
|
love.graphics.setFont(smallfont)
|
|
|
|
if hover then
|
|
|
|
love.graphics.setColor(body_hover_color)
|
|
|
|
love.graphics.rectangle("fill", x + 2, y + 2, width - 4, height - 4)
|
|
|
|
love.graphics.setColor(text_hover_color)
|
|
|
|
love.graphics.print(text, x + 26, y + 5)
|
|
|
|
else
|
|
|
|
love.graphics.setColor(text_color)
|
|
|
|
love.graphics.print(text, x + 26, y + 5)
|
|
|
|
end
|
|
|
|
if icon then
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(icon, x + 5, y + 5)
|
|
|
|
end
|
|
|
|
object.contentwidth = twidth + 31
|
|
|
|
object.contentheight = 25
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2014-06-29 05:16:25 +00:00
|
|
|
function skin.DrawTree(object)
|
|
|
|
|
|
|
|
local skin = object:GetSkin()
|
|
|
|
local x = object:GetX()
|
|
|
|
local y = object:GetY()
|
|
|
|
local width = object:GetWidth()
|
|
|
|
local height = object:GetHeight()
|
|
|
|
|
|
|
|
love.graphics.setColor(200, 200, 200, 255)
|
|
|
|
love.graphics.rectangle("fill", x, y, width, height)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
function skin.DrawTreeNode(object)
|
|
|
|
|
|
|
|
local icon = object.icon
|
|
|
|
local buttonimage = skin.images["tree-node-button-open.png"]
|
|
|
|
local width = 0
|
|
|
|
local x = object.x
|
|
|
|
local leftpadding = 15 * object.level
|
|
|
|
|
|
|
|
if object.level > 0 then
|
|
|
|
leftpadding = leftpadding + buttonimage:getWidth() + 5
|
|
|
|
else
|
|
|
|
leftpadding = buttonimage:getWidth() + 5
|
|
|
|
end
|
|
|
|
|
|
|
|
if icon then
|
|
|
|
local iconwidth = icon:getWidth()
|
|
|
|
width = width + iconwidth + loveframes.basicfont:getWidth(object.text) + leftpadding
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(icon, x + leftpadding, object.y)
|
|
|
|
love.graphics.setFont(loveframes.basicfont)
|
|
|
|
love.graphics.setColor(0, 0, 0, 255)
|
|
|
|
love.graphics.print(object.text, x + leftpadding + 2 + iconwidth, object.y + 2)
|
|
|
|
end
|
|
|
|
|
|
|
|
object:SetWidth(width + 5)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
function skin.DrawTreeNodeButton(object)
|
|
|
|
|
|
|
|
local leftpadding = 15 * object.parent.level
|
|
|
|
local image
|
|
|
|
|
|
|
|
if object.parent.open then
|
|
|
|
image = skin.images["tree-node-button-close.png"]
|
|
|
|
else
|
|
|
|
image = skin.images["tree-node-button-open.png"]
|
|
|
|
end
|
|
|
|
|
|
|
|
image:setFilter("nearest", "nearest")
|
|
|
|
|
|
|
|
love.graphics.setColor(255, 255, 255, 255)
|
|
|
|
love.graphics.draw(image, object.x, object.y)
|
|
|
|
|
|
|
|
object:SetPos(2 + leftpadding, 3)
|
|
|
|
object:SetSize(image:getWidth(), image:getHeight())
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2013-02-11 21:15:40 +00:00
|
|
|
-- register the skin
|
2013-12-26 18:30:35 +00:00
|
|
|
loveframes.skins.Register(skin)
|