Skip to content

Commit

Permalink
Updated Grid to build 1058
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewmcwatters committed Aug 16, 2015
1 parent 94cc079 commit 35d4cb1
Show file tree
Hide file tree
Showing 37 changed files with 340 additions and 380 deletions.
7 changes: 6 additions & 1 deletion src/engine/client/chat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ function addText( ... )
end

if ( _CLIENT ) then
_G.g_Chat.output:insertText( table.concat( args, "\t" ) .. "\n" )
local chat = _G.g_Chat.output
local text = table.concat( args, "\t" )
chat:insertText( text .. "\n" )

-- TODO: Set hide time based on reading-time algorithm.
-- chat:setHideTime( math.huge )
end
end
26 changes: 7 additions & 19 deletions src/engine/client/gui/button.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,15 @@ button.canFocus = true

function button:button( parent, name, text )
gui.panel.panel( self, parent, name )
self.width = 216
self.height = 46
self.text = text or "Button"
self.width = 216
self.height = 46
self.text = text or "Button"
self.disabled = false

self:setScheme( "Default" )
end

function button:draw()
if ( not self:isVisible() ) then
return
end

self:drawBackground()
self:drawText()

Expand All @@ -33,7 +29,7 @@ end

function button:drawBackground()
local property = "button.backgroundColor"
local width = self:getWidth()
local width = self:getWidth()
local height = self:getHeight()

if ( self:isDisabled() ) then
Expand All @@ -59,7 +55,7 @@ end

function button:drawForeground()
local property = "button.outlineColor"
local width = self:getWidth()
local width = self:getWidth()
local height = self:getHeight()

if ( self:isDisabled() ) then
Expand Down Expand Up @@ -93,7 +89,7 @@ function button:drawText()
local font = self:getScheme( "font" )
graphics.setFont( font )
local x = self:getWidth() / 2 - font:getWidth( self:getText() ) / 2
local y = self:getHeight() / 2 - font:getHeight() / 2 - 2
local y = self:getHeight() / 2 - font:getHeight() / 2 - 2
graphics.print( self:getText(), x, y )
end

Expand All @@ -106,7 +102,7 @@ function button:isDisabled()
end

function button:keypressed( key, isrepeat )
if ( not self:isVisible() or not self.focus or self:isDisabled() ) then
if ( not self.focus or self:isDisabled() ) then
return
end

Expand All @@ -117,21 +113,13 @@ function button:keypressed( key, isrepeat )
end

function button:mousepressed( x, y, button )
if ( not self:isVisible() ) then
return
end

if ( self.mouseover and button == "l" ) then
self.mousedown = true
self:invalidate()
end
end

function button:mousereleased( x, y, button )
if ( not self:isVisible() ) then
return
end

if ( ( self.mousedown and self.mouseover ) and not self:isDisabled() ) then
self:onClick()
end
Expand Down
8 changes: 0 additions & 8 deletions src/engine/client/gui/checkbox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ function checkbox:checkbox( parent, name, text )
end

function checkbox:draw()
if ( not self:isVisible() ) then
return
end

self:drawCheck()
self:drawForeground()
self:drawLabel()
Expand Down Expand Up @@ -81,10 +77,6 @@ function checkbox:isChecked()
end

function checkbox:mousereleased( x, y, button )
if ( not self:isVisible() ) then
return
end

if ( ( self.mousedown and self.mouseover ) and not self:isDisabled() ) then
self:onClick()
self:setChecked( not self:isChecked() )
Expand Down
8 changes: 2 additions & 6 deletions src/engine/client/gui/closebutton.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,14 @@ closebutton.canFocus = false

function closebutton:closebutton( parent, name )
gui.button.button( self, parent, name )
self.width = 2 * 36 + 8 - 1
self.width = 2 * 36 + 8 - 1
self.height = 2 * 36 + 16 - 2
self.icon = self:getScheme( "closebutton.icon" )
self.icon = self:getScheme( "closebutton.icon" )
end

local round = math.round

function closebutton:draw()
if ( not self:isVisible() ) then
return
end

local property = "closebutton.iconColor"

if ( self.mousedown and self.mouseover ) then
Expand Down
4 changes: 2 additions & 2 deletions src/engine/client/gui/console/consoletextbox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function consoletextbox:consoletextbox( parent, name )
end

function consoletextbox:draw()
if ( not self:isVisible() or self:getHeight() == 1 ) then
if ( self:getHeight() == 1 ) then
return
end

Expand All @@ -35,7 +35,7 @@ function consoletextbox:drawBackground()
end

local property = "textbox.backgroundColor"
local width = self:getWidth()
local width = self:getWidth()
local height = self:getHeight()

graphics.setColor( self:getScheme( property ) )
Expand Down
12 changes: 0 additions & 12 deletions src/engine/client/gui/dropdownlist.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ function dropdownlist:addItem( item )
end

function dropdownlist:draw()
if ( not self:isVisible() ) then
return
end

self:drawBackground()
self:drawText()
self:drawIcon()
Expand Down Expand Up @@ -148,10 +144,6 @@ function dropdownlist:isChildMousedOver()
end

function dropdownlist:mousepressed( x, y, button )
if ( not self:isVisible() ) then
return
end

if ( button == "l" ) then
if ( self.mouseover ) then
self.mousedown = true
Expand All @@ -170,10 +162,6 @@ function dropdownlist:mousepressed( x, y, button )
end

function dropdownlist:mousereleased( x, y, button )
if ( not self:isVisible() ) then
return
end

if ( self.mousedown ) then
self.mousedown = false
self:invalidate()
Expand Down
8 changes: 0 additions & 8 deletions src/engine/client/gui/dropdownlistitem.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ function dropdownlistitem:dropdownlistitem( name, text )
end

