mirror of
https://github.com/keharriso/love-nuklear.git
synced 2025-09-10 16:17:47 -04:00
Add drawing and input functions (#8)
* nk.widgetHasMousePressed * nk.widgetHasMouseReleased * nk.widgetIsMousePressed * nk.widgetIsMouseReleased * nk.line * nk.curve * nk.polygon * nk.circle * nk.ellipse * nk.arc * nk.rectMultiColor * nk.scissor * nk.image * nk.text * nk.inputHasMousePressed * nk.inputHasMouseReleased * nk.inputIsMousePressed * nk.inputIsMouseReleased * nk.inputWasHovered * nk.inputIsHovered
This commit is contained in:
parent
0b794f3538
commit
47a7a6044d
3 changed files with 444 additions and 6 deletions
21
example/draw.lua
Normal file
21
example/draw.lua
Normal file
|
@ -0,0 +1,21 @@
|
|||
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()
|
||||
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')
|
||||
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)
|
||||
end
|
||||
nk.windowEnd()
|
||||
end
|
|
@ -3,6 +3,7 @@
|
|||
local nk = require 'nuklear'
|
||||
|
||||
local calculator = require 'calculator'
|
||||
local draw = require 'draw'
|
||||
local overview = require 'overview'
|
||||
local style = require 'style'
|
||||
local skin = require 'skin'
|
||||
|
@ -16,12 +17,14 @@ function love.update(dt)
|
|||
calculator()
|
||||
style()
|
||||
overview()
|
||||
draw()
|
||||
skin()
|
||||
nk.frameEnd()
|
||||
end
|
||||
|
||||
function love.draw()
|
||||
nk.draw()
|
||||
love.graphics.print("Current FPS: "..tostring(love.timer.getFPS( )), 10, 10)
|
||||
end
|
||||
|
||||
function love.keypressed(key, scancode, isrepeat)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue