Compare commits

...

24 commits

Author SHA1 Message Date
Kevin Harrison
5336818494 Fix #62 2025-02-10 19:32:28 -05:00
Kevin Harrison
8d092eefa4 Update Nuklear version to latest 2023-08-27 11:37:31 -04:00
Kevin Harrison
1b8058071e Add key repeat to example 2023-08-27 11:35:54 -04:00
Kevin Harrison
829dc151c0 Replace global lua_State with local arguments 2023-08-27 11:27:51 -04:00
Kevin Harrison
e9be4aa952
Merge pull request #53 from MikuAuahDark/msvc
MSVC tweaks
2020-05-08 14:42:25 -04:00
Kevin Harrison
018aaf60a0 Prevent crash due to not returning value from layout_template_end 2020-05-08 14:41:31 -04:00
Miku AuahDark
0347818eca
Add MSVC build instructions. 2020-05-08 16:57:15 +08:00
Miku AuahDark
640a50532b
MSVC tweaks 2020-05-07 20:44:21 +08:00
Kevin Harrison
9ba37e4e4a
Merge pull request #51 from yannicka/patch-1
Update Nuklear repo URL in README
2020-04-25 17:40:54 -04:00
Yannick A
7491ab58b2
Update Nuklear repo URL in README 2020-04-25 23:35:58 +02:00
Kevin Harrison
d1cfcf2a47
Merge pull request #49 from megagrump/master
Fix typo in nk_love_style_push_progress
2020-04-14 17:44:24 -04:00
Grump
d41e9d1875 fix typo: cusor -> cursor 2020-04-14 09:27:36 +02:00
Kevin Harrison
efc53612bf
Merge pull request #44 from jyscao/readme_update
Add Guix build instruction in README
2019-12-20 09:39:16 -05:00
Jethro Cao
09cdd09716 Add Guix build instruction in README 2019-12-20 17:22:20 +07:00
Kevin Harrison
fef4e00a60
Merge pull request #43 from jyscao/cmake-update
Add install target
2019-12-04 13:04:43 -05:00
Jethro Cao
f33c94db66 Add install target
* this allows `$ make install` to also execute successfully
* without changing the output location of nuklear.so
2019-12-05 00:40:24 +07:00
Kevin Harrison
213be47f91
Merge pull request #42 from jyscao/nuklear-repo-update
Update Nuklear repo URL
2019-12-02 11:03:05 -05:00
Jethro Cao
f7ab5085f1 Update Nuklear repo URL 2019-12-02 14:37:05 +07:00
Kevin Harrison
0cca218ac7 Add support for *GetScroll and *SetScroll for windows, groups, and popups 2019-10-17 19:40:43 -04:00
Kevin Harrison
ccfb6ec005
Merge pull request #41 from ax-jason/patch-1
Scissor example
2019-10-17 19:24:51 -04:00
jason
b3af181896 Keep parent scissor setting 2019-10-17 19:20:44 -04:00
jason
05dfdb5c34
Scissor example
Scissor button example
2019-10-17 13:55:42 +08:00
Kevin Harrison
bf89bf9f08 Update build script to support more distros 2019-04-06 15:42:03 -04:00
Kevin Harrison
be9b57393a Expand Linux build instructions to cover more distros 2019-04-06 15:35:57 -04:00
9 changed files with 821 additions and 665 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
build/

2
.gitmodules vendored
View file

@ -1,3 +1,3 @@
[submodule "src/nuklear"]
path = src/nuklear
url = https://github.com/vurtun/nuklear.git
url = https://github.com/Immediate-Mode-UI/Nuklear.git

View file

@ -24,4 +24,14 @@ TARGET_LINK_LIBRARIES(
${LUA_LIBRARIES}
)
IF(MSVC)
TARGET_COMPILE_DEFINITIONS(${LIB_NAME} PRIVATE LUA_BUILD_AS_DLL)
endif(MSVC)
SET_TARGET_PROPERTIES("${LIB_NAME}" PROPERTIES PREFIX "")
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}" CACHE PATH "..." FORCE)
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
INSTALL(TARGETS "${LIB_NAME}" DESTINATION .)

View file

@ -1,6 +1,6 @@
# LÖVE-Nuklear
[Nuklear](https://github.com/vurtun/nuklear) module for the [LÖVE](https://love2d.org/) game engine.
[Nuklear](https://github.com/Immediate-Mode-UI/Nuklear) module for the [LÖVE](https://love2d.org/) game engine.
Provides a lightweight immediate mode GUI for LÖVE games.
@ -81,14 +81,14 @@ Windows binaries are available for each [release](https://github.com/keharriso/l
To build the library yourself, grab the code with:
```sh
$ git clone --recursive git@github.com:keharriso/love-nuklear.git
$ git clone --recursive https://github.com/keharriso/love-nuklear.git
```
Next, you need to compile the code to a native Lua module.
### Compiling with CMake on Linux
1. First, ensure you have the `cmake` and `luajit` packages installed, as well as `libluajit-5.1-dev` if your distro has this package.
1. First, ensure you have a C compiler and the `cmake` and `luajit` or `lua51-luajit` (for openSUSE) packages installed, as well as `libluajit-5.1-dev` (for Ubuntu/Debian), `luajit-devel` (for Fedora), or `lua51-luajit-devel` (for openSUSE) if your distro has one of these packages.
2. Create a new folder next to `love-nuklear` called `love-nuklear-build`.
3. Open a terminal inside `love-nuklear-build`.
4. Compile the library with
@ -96,7 +96,14 @@ Next, you need to compile the code to a native Lua module.
$ cmake -DCMAKE_BUILD_TYPE=Release ../love-nuklear
$ make
```
7. Locate `nuklear.so` in the build folder.
5. Locate `nuklear.so` in the build folder.
#### Via GNU Guix
LÖVE-Nuklear is also available as a [Guix](http://guix.gnu.org/) package, and can thus be directly downloaded and built via:
```
$ guix package --install love-nuklear
```
### Compiling with CMake and MinGW on Windows
@ -125,6 +132,22 @@ $ mingw32-make
```
18. Locate `nuklear.dll` inside the build folder.
### Compiling with CMake and MSVC on Windows
1. Install [CMake](https://cmake.org/download/) and [Visual Studio](https://visualstudio.microsoft.com/).
Community or Express edition is sufficient.
2. Download the source code for [LuaJIT](http://luajit.org/download.html).
3. Open a Visual Studio Command Prompt (x86 or x64 depending on what architecture you need)
and set the current directory to the LuaJIT folder (the one that contains "README"). Also
remember this path.
4. At the VS Command Prompt, set your current directory to `src` then
execute `msvcbuild.bat`. This will create lua51.dll, lua51.lib, and luajit.exe
5. Now open new command prompt window inside the `love-nuklear` folder.
6. Type `set "LUA_DIR=<path to directory at step 3>"`
7. Then type `cmake -Bbuild -H. -A Win32 -DLUA_INCLUDE_DIR=%LUA_DIR%\src -DLUA_LIBRARY=%LUA_DIR%\src\lua51.lib -DCMAKE_INSTALL_PREFIX=%CD%\install`.
If you previously compile LuaJIT using x64 VS command prompt, replace `Win32` with `x64` at above command.
8. Then type `cmake --build build --config Release --target install` and you'll found `nuklear.dll` inside "install" folder.
## Documentation
A complete description of all functions and style properties, alongside additional examples, is available at the [LÖVE-Nuklear wiki](https://github.com/keharriso/love-nuklear/wiki).

View file

@ -11,7 +11,7 @@
find_path(LUA_INCLUDE_DIR luajit.h
HINTS
ENV LUA_DIR
PATH_SUFFIXES include/luajit-2.0 include/luajit-2.1 include
PATH_SUFFIXES include/luajit-2.0 include/luajit-2.1 include/luajit-5_1-2.1 include
PATHS
~/Library/Frameworks
/Library/Frameworks

View file

@ -14,6 +14,7 @@ local transform = require 'transform'
local ui1, ui2
function love.load()
love.keyboard.setKeyRepeat(true)
ui1, ui2 = nuklear.newUI(), nuklear.newUI()
end

View file

@ -11,6 +11,7 @@ local colorPicker = {value = '#ff0000'}
local property = {value = 6}
local edit = {value = 'Edit text'}
local comboA = {value = 1, items = {'A', 'B', 'C'}}
local scissorActive = false
return function (ui)
if ui:windowBegin('Overview', 100, 100, 600, 450, 'border', 'movable', 'title') then
@ -49,6 +50,9 @@ return function (ui)
ui:spacing(1)
ui:checkbox('Checkbox A', checkA)
ui:checkbox('Checkbox B', checkB)
if ui:button('Scissor') then
scissorActive = not scissorActive
end
ui:groupEnd()
end
if ui:groupBegin('Group 2', 'border') then
@ -104,4 +108,11 @@ return function (ui)
end
end
ui:windowEnd()
if(scissorActive) then
love.graphics.setScissor()
love.graphics.clear()
love.graphics.setScissor(130, 130, 500, 400)
else
love.graphics.setScissor()
end
end

@ -1 +1 @@
Subproject commit 181cfd86c47ae83eceabaf4e640587b844e613b6
Subproject commit 614abce05b9455849bbf1519b7f86e53c78b04ab

File diff suppressed because it is too large Load diff