nuklear
所有发展都在其他地方移动
亲爱的访客,
该存储库,问题跟踪器等被放弃,有利于https://git**h*ub.com/immediate–mode–ui/nuklear。此问题跟踪器中的任何活动,任何拉的请求等都将被忽略。
期待您在https://**githu*b.com/immediate-mode-ui/nuklear中收到您的来信。
nuklear社区
这是用ANSI C编写并在公共域下许可的最小状态立即模式图形用户界面工具包。它被设计为用于应用程序的简单嵌入式用户界面,没有任何依赖项,默认的渲染后端或OS窗口和输入处理,而是通过使用简单的输入状态进行输入和绘制将原始形状描述为输出作为输出的命令来提供非常模块化的库方法。因此,与其提供一个分层的库,该库试图在许多平台上抽象并渲染后端,而只关注实际的UI。
特征
- 立即模式图形用户界面工具包
- 单头库
- 用C89(ANSI C)写
- 小型代码库(〜18Kloc)
- 专注于便携性,效率和简单性
- 没有依赖项(如果不需要,甚至不是标准库)
- 完全可易加的和可定制的
- 如果需要或想要的(如果需要)
- UTF-8支持
- 没有全球或隐藏状态
- 可自定义的库模块(您可以编译并仅使用所需的内容)
- 可选的字体面包师和顶点缓冲区输出
- 文档
建筑
该库是一个单个标头文件中的自我包含的,可以在仅标头模式或实现模式下使用。默认情况下,仅包含标头模式,并允许在其他标题中包括此标头,并且不包含实际实现。
实现模式需要在一个.c/.cpp文件中定义预处理器宏NK_IMPLEMENTATION然后才能#include此文件,例如:
#define NK_IMPLEMENTATION
#include \" nuklear .h\"
重要的是:每次包含“ nuklear .h”时,您都必须定义相同的可选标志。这很重要,不要导致编译器错误,甚至会导致更严重的堆栈腐败。
画廊
例子
/* init gui state */ struct nk_context ctx ; nk_init_fixed ( & ctx , calloc ( 1 , MAX_MEMORY ), MAX_MEMORY , & font ); enum { EASY , HARD }; static int op = EASY ; static float value = 0.6f ; static int i = 20 ; if ( nk_begin ( & ctx , \"Show\" , nk_rect ( 50 , 50 , 220 , 220 ), NK_WINDOW_BORDER | NK_WINDOW_MOVABLE | NK_WINDOW_CLOSABLE )) { /* fixed widget pixel width */ nk_layout_row_static ( & ctx , 30 , 80 , 1 ); if ( nk_button_label ( & ctx , \"button\" )) { /* event handling */ } /* fixed widget window ratio width */ nk_layout_row_dynamic ( & ctx , 30 , 2 ); if ( nk_option_label ( & ctx , \"easy\" , op == EASY )) op = EASY ; if ( nk_option_label ( & ctx , \"hard\" , op == HARD )) op = HARD ; /* custom widget pixel width */ nk_layout_row_begin ( & ctx , NK_STATIC , 30 , 2 ); { nk_layout_row_push ( & ctx , 50 ); nk_label ( & ctx , \"Volume:\" , NK_TEXT_LEFT ); nk_layout_row_push ( & ctx , 110 ); nk_slider_float ( & ctx , 0 , & value , 1.0f , 0.1f ); } nk_layout_row_end ( & ctx ); } nk_end ( & ctx );
绑定
对于其他作者创建的不同的languges有许多nuklear绑定。我不能因为它们的质量而无法提高它们的质量,因为我不一定会精通这两种语言。此外,不能保证所有绑定将始终保持最新状态:
- Java by Guillaume Legris
- D由MateuszMuszyński
- Golang撰写的golang-ui@github.com
- rust by snuk182@github.com
- wasamasa@github.com的鸡肉
- Nim撰写的zacharycarter@github.com
- 卢阿
- 凯文· nuklear (Kevin Harrison)
- Moon nuklear撰写的Stefano Trettel
- Python
- William Emerison Six(基于CTYPES的包装器)的PY nuklear (PY Nuklear)
- pynk by nathanrw@github.com(cffi绑定)
- csharp/.net by cartman300@github.com
学分
由Micha Mettke以及Github的所有直接或间接贡献者开发。
Sean Barrett(公共领域)嵌入了stb_texedit , stb_truetype和stb_rectpack ,嵌入了Tristan Grimmer(MIT许可证)的ProggyClean.ttf字体。
非常感谢Omar Cornut(Ocornut@github)的IMGUI库,并为我提供了这个图书馆的灵感,Casey Muratori的手工制作英雄和他的原始直接模式图形用户界面和Sean Barrett为他令人惊叹的单人座图书馆提供了恢复我在图书馆中的信仰,并带来了我自己的一部分。最终,Apoorva Joshi为他的歌手档案包装纸。
执照
------------------------------------------------------------------------------
This software is available under 2 licenses -- choose whichever you prefer.
------------------------------------------------------------------------------
ALTERNATIVE A - MIT License
Copyright (c) 2017 Micha Mettke
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the \"Software\"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
------------------------------------------------------------------------------
ALTERNATIVE B - Public Domain (www.unlicense.org)
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
software, either in source code form or as a compiled binary, for any purpose,
commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this
software dedicate any and all copyright interest in the software to the public
domain. We make this dedication for the benefit of the public at large and to
the detriment of our heirs and successors. We intend this dedication to be an
overt act of relinquishment in perpetuity of all present and future rights to
this software under copyright law.
THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-----------------------------------------------------------------------------
