nuklear(A single-header ANSI C gui library,界面还不错)
Nuklear
This is a minimal state immediate mode graphical user interface toolkit written in ANSI C and licensed under public domain. It was designed as a simple embeddable user interface for application and does not have any dependencies, a default render backend or OS window and input handling but instead provides a very modular library approach by using simple input state for input and draw commands describing primitive shapes as output. So instead of providing a layered library that tries to abstract over a number of platform and render backends it only focuses on the actual UI.
Features
- Immediate mode graphical user interface toolkit
- Single header library
- Written in C89 (ANSI C)
- Small codebase (~18kLOC)
- Focus on portability, efficiency and simplicity
- No dependencies (not even the standard library if not wanted)
- Fully skinnable and customizable
- Low memory footprint with total memory control if needed or wanted
- UTF-8 support
- No global or hidden state
- Customizable library modules (you can compile and use only what you need)
- Optional font baker and vertex buffer output
- Documentation
Building
This library is self contained in one single header file and can be used either in header only mode or in implementation mode. The header only mode is used by default when included and allows including this header in other headers and does not contain the actual implementation.
The implementation mode requires to define the preprocessor macro NK_IMPLEMENTATION in one .c/.cpp file before #includeing this file, e.g.:
#define NK_IMPLEMENTATION
#include "nuklear.h"
IMPORTANT: Every time you include "nuklear.h" you have to define the same optional flags. This is very important not doing it either leads to compiler errors or even worse stack corruptions.
Gallery





Example
/* 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);

Bindings
There are a number of nuklear bindings for different languges created by other authors. I cannot atest for their quality since I am not necessarily proficient in either of these languages. Furthermore there are no guarantee that all bindings will always be kept up to date:
- Java by Guillaume Legris
- Golang by golang-ui@github.com
- Rust by snuk182@github.com
- Chicken by wasamasa@github.com
- Nim by zacharycarter@github.com
- Lua/Löve2d by Kevin Harrison
- Python by William Emerison Six
- CSharp/.NET by cartman300@github.com
Credits
Developed by Micha Mettke and every direct or indirect contributor to the GitHub.
Embeds stb_texedit, stb_truetype and stb_rectpack by Sean Barrett (public domain) Embeds ProggyClean.ttf font by Tristan Grimmer (MIT license).
Big thank you to Omar Cornut (ocornut@github) for his imgui library and giving me the inspiration for this library, Casey Muratori for handmade hero and his original immediate mode graphical user interface idea and Sean Barrett for his amazing single header libraries which restored my faith in libraries and brought me to create some of my own.
https://github.com/vurtun/nuklear
nuklear(A single-header ANSI C gui library,界面还不错)的更多相关文章
- header 跳转时报错误。Header may not contain more than a single header, new line detected
我在用php的header做跳转时,报错误. Header may not contain more than a single header, new line detected 先贴一下代码: c ...
- Quartz(GUI)图形界面程序----Quartz Web
下载.设置和运行Quartz(GUI)图形界面程序----Quartz Web 一.获取Quartz Web程序(Quartz GUI).早期的 Quartz 框架开发者意识到一个 GUI 对于某类用 ...
- centOS7下安装GUI图形界面
1.如何在centOS7下安装GUI图形界面 当你安装centOS7服务器版本的时候,系统默认是不会安装GUI的图形界面程序,这个需要手动安装CentOS7 Gnome GUI包. 2.在系统下使用命 ...
- CentOS7安装GUI图形界面
本文转自centOS7下安装GUI图形界面,侵权删. 1. 在命令行下 输入下面的命令来安装Gnome包. # yum groupinstall "GNOME Desktop" & ...
- CentOS7 下安装GUI图形界面GNOME
在安装Gnome包之前,需要检查一下网络是否有网络(使用ping www.baidu.com) 一.先装X windows,-y表示参数同意所有软件安装操,当出现 Complete!说明这里安装成功了 ...
- 我发起了一个 .Net 开源 跨平台 GUI (界面开发框架)项目 HtmlCore
大家好 , 我发起了一个 .Net 开源 跨平台 GUI (界面开发框架)项目 , 名字叫 HtmlCore . 项目的一个主要目标是可以用 .Net 在 移动设备 上 开发 GUI 程序 (界面程 ...
- CentOS7安装Gnome GUI图形界面
CentOS7安装Gnome GUI图形界面 最小化安装了.当时没 注意,后面一步步安装完了,结果直接启动到命令行模式了. 晕,又不想重新安装,直接想从命令行模式安装.在网上找了半天,终于找到一点小 ...
- Ubuntu: HDF5报错: HDF5 header version与HDF5 library不匹配
今天在执行一个用到hdf5的python脚本时,遇到如下错误 Warning! ***HDF5 library version mismatched error*** The HDF5 header ...
- golang gui library 库
andlabs/ui已经重写,稳定性增强,但是组件很少,只提供了几种基础的控件,慎用.gxui死了,别用.linuxdeepin转QT了,所以…… windows系统最好的选择是walk. 首先,写w ...
随机推荐
- phoenixframe自己主动化平台在Linux环境下运行用例的说明
phoenixframe自己主动化平台支持在Linux环境下使用phantomjs,Firefox.chrome运行測试用例.但有下面几个问题须要注意: 1.若无法启动phantomjs,Firefo ...
- 2. ZooKeeper的ZAB协议。
转自:https://blog.csdn.net/en_joker/article/details/78662880 ZooKeeper并没有完全采用Paxos算法,而是使用了一种称为ZooKeepe ...
- 2.Web开发过程流程图
转自:https://blog.csdn.net/hello_simon/article/details/19993343 最近公司在进行一系列新模块的开发,在痛苦开发的过程中,大家不时在一起进行总结 ...
- Mongodb总结6-数据库启动、停止、备份等命令
#启动Mongodb默认启动,需要在/data/db,Windows下对应的目录是Mongod.exe所在磁盘分区的根目录,例如Mongodb存放在D:/Mongodb,那么对应的路径就是D:/dat ...
- VC error link
错误1:LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main在project-setting-link里找到pro ...
- JS学习笔记 - fgm练习 - 鼠标移入/移出div样式改变
思路: div的默认样式正常设置. 鼠标移入时,发生改变的样式有3个,即 边框颜色,div背景色,字体颜色. 把这三个css改变设置在一个类名下,再通过js给div动态 添加/去除这个类名,实现div ...
- 洛谷——P3128 [USACO15DEC]最大流Max Flow
https://www.luogu.org/problem/show?pid=3128 题目描述 Farmer John has installed a new system of pipes to ...
- Python内部机制-PyObject对象
PyObject对象机制的基石 学过Python的人应该非常清晰,Python中一切都是对象,全部的对象都有一个共同的基类,对于本篇博文来说,一切皆是对象则是探索Python的对象机制的一个入口点.我 ...
- 8.4 Android灯光系统_源码分析_电池灯
电池灯的Java代码在batteryservice.java中 电池的状态电量等信息由驱动获得,但驱动不会主动做这些事情,因此肯定有个App调用驱动程序读取电池信息,称这个App为A应用. 还有个Ap ...
- JS-OO-数据属性,访问器属性
一.数据属性 Configurable:表示能否通过Delete删除属性从而重新定义属性,能否修改属性的特性,能否把属性修改为访问器属性.默认true. Enumerable:表示能否通过for-in ...