Skip to content

Commit

Permalink
Merge pull request #41 from ax-jason/patch-1
Browse files Browse the repository at this point in the history
Scissor example
  • Loading branch information
keharriso authored Oct 17, 2019
2 parents b3af181 + 05dfdb5 commit ccfb6ec
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions example/overview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ local colorPicker = {value = '#ff0000'}
local property = {value = 6}
local edit = {value = 'Edit text'}
local comboA = {value = 1, items = {'A', 'B', 'C'}}
local scissorActive = false

return function (ui)
if ui:windowBegin('Overview', 100, 100, 600, 450, 'border', 'movable', 'title') then
Expand Down Expand Up @@ -49,6 +50,9 @@ return function (ui)
ui:spacing(1)
ui:checkbox('Checkbox A', checkA)
ui:checkbox('Checkbox B', checkB)
if ui:button('Scissor') then
scissorActive = not scissorActive
end
ui:groupEnd()
end
if ui:groupBegin('Group 2', 'border') then
Expand Down Expand Up @@ -104,4 +108,11 @@ return function (ui)
end
end
ui:windowEnd()
if(scissorActive) then
love.graphics.setScissor()
love.graphics.clear()
love.graphics.setScissor(130, 130, 500, 400)
else
love.graphics.setScissor()
end
end

0 comments on commit ccfb6ec

Please sign in to comment.