Allow multiple contexts to persist at once

This commit is contained in:
Kevin Harrison 2016-12-19 22:27:42 -05:00
parent c2fefb0601
commit 47128fed66
8 changed files with 1748 additions and 1692 deletions

View file

@ -1,21 +1,19 @@
local nk = require "nuklear"
local img = love.graphics.newImage 'skin/button.png'
return function ()
if nk.windowBegin('Draw Example', 300, 300, 200, 200, 'title', 'movable', 'border') then
local x, y, w, h = nk.windowGetBounds()
return function (ui)
if ui:windowBegin('Draw Example', 300, 300, 200, 200, 'title', 'movable', 'border') then
local x, y, w, h = ui:windowGetBounds()
love.graphics.setColor(255, 0, 0)
nk.line(x + 10, y + 40, x + 50, y + 40, x + 50, y + 80)
nk.curve(x + 50, y + 80, x + 80, y + 40, x + 100, y + 80, x + 80, y + 80)
nk.polygon('line', x + 100, y + 150, x + 60, y + 140, x + 70, y + 70)
nk.circle('line', x + 130, y + 140, 50)
nk.ellipse('fill', x + 30, y + 150, 20, 40)
nk.arc('fill', x + 150, y + 80, 40, 3 * math.pi / 2, 2 * math.pi);
nk.rectMultiColor(x + 95, y + 50, 50, 50, '#ff0000', '#00ff00', '#0000ff', '#000000')
ui:line(x + 10, y + 40, x + 50, y + 40, x + 50, y + 80)
ui:curve(x + 50, y + 80, x + 80, y + 40, x + 100, y + 80, x + 80, y + 80)
ui:polygon('line', x + 100, y + 150, x + 60, y + 140, x + 70, y + 70)
ui:circle('line', x + 130, y + 140, 50)
ui:ellipse('fill', x + 30, y + 150, 20, 40)
ui:arc('fill', x + 150, y + 80, 40, 3 * math.pi / 2, 2 * math.pi);
ui:rectMultiColor(x + 95, y + 50, 50, 50, '#ff0000', '#00ff00', '#0000ff', '#000000')
love.graphics.setColor(255, 255, 255)
nk.image(img, x + 120, y + 120, 70, 50)
nk.text('DRAW TEXT', x + 15, y + 75, 100, 100)
ui:image(img, x + 120, y + 120, 70, 50)
ui:text('DRAW TEXT', x + 15, y + 75, 100, 100)
end
nk.windowEnd()
ui:windowEnd()
end