Updated Home (markdown)

Kevin Harrison 2016-11-14 21:18:22 -05:00
parent c654f659ec
commit 1f9f3ea4f3

83
Home.md

@ -1 +1,82 @@
Welcome to the love-nuklear wiki!
## About
**LÖVE-Nuklear** is a native Lua module for building immediate mode GUIs for [LÖVE](https://love2d.org/) games. It is a binding and back end for the [Nuklear](https://github.com/vurtun/nuklear) UI library. The binding makes use of Lua features such as optional arguments, tables, and dynamic typing to simplify the API.
## Building
The library uses CMake to build, and requires [LuaJIT](http://luajit.org/index.html) headers and libraries.
When fetching the code, you must also pull the required Nuklear code as a submodule. The simplest way to do this is to use:
```
$ git clone --recursive git@github.com:keharriso/love-nuklear.git
```
## Quickstart
The following program shows the basic code to set up and use the library, including initialization and event handling:
```
local nk = require 'nuklear'
function love.load()
love.keyboard.setKeyRepeat(true)
nk.init()
end
function love.update(dt)
nk.frame_begin()
-- Add UI code here
nk.frame_end()
end
function love.draw()
nk.draw()
end
function love.keypressed(key, scancode, isrepeat)
if nk.keypressed(key, scancode, isrepeat) then
return -- event consumed
end
end
function love.keyreleased(key, scancode)
if nk.keyreleased(key, scancode) then
return -- event consumed
end
end
function love.mousepressed(x, y, button, istouch)
if nk.mousepressed(x, y, button, istouch) then
return -- event consumed
end
end
function love.mousereleased(x, y, button, istouch)
if nk.mousereleased(x, y, button, istouch) then
return -- event consumed
end
end
function love.mousemoved(x, y, dx, dy, istouch)
if nk.mousemoved(x, y, dx, dy, istouch) then
return -- event consumed
end
end
function love.textinput(text)
if nk.textinput(text) then
return -- event consumed
end
end
function love.wheelmoved(x, y)
if nk.wheelmoved(x, y) then
return -- event consumed
end
end
```
Put your UI code between the `nk.frame_begin` and `nk.frame_end` calls. See the bundled [example](https://github.com/keharriso/love-nuklear/tree/master/example) for a brief sample of what the library can do.
## Documentation
See the [Documentation](https://github.com/keharriso/love-nuklear/wiki/Documentation) page for a complete description of all available functions and style items.