function dropdownlistitem:draw()
if ( not self:isVisible() ) then
return
end

self:drawBackground()
self:drawText()

Expand Down Expand Up @@ -87,10 +83,6 @@ local function getParentFrame( self )
end

function dropdownlistitem:mousepressed( x, y, button )
if ( not self:isVisible() ) then
return
end

if ( self.mouseover and button == "l" ) then
self.mousedown = true
end
Expand Down
10 changes: 1 addition & 9 deletions src/engine/client/gui/dropdownlistitemgroup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ function dropdownlistitemgroup:addItem( item, default )
end

function dropdownlistitemgroup:draw()
if ( not self:isVisible() ) then
return
end

gui.panel.draw( self )

local property = "dropdownlistitem.backgroundColor"
Expand Down Expand Up @@ -69,10 +65,6 @@ function dropdownlistitemgroup:isVisible()
end

function dropdownlistitemgroup:mousepressed( x, y, button )
if ( not self:isVisible() ) then
return
end

if ( button == "l" ) then
local dropDownList = self:getDropDownList()
if ( dropDownList ~= gui.topPanel and
Expand All @@ -96,7 +88,7 @@ function dropdownlistitemgroup:updatePos()
local dropDownList = self:getDropDownList()
if ( dropDownList ) then
x, y = dropDownList:getX(), dropDownList:getY()
x, x = dropDownList:localToScreen( x, y )
x, y = dropDownList:localToScreen( x, y )
self:setPos( x, y + dropDownList:getHeight() )
end
end
Expand Down
10 changes: 3 additions & 7 deletions src/engine/client/gui/frame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ function frame:doModal()
end

function frame:draw()
if ( not self:isVisible() ) then
return
end

self:drawBackground()

gui.panel.draw( self )
Expand Down Expand Up @@ -212,7 +208,7 @@ function frame:moveFocus()
end

function frame:keypressed( key, isrepeat )
if ( not self:isVisible() or self.closing ) then
if ( self.closing ) then
return
end

Expand All @@ -233,7 +229,7 @@ local mouseIntersects = false
local pointinrectangle = math.pointinrectangle

function frame:mousepressed( x, y, button )
if ( not self:isVisible() or self.closing ) then
if ( self.closing ) then
return
end

Expand Down Expand Up @@ -390,7 +386,7 @@ function frame:mousepressed( x, y, button )
end

function frame:mousereleased( x, y, button )
if ( not self:isVisible() or self.closing ) then
if ( self.closing ) then
return
end

Expand Down
35 changes: 11 additions & 24 deletions src/engine/client/gui/frametab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,13 @@ class "frametab" ( gui.radiobutton )

function frametab:frametab( parent, name, text )
gui.radiobutton.radiobutton( self, parent, name, text )
self.text = text or "Frame Tab"
local font = self:getScheme( "font" )
self.width = font:getWidth( self.text ) + 2 * 24
self.text = text or "Frame Tab"
local font = self:getScheme( "font" )
self.width = font:getWidth( self.text ) + 2 * 24
self.height = 61
end

function frametab:draw()
if ( not self:isVisible() ) then
return
end

self:drawBackground()
self:drawText()

Expand All @@ -27,7 +23,7 @@ end

function frametab:drawBackground()
local property = "frametab.backgroundColor"
local width = self:getWidth()
local width = self:getWidth()
local height = self:getHeight()

if ( self:isSelected() ) then
Expand All @@ -40,13 +36,13 @@ function frametab:drawBackground()

graphics.setColor( self:getScheme( property ) )

local selected = self.mouseover or self:isSelected()
local selected = self.mouseover or self:isSelected()
local mouseover = self.mouseover and not self:isSelected()
graphics.rectangle( "fill",
0,
-1,
width - ( selected and 1 or 0 ),
height + 1 - ( mouseover and 1 or 0 ) )
0,
-1,
width - ( selected and 1 or 0 ),
height + 1 - ( mouseover and 1 or 0 ) )

width = width - 0.5
if ( selected ) then
Expand All @@ -56,7 +52,7 @@ function frametab:drawBackground()

graphics.setColor( self:getScheme( "frametab.outlineColor" ) )
graphics.line( width, -0.5,
width, height - 0.5 - ( self:isSelected() and 0 or 1 ) )
width, height - 0.5 - ( self:isSelected() and 0 or 1 ) )

if ( not self:isSelected() ) then
graphics.line( 0, height - 1, width, height - 1 )
Expand All @@ -75,15 +71,11 @@ function frametab:drawText()
local font = self:getScheme( "font" )
graphics.setFont( font )
local x = self:getWidth() / 2 - font:getWidth( self.text ) / 2
local y = self:getHeight() / 2 - font:getHeight() / 2
local y = self:getHeight() / 2 - font:getHeight() / 2
graphics.print( self.text, x, y )
end

function frametab:mousepressed( x, y, button )
if ( not self:isVisible() ) then
return
end

if ( self.mouseover and button == "l" ) then
self.mousedown = true

Expand All @@ -100,12 +92,7 @@ function frametab:mousepressed( x, y, button )
end

function frametab:mousereleased( x, y, button )
if ( not self:isVisible() ) then
return
end

self.mousedown = false

self:invalidate()
end

Expand Down
4 changes: 0 additions & 4 deletions src/engine/client/gui/frametabgroup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ function frametabgroup:addItem( tab )
end

function frametabgroup:draw()
if ( not self:isVisible() ) then
return
end

graphics.setColor( self:getScheme( "frametab.outlineColor" ) )
graphics.line( 0, -0.5, 0, self:getHeight() - 1.5 )

Expand Down
Loading

0 comments on commit 35d4cb1

Please sign in to comment.