mirror of
https://github.com/keharriso/love-nuklear.git
synced 2025-09-10 16:17:47 -04:00
Allow multiple contexts to persist at once
This commit is contained in:
parent
c2fefb0601
commit
47128fed66
8 changed files with 1748 additions and 1692 deletions
|
@ -1,6 +1,6 @@
|
|||
-- Several simple examples.
|
||||
|
||||
local nk = require 'nuklear'
|
||||
local nuklear = require 'nuklear'
|
||||
|
||||
local calculator = require 'calculator'
|
||||
local draw = require 'draw'
|
||||
|
@ -8,49 +8,51 @@ local overview = require 'overview'
|
|||
local style = require 'style'
|
||||
local skin = require 'skin'
|
||||
|
||||
local ui
|
||||
|
||||
function love.load()
|
||||
nk.init()
|
||||
ui = nuklear.init()
|
||||
end
|
||||
|
||||
function love.update(dt)
|
||||
nk.frameBegin()
|
||||
calculator()
|
||||
style()
|
||||
overview()
|
||||
draw()
|
||||
skin()
|
||||
nk.frameEnd()
|
||||
ui:frameBegin()
|
||||
calculator(ui)
|
||||
style(ui)
|
||||
overview(ui)
|
||||
draw(ui)
|
||||
skin(ui)
|
||||
ui:frameEnd()
|
||||
end
|
||||
|
||||
function love.draw()
|
||||
nk.draw()
|
||||
ui:draw()
|
||||
love.graphics.print("Current FPS: "..tostring(love.timer.getFPS( )), 10, 10)
|
||||
end
|
||||
|
||||
function love.keypressed(key, scancode, isrepeat)
|
||||
nk.keypressed(key, scancode, isrepeat)
|
||||
ui:keypressed(key, scancode, isrepeat)
|
||||
end
|
||||
|
||||
function love.keyreleased(key, scancode)
|
||||
nk.keyreleased(key, scancode)
|
||||
ui:keyreleased(key, scancode)
|
||||
end
|
||||
|
||||
function love.mousepressed(x, y, button, istouch)
|
||||
nk.mousepressed(x, y, button, istouch)
|
||||
ui:mousepressed(x, y, button, istouch)
|
||||
end
|
||||
|
||||
function love.mousereleased(x, y, button, istouch)
|
||||
nk.mousereleased(x, y, button, istouch)
|
||||
ui:mousereleased(x, y, button, istouch)
|
||||
end
|
||||
|
||||
function love.mousemoved(x, y, dx, dy, istouch)
|
||||
nk.mousemoved(x, y, dx, dy, istouch)
|
||||
ui:mousemoved(x, y, dx, dy, istouch)
|
||||
end
|
||||
|
||||
function love.textinput(text)
|
||||
nk.textinput(text)
|
||||
ui:textinput(text)
|
||||
end
|
||||
|
||||
function love.wheelmoved(x, y)
|
||||
nk.wheelmoved(x, y)
|
||||
ui:wheelmoved(x, y)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue