親愛的訪客,
這個儲存庫、問題追蹤器等已被放棄,取而代之的是 https://github.com/Immediate-Mode-UI/Nuklear 。此問題追蹤器中的任何活動、任何拉取請求等都將被忽略。
期待在 https://github.com/Immediate-Mode-UI/Nuklear 中收到您的來信
核社區
這是一個用 ANSI C 編寫並在公共領域獲得許可的最小狀態立即模式圖形使用者介面工具包。它被設計為一個簡單的可嵌入應用程式使用者介面,沒有任何依賴項、預設渲染後端或作業系統視窗和輸入處理,而是透過使用簡單的輸入狀態作為輸入和繪製命令來描述原始形狀,從而提供了一個非常模組化的庫方法輸出。因此,它沒有提供嘗試抽象化多個平台並渲染後端的分層庫,而是只專注於實際的 UI。
該庫自包含在一個頭文件中,可以在僅頭文件模式或實作模式下使用。包含時預設使用僅標頭模式,並允許將此標頭包含在其他標頭中,但不包含實際實作。
此實作模式要求在#include之前在一個.c/.cpp 檔案中定義預處理器巨集NK_IMPLEMENTATION ,例如:
#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 );其他作者創建了許多針對不同語言的 nuklear 綁定。我無法測試它們的質量,因為我不一定精通這兩種語言。此外,不保證所有綁定始終保持最新:
由 Micha Mettke 和 GitHub 的所有直接或間接貢獻者開發。
嵌入 Sean Barrett 的stb_texedit 、 stb_truetype和stb_rectpack (公共領域) 嵌入 Tristan Grimmer 的ProggyClean.ttf字體(MIT 授權)。
非常感謝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.
-----------------------------------------------------------------------------