From 1f9f3ea4f3c88f19a7c9375ce11280dae4958204 Mon Sep 17 00:00:00 2001 From: Kevin Harrison Date: Mon, 14 Nov 2016 21:18:22 -0500 Subject: [PATCH] Updated Home (markdown) --- Home.md | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 82 insertions(+), 1 deletion(-) diff --git a/Home.md b/Home.md index a961a4b..0ce803a 100644 --- a/Home.md +++ b/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. \ No newline at end of